Repository navigation
Conversation
_grc_report_conflict's backup copy, restore copy, and the abort itself all discarded their own exit status with `|| true`. A failed `cp -p`/`mkdir -p` during the backup read exactly like "nothing to restore" and the hook went on to claim "aborted, the tree is unchanged" even though the concurrent write was discarded by the abort regardless. A `find` failure during restore (e.g. shadowed by Windows' System32 find.exe in Git Bash, same class as save-session.sh:1650/session-start-hook.sh:2151) silently restored zero of N files while the backup directory was still deleted, and the notice claimed a restore that never happened. An abort that itself failed (e.g. a concurrent index.lock) left the rebase genuinely stuck while still reporting "the tree is unchanged". Count backup/restore successes and failures explicitly, check the abort's own exit status plus a post-abort _grc_rebase_in_progress check, and only delete the backup directory once every restore it was holding is confirmed to have succeeded. Every other outcome is now reported for what it actually is instead of defaulting to the success message. Reproduced red (three new tests against the pre-fix code, each failing for the documented reason) then green against the fix: tests/test_git_reconcile_903.py::TestBackupRestoreExitStatus. Found by the release-auditor during the v0.42.0 gate 3 audit, round 2. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…foreign paths The #939/#942 fix snapshotted foreign (non-$SLUG/) changes via `git status --porcelain` before calling `git rebase --abort`, then copied the snapshotted bytes out, aborted, and restored them. A write landing in the window between the snapshot and the abort call is not in the snapshot, is not copied, and is discarded by the abort exactly like the original #939 bug -- the #939 fix's own commit message already named this residual race and deferred closing it. Rather than racing a tighter snapshot against the abort, stop the abort from ever touching anything outside $SLUG/ in the first place, so there is nothing left to race: 1. `git rebase --quit` drops the rebase state (.git/rebase-merge or rebase-apply) WITHOUT resetting HEAD, the index, or the working tree -- unlike --abort, which is effectively `reset --hard ORIG_HEAD` across the whole tracked tree. 2. `git symbolic-ref HEAD refs/heads/$BRANCH_NAME` points HEAD back at the branch. A plain ref rewrite, not a checkout -- safe because a rebase never moves the branch ref itself until its last (successful) step, so a conflicted/quit rebase left it exactly where it was. 3. `git checkout HEAD -- "$SLUG"` restores ONLY the $SLUG/ subtree to that pre-rebase content. Every commit this run could have replayed is confined to $SLUG/ (a save commits to its own slug's subtree alone), so this fully undoes the rebase, scoped to exactly the part of the tree this run owns. No path outside $SLUG/ is ever named, read, or written by any of these three commands, so a foreign write landing at any point -- before, during, or after this sequence -- survives untouched. The entire backup/restore dance the #939/#942 fix needed is gone; _grc_foreign_changes stays, but now only to name what survived in the log line, after the fact. Verified against a real repository (scratch reproduction) before writing this: the scoped sequence restores $SLUG/'s pre-rebase content and moves HEAD back exactly where a successful `rebase --abort` would, while a write to a different path is untouched throughout. Reproduced red (TestScopedAbort, three new tests -- the TOCTOU-window write, a failed `rebase --quit`, a failed scoped checkout -- each failing against the #942-only code for the documented reason) then green against this fix: tests/test_git_reconcile_903.py::TestScopedAbort. The three #942-era tests that exercised the now-removed backup/restore machinery (copyfail/nofind/abort-failure) are replaced by these, since that machinery no longer exists to have an exit status. Found by the release-auditor during the v0.42.0 gate 3 audit, round 2. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…OU fixes Co-Authored-By: Claude Sonnet 5 <[email protected]>
…checkout Review finding (Explore, self-review of the #943 commit): `git checkout <tree-ish> -- <pathspec>` only ever RESTORES a path that exists in <tree-ish> -- it never REMOVES a path present in the index/working tree but absent from it. `git rebase --abort` (what the scoped sequence replaced) is effectively a `reset --hard` across the whole tree, and DOES prune such a path; the quit+symbolic-ref+checkout replacement did not, leaving a gap. Reproduced: the UPSTREAM side being rebased onto can have its own earlier commit that cleanly adds a new file under $SLUG/, before a later commit conflicts. Once the rebase sets up that new base to replay onto, the new file is checked into the index as an addition relative to this run's own pre-rebase HEAD. `git rebase --quit` does not touch it, and the scoped checkout does not remove it either, since HEAD's own pre-rebase tree never had it. Left unpruned, it reads as test-slug's own untouched content and would be silently committed by the very next ordinary save -- reintroducing content the abort was supposed to have fully discarded. Fixed by diffing the post-checkout state against HEAD, scoped to $SLUG/, for anything the diff calls an addition (`git diff --name-only --diff-filter=A HEAD -- "$SLUG"`), and removing each such path with `git rm -f`. This stays scoped to $SLUG/ -- a foreign path is still never named, read, or written, which is the entire point of #943. Also fixes stale prose in the file's own header comment (still described the #939/#942 backup/restore/abort mechanism #943 deleted, including the false claim that `git rebase --abort` is still called), and adds a note to changelog.d/942.fixed.md that the mechanism it documents was itself superseded by #943, shortly after, before any release shipped it. Reproduced red (new test TestScopedAbort::test_file_added_by_the_upstream_side_before_the_conflict_is_pruned, through the actual hook subprocess, not just raw git) against the pre-this-fix code, then green against this fix. Co-Authored-By: Claude Sonnet 5 <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Oct 7, 2026
, NDC-bump gap, notice attribution) (#947) Found by the release-auditor during the v0.42.0 gate 3 audit (round 3), ranked fails-to-preserve/misreports (non-blocking) per skills/manager/phases/findings.md. Two of the four (the slug-scoped restore and the symbolic-ref branch mismatch) are regressions introduced by #945; logged as trap.d fragments rather than filed, per that table's "can ship behind a trap.d fragment" row. Related to #939, #932, #942, #943, #946. Co-authored-by: Claude Sonnet 5 <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Oct 7, 2026
…wrapper-grant gap) (#949) Found by the release-auditor during the v0.42.0 gate 3 audit (round 4, verdict findings, 0 blocking). Ranked fails-to-preserve/misreports (non-blocking) per skills/manager/phases/findings.md. Logged as trap.d fragments rather than filed, per that table's "can ship behind a trap.d fragment" row. The autostash gap is a regression from #945; the wrapper-grant gap predates this release (#879). Related to #939, #942, #943, #945, #946. Co-authored-by: Claude Sonnet 5 <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Oct 7, 2026
…y-fixed) (#955) Curates the 13 trap.d/ fragments waiting since the v0.42.0 release gate 3 audit and self-review rounds. Promoted (paths layer, fired proven both directions): - curate-pr-title-counts-must-be-derived.md (#921: a curate PR's title arithmetic must come from the enumerated per-fragment list, not be restated by hand) - hook-notice-must-not-claim-unverified-tree-state.md (#946 plus two of the #945 regressions: a hook notice must not claim a tree/branch state that was never actually checked) Declined, still true at HEAD, filed as new tracking issues: - #950 consolidates the two 879 wrapper-grant gaps in check_release_tree.py - #951: 933's fast-path test has no positive evidence the fast path ran - #952 consolidates the three 945 regressions (autostash, restore scope, symbolic-ref target) in 60-git-reconcile.sh's rebase --quit rewrite - #953: 946's could-not-tell/nothing-there collapse in _grc_rebase_in_progress - #954: 932's missing _grc_bump_ndc_gen call on the conflict path Declined, already fixed or already documented, no new issue: - 913 (windows-cygpath-test-skip): already recorded verbatim in docs/windows-skip-triage.md's own row - 939 x2 (abort-exit-status-unchecked, foreign-commit-dropped-by-abort): the --abort call path they describe no longer exists, superseded by #945's rebase --quit rewrite Every disposition's reason is in the paths-layer 00-README.md so the next pass finds a decision, not a repeat of the same question. Co-authored-by: Claude Sonnet 5 <[email protected]>
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.
Issue-number note for the reviewer: this pull request's own original brief had the #942/#943 claim mapping REVERSED from the actual GitHub issues. The real #942 is the mechanical one (exit-status swallowing in the #939 backup/restore/abort dance); the real #943 is the deeper one (the snapshot/abort TOCTOU gap). This pull request is written against the real, confirmed issue numbers throughout -- confirmed independently via
gh-issue:942/gh-issue:943and by a separate recon pass, both agreeing with each other and disagreeing with the original brief.#942 -- exit-status swallowing (mechanical)
hooks.d/after_save/60-git-reconcile.sh's_grc_report_conflict(added by the #939 fix, commit 720387a) had three|| trueswallowed exit statuses: the backupmkdir -p/cp -ppair, the restoremkdir -p/cp -ppair plus an uncheckedfind, andgit rebase --abortitself. A failed backup copy read exactly like "nothing to restore" and the hook still logged "aborted, the tree is unchanged" even though the concurrent write had just been discarded. Afindfailure during restore (e.g. shadowed by Windows' System32find.exein Git Bash, same class assave-session.sh:1650/session-start-hook.sh:2151) silently restored zero of N files while the backup directory was deleted regardless, and the notice claimed a restore that never happened. An abort that itself failed (e.g. a concurrentindex.lock) left the rebase genuinely stuck while still reporting success.Fixed by counting backup/restore successes and failures explicitly, checking the abort's own exit status plus a post-abort
_grc_rebase_in_progresscheck, and only deleting the backup directory once every restore it held is confirmed successful.Closes #942
#943 -- the TOCTOU gap (deeper, obsoletes #942's own machinery)
Even with #942's fix, a foreign write landing in the window between the
git status --porcelainsnapshot (_grc_foreign_changes) and thegit rebase --abortcall was still discarded -- the #939 fix's own commit message had already named and deferred exactly this race.Investigated two directions named in the issue: (a) scope the abort to never touch paths outside the slug, or (b) a store-wide lock shared with
50-git-backup.sh. Chose (a):RC_LOCK_DIR/git-reconcile.lockturned out to already be store-wide, but it only locks against another reconcile instance, not againstsave-session.sh's own raw foreground append tonow.mdfor a different slug -- a write with no lock around it at all, which would still land inside the race window even with a store-wide lock added to50-git-backup.sh. A lock extension therefore would not have fully closed the gap; the scoped-abort approach closes it structurally instead.Replaced
git rebase --abort(effectivelyreset --hard ORIG_HEADacross the whole tracked tree) withgit rebase --quit(touches nothing) +git symbolic-ref HEAD refs/heads/$BRANCH_NAME(plain ref rewrite, safe because the branch ref never moves until a rebase's last, successful step) + a scopedgit checkout HEAD -- "$SLUG"(restores only this run's own slug subtree). No path outside$SLUG/is ever named, read or written by any of the three commands, so there is no snapshot left to race against the abort at all -- the window is closed, not narrowed. This fully replaces and removes #942's own backup/restore/abort machinery (now unreachable, deleted).Closes #943
Self-review found a real bug, fixed in a follow-up commit
Spawned two reviewers concurrently against the 3-commit diff (tree-snapshot taken before, compared after per
agents/developer/review.md). One reviewer found 3 real findings, all fixed in a 4th commit: (1)git checkout <tree> -- <pathspec>only ever RESTORES a path present in<tree>-- it never REMOVES a path present in the index/working tree but absent from it, unlikegit rebase --abort's effectivereset --hard. Reproduced: when the upstream side being rebased onto has its own earlier commit cleanly adding a new file under$SLUG/before a later conflicting commit, that file is left behind as a stray tracked addition by the scoped-abort sequence -- it would be silently committed by the very next ordinary save. Fixed with a scopedgit diff --name-only --diff-filter=A HEAD -- "$SLUG"+git rm -fprune step after the checkout, exit status checked the same way as #942's fix. (2) stale top-of-file DESCRIPTION prose still describing the removed #939/#942 backup/restore mechanism and falsely claiminggit rebase --abortis still called -- fixed. (3)changelog.d/942.fixed.mddescribed the #942 machinery in the present tense even though #943 deleted it before any release shipped it -- fixed with a superseded-by note.A second reviewer (auditor-style) reported 2 additional findings, both dispositioned below-bar:
_grc_foreign_changessilently swallowing agit status --porcelainfailure into the same empty value a clean tree produces, and arebase --quit-failure fallthrough that can claim "cleared" when that was only inferred, never confirmed. Both are real findings with no realistically reachable caller: both require git itself to fail transiently at a point in the same function where several other git calls against the same repo had just succeeded moments earlier. (below-bar-anchor-01-status-swallow) (below-bar-anchor-01-quit-fallthrough)Testing
Narrowed runs only, never the full
pytestsuite, per this repo's own CLAUDE.md and the developer brief:python3 -m pytest tests/test_git_reconcile_903.py tests/test_scanner_shapes_source_898.py -q --no-cov, green at 406/406 after the #942 and #943 commits, 407/407 after the follow-up commit. Red-before-fix reproduced for every commit by temporarily reverting the hook script to its pre-that-commit state, running the new test(s), confirming they failed for the documented reason, then restoring the fix.scripts/lane_setup.pyfrom the oss plugin cache checked for cross-cutting guards against both touched files -- none matched..oss/assemble_changelog.py --checkpassed cleanly after both changelog fragments were added.Cross-platform
All platform claims here are REASONED, not OBSERVED (ran only on darwin).
tests/test_git_reconcile_903.pyalready carries a file-level Windows skip (bash hook subprocess + POSIX flock/git semantics, #79), unchanged by this diff, so every new test in this pull request also runs on zero CI legs for Windows -- pre-existing, not introduced here. Reasoned: removing thefind/cp/mkdirbackup-restore machinery entirely in #943 removes rather than reintroduces the Windowsfind.exe-shadowing hazard #942 named, since the replacement sequence (git rebase --quit,git symbolic-ref,git checkout) uses none of those three binaries.Docs
.oss.json'sdocs_targetsnames onlyREADME.md; checked (grepped for "reconcile" and "conflict", zero hits either case) and confirmed no-change-needed -- this is an internal hook-conflict-handling fix with no user-facing interface change. Two changelog fragments added underchangelog.d/.🤖 Generated with Claude Code
[AI-generated]