Skip to content

fix(#954): bump NDC generation marker on the git-reconcile conflict path too - #958

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/954
Oct 7, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/954

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

git-reconcile's conflict-handling path (_grc_report_conflict in hooks.d/after_save/60-git-reconcile.sh) never called _grc_bump_ndc_gen, unlike the fast-forward and successful-rebase paths in the same hook. By the time _grc_report_conflict runs, git rebase has already failed with a real conflict and already rewritten the slug's now.md to conflict-marker content -- the same "tree already rewritten, regardless of downstream success" shape the other two call sites are bumped for.

Reasoned consequence (not reproduced, #932): an NDC consolidation round snapshotting now.md inside that window would see an unchanged generation counter and could trim local lines it never actually summarised.

Fix: added an unconditional _grc_bump_ndc_gen call at the top of _grc_report_conflict, before the quit/checkout outcome is known.

Tests: added TestNdcGenerationBump.test_conflict_bumps_ndc_generation -- a real two-clone conflict (no shim needed). Watched it fail first (1 failed, generation marker never created) by stashing the fix, then pass after unstashing. Full file: pytest tests/test_git_reconcile_903.py -q -> 21 passed, run twice, no regressions.

Self-review: Explore and oss:auditor reviewed concurrently. Explore found one stale-prose finding -- the rationale comment above _grc_bump_ndc_gen's definition still only named the fast-forward/rebase paths -- fixed in a follow-up commit. oss:auditor's checklist (silent-absence-via-sequencing, guard-nominally-on, untrusted-text-boundary-forging, cross-platform skip coverage) came back clean with reasoning shown for each class.

Closes #954


🤖 Generated with Claude Code

[AI-generated]

fdaviddpt and others added 2 commits October 7, 2026 11:47
…ath too

_grc_bump_ndc_gen (hooks.d/after_save/60-git-reconcile.sh) was called from
the fast-forward path and the successful-rebase path, but not from
_grc_report_conflict -- the one remaining now.md-rewriting path. By the
time _grc_report_conflict runs, `git rebase` has already failed with a
real conflict, meaning it already rewrote the slug's now.md to
conflict-marker content before the scoped quit/checkout restore even
starts. An NDC consolidation round that snapshots now.md inside that
window saw an unchanged generation counter and could trim local lines it
never actually summarised (#932's reasoned consequence).

Bump unconditionally at the top of _grc_report_conflict, mirroring the
"bump as soon as the tree is rewritten, regardless of downstream success"
rule the other two call sites already follow -- so a failed quit or
checkout (still reported honestly) does not suppress it either.

Added TestNdcGenerationBump.test_conflict_bumps_ndc_generation, reusing
the same plain two-clone conflict shape as
TestScopedAbort.test_file_added_by_the_upstream_side_before_the_conflict_is_pruned.
Confirmed red before the fix (failed on the missing bump) and green after.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
… rationale comment

Explore review finding: the top-of-file comment explaining why
_grc_bump_ndc_gen exists at all ("bumping the SAME counter after a
successful fast-forward/rebase below...") was written for the original
two call sites and never updated when this same commit added the third,
the conflict path -- a reader skimming only this summary comment would
still believe the bump only fires on success paths. Updated to name the
conflict path too; the call site's own adjacent comment already explained
it correctly, this was the one older summary comment left stale.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@fdaviddpt
fdaviddpt merged commit 78b3ff2 into main Oct 7, 2026
19 checks passed
@fdaviddpt
fdaviddpt deleted the fix/954 branch October 7, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git-reconcile: conflict path never calls _grc_bump_ndc_gen, unlike the fast-forward/successful-rebase paths

1 participant