[REFACTOR] applyMigration helper split + non-canonical-file copy#10
Open
gradyzhuo wants to merge 1 commit into
Open
[REFACTOR] applyMigration helper split + non-canonical-file copy#10gradyzhuo wants to merge 1 commit into
gradyzhuo wants to merge 1 commit into
Conversation
Factors the memory-migration logic into smaller, doc-commented helpers: - `applyMigration` now walks every entry under sourceDir, special-casing MEMORY.md (wrapped as a fragment via the new `writeMigrationFragment`) and copying everything else with skip-existing semantics. - New `writeMigrationFragment` records the source content as a migrate- action fragment under destDir/fragments/. - New `copyTreeSkipExisting` recursively copies a tree while preserving any pre-existing destination files. Adds MemoryMigrationTests covering: merge=false no-op, MEMORY.md becomes a fragment, non-canonical files copy when missing, and existing files preserved on collision. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits the memory-migration logic into smaller, documented helpers and expands what gets carried across when an env's memory dir is migrated between shared and isolated layouts.
applyMigrationnow walks every entry undersourceDir:MEMORY.mdis special-cased — wrapped as a fragment via the newwriteMigrationFragmentso the agent picks it up on the nextorrery_memory_readand consolidates it without clobbering dest'sMEMORY.md..mdfiles, subdirectories, existing fragments) is copied with skip-existing semantics so dest's existing files are never overwritten.writeMigrationFragmentrecords the source content as amigrate-action fragment withid/peer/timestamp/actionfrontmatter underdestDir/fragments/.copyTreeSkipExistingrecursively copies a tree while preserving destination collisions.Test plan
swift test— 143 tests pass (134 baseline + 9 new inMemoryMigrationTests):merge=falseis a no-op.mdfiles copy to dest when missing🤖 Generated with Claude Code