Repository navigation
fix(app-bundle): overlay-sync test stops mutating the fork checkout; add refusal guards (#842) - #1001
Merged
Merged
Conversation
…add refusal guards (#842) The overlay-sync suite ran `--apply` with no target, resolving the real fork checkout and copying its current branch over the committed overlay (~250 files mutated mid-suite — the repeated working-tree hazard the #823 origin-flip cast had to restore before every commit). The sync also treated the fork as authoritative for files amicode had fixed (#964/#929/#832), so a sync could silently revert a fix. - overlay-sync.mjs: add --target / --manifest / --source-branch plus a no-write --check mode; refuse --apply when the source checkout is off the expected branch (default local/amicode) or dirty — named remedy, and a recorded AMICODE_OVERLAY_SYNC_OVERRIDE waiver (an empty reason refuses); refuse, writing nothing, when the post-apply tree would revert a known amicode-side fix, naming the fix. - known_fixes.mjs: the known-fix fixture list extracted to ONE shared module consumed by both overlay-sync.mjs and deploy_guard.mjs (no forked copy). - deploy_guard.mjs: import the shared list instead of carrying its own. - overlay_sync.test.ts: every invocation aims --source/--target at a temp tree; add a beforeAll/afterAll hash proof that the real overlay stays byte-clean across the suite. - deploy_guard.test.ts: cross-check the shared list against the #964 source of record (parity test) and assert deploy_guard no longer forks it. Closes #842.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
aarontrowbridge
marked this pull request as ready for review
September 10, 2026 23:15
Closed
6 tasks
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.
Related Issue
Closes #842
Description
The overlay-sync suite ran
overlay-sync.mjs --applywith no target, which resolved the real fork checkout and copied its current branch overpackages/app-bundle/overlay/**— ~250 committed files mutated mid-suite (the repeated working-tree hazard the #823 origin-flip cast had to restore before every commit). Separately, the sync treated the fork as authoritative for every file it copied, including files amicode had fixed, so a sync could silently revert a recorded fix (the #964 class).This change:
overlay-sync.mjs— adds--target/--manifest/--source-branchand a no-write--checkmode.--applynow refuses when the source checkout is on the wrong branch (defaultlocal/amicode) or dirty, with a named remedy;AMICODE_OVERLAY_SYNC_OVERRIDE=<reason>waives it but is recorded (empty reason refuses). Crucially,--applyrefuses writing nothing when the post-apply tree would revert a known amicode-side fix, naming the fix.known_fixes.mjs(new) — the known-fix fixture list extracted to ONE shared module consumed by bothoverlay-sync.mjsanddeploy_guard.mjs; no third forked copy.deploy_guard.mjs— imports the shared list instead of carrying its own.overlay_sync.test.ts— every invocation aims--source/--targetat a temp tree; adds abeforeAll/afterAllhash proof that the real overlay stays byte-clean across the suite.deploy_guard.test.ts— parity test cross-checks the shared list against the Sync-reconciliation: the fork→overlay sync clobbers amicode-side fixes (#929's fix regressed by ff7b69c8; the diff_version fix owes a fork mirror) #964 source of record and assertsdeploy_guardno longer forks it.Type of Change
Verification
pnpm run typecheckexits 0 (all 4 workspace projects: schema, amico-run, extension)pnpm -r run testexits 0 — focused suites run here (below); full suite not run in-castFocused suites (run twice, idempotence):
Hygiene proof —
git status --porcelain packages/app-bundle/overlayis EMPTY both after run 1 and after run 2, and the full worktree status is empty (the suite no longer mutates committed overlay state).Manual Testing Notes
--checkagainst the real repo: read-only, exit 1 on drift (expected; the local fork is currently onagent-picker-order, notlocal/amicode).--applyagainst the real fork with a temp--target: refused by the source-branch guard (branch 'agent-picker-order', expectedlocal/amicode), wrote nothing — temp target directory remained absent.Ops note for the director: the shared fork checkout
~/harmoniqs/opencodeis onagent-picker-order(clean). The new branch guard means a defaultoverlay-sync --applyon this machine now refuses rather than clobbering — intended, but the director should decide whetherlocal/amicoderemains the right expected branch for this checkout, or whether the sync should be run with--source-branch/ a recorded override. That shared checkout was not switched by this cast.