fix: validate legacy template ownership before migration - #126
Draft
PatrickSys wants to merge 1 commit into
Draft
Conversation
Run the existing template and destination tracking preflight against the legacy root before renaming it. Preserve consumer paths and bytes when those checks refuse init, and revalidate before applying generated changes.
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.
Legacy
init --migraterenames.planningto.workbefore validating template ownership and destination tracking policy. If those checks refuse initialization, the consumer is left with a moved state root despite the failed command.Run the existing template/config/tracking preflight against the legacy directory before renaming, using
.workas the destination identity. Revalidate after migration before applying generated changes. Add regression coverage for missing, corrupt, incomplete and unowned template state, a destination tracking conflict, repeated refusals, and a valid migration that preserves unrelated consumer bytes.Verified on Linux with Node v24.19.0:
node tests/run-all.cjs: all 30 test files pass; the accepted-failure list is empty.node tests/run-proof.cjs: clean across 11 tracked runners after fetching the historicalb7c8b7bd54e1764826cb55763440a676181bc851pin. This checks proof staleness, not execution of the pinned proofs.git diff --check: clean.This addresses pre-rename template and tracking refusals. It does not make all later initialization writes atomic or repair consumers already left in a partially migrated state. The PC tunnel was unavailable, so this is a candidate against committed main
61b27708; the local.work/ROADMAP.mdand uncommitted PC changes could not be checked.Context: persisted consumer-recovery recommendation.