feat(dev): add a docs/state.md rebase-conflict resolver - #1389
Draft
lusoris wants to merge 1 commit into
Draft
Conversation
docs/state.md conflicts on nearly every rebase of a branch that touches it, and unlike the other append-only bookkeeping files it is deliberately not in the merge=union list: its rows move between "Open bugs" and "Recently closed", so a union merge would duplicate the row and leave a closed bug reading as open forever. That leaves a by-hand resolution every time, with "keep both sides" as the tempting wrong answer -- which is what check-state-md-rows.sh gates, and what a rebase sweep of seven PRs onto master produced today before the gate caught it. Encode the correct rule instead. master's side wins for any row both sides carry, because master is the more advanced state; the branch contributes only rows master does not have at all. Deduplication is by bug id rather than by line, so a row master reworded is not re-added in its stale form. The docs and the gate's failure message both name the script, and the docs are explicit about the case it cannot decide: a row the branch itself moved to "Recently closed" loses to master's older "Open bugs" copy and has to be redone by hand. Verifying with check-state-md-rows.sh afterwards is not optional. Both scripts assemble conflict markers at runtime rather than containing them literally, so they do not trip the no-conflict-markers hook on themselves. Refs: ADR-0165 Co-Authored-By: Claude Opus 5 <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
docs/state.mdconflicts on nearly every rebase of a branch that touches it, andunlike the other append-only bookkeeping files it is deliberately not in the
merge=unionlist — its rows move between "Open bugs" and "Recently closed",so a union merge would duplicate the row and leave a closed bug reading as open
forever.
That leaves a by-hand resolution every time, with "keep both sides" as the
tempting wrong answer.
scripts/ci/check-state-md-rows.shgates it — and earnedits keep today: a rebase sweep of seven PRs onto master produced exactly that
breakage in all seven, and the gate caught every one.
This encodes the correct rule instead:
advanced state, already carrying every row merged ahead of the branch,
including one the branch also touches but master has since moved or reworded.
bug id.
Deduplication is by bug id rather than by line, so a row master reworded is not
re-added in its stale form.
The docs are explicit about the case the script cannot decide: a row the branch
itself moved to "Recently closed" loses to master's older "Open bugs" copy and
has to be redone by hand. Verifying with the gate afterwards is not optional.
Both scripts assemble conflict markers at runtime (
"<" * 7) rather thancontaining them literally, so they don't trip the
no-conflict-markershook onthemselves.
Reproducer / smoke-test command
Verified in anger on nine branches today (#1367-#1374, #1382, #1383): all report
check-state-md-rows: OKwith no duplicate ids after resolution.Deep-dive deliverables (ADR-0108)
.gitattributes' own exclusion comment; this encodes it.docs/state.md merge=union) is the exact thing.gitattributesdocuments as wrong, and PR fix(docs): one row per bug id in state.md, and a gate that keeps it that way #1322 already removed it.AGENTS.mdinvariant note — no rebase-sensitive invariants.changelog.d/added/0165-state-md-conflict-resolver.md,CHANGELOG.mdregenerated.Docs (rule 10)
docs/development/ci.mdgains a"Resolving a
docs/state.mdrebase conflict" section covering the rule, thecommands, and the case the script cannot decide.
scripts/ci/check-state-md-rows.shnames the script in its failure message.State (rule 13)
no state delta: developer tooling, no bug opened or closed.
🤖 Generated with Claude Code