Repository navigation
fix(regenerate): stop writing ADR counts into the generated files - #26
Merged
Merged
Conversation
A count is a property of the whole ADR set, so two pull requests that each regenerate against their own base produce headers that are individually correct and wrong once merged. Git sees no conflict -- the per-ADR rows sit on separate lines and merge cleanly -- so the stale count only surfaces on the default branch afterwards, as a drift-check failure that needs a fix-up commit. Drop the three counts that reach committed output: the 'N of M ADRs' header in effective.md, the 'N ADRs across M topics' header in graph.md, and the '— N ADRs' suffix on its per-topic links. The sentences still say what each file is. Nothing global is written any more, so the drift cannot recur. `adr visualize` keeps its count: that output goes to stdout as a query result, not into a versioned file. Tests pin the absence rather than the wording, so the header can be reworded without silently letting a count back in. Co-Authored-By: Claude Fable 5 <[email protected]>
Merged
kompiro
added a commit
that referenced
this pull request
Aug 8, 2026
Releases #26 — regenerate stops writing ADR counts into effective.md and graph.md, so two PRs regenerating against their own base can no longer leave a stale aggregate on the default branch. Co-authored-by: Claude Fable 5 <[email protected]>
This was referenced Aug 8, 2026
kompiro
added a commit
to kompiro/karasu
that referenced
this pull request
Aug 8, 2026
adr-tools 0.0.11 stops writing aggregate counts into the files `adr regenerate` produces. A count is a property of the whole ADR set, so two PRs that each regenerated against their own base left main with a header that was wrong in a way git had no reason to flag -- it only surfaced afterwards as a drift-check failure (#2396). Regenerating removes the count from the effective.md header, the graph.md header, and the '— N ADRs' suffix on graph.md's per-topic links. The links themselves stay. Progress is tracked outside these files, so nothing is lost by not storing the numbers; `adr extract effective | wc -l` and `adr validate` still report them on demand, and `adr visualize` keeps its count because that output is a query result rather than a versioned file. Refs kompiro/adr-tools#26 Co-authored-by: Claude Fable 5 <[email protected]>
This was referenced Aug 9, 2026
kompiro
added a commit
that referenced
this pull request
Aug 9, 2026
#26 said it dropped "the three counts that reach committed output". There were four. renderTopicMarkdown() still wrote "N ADRs in this topic" into every docs/adr/graph/<topic>.md, and regenerate commits those, so they drift the same way: two branches regenerating against different bases each write a locally correct number and the merge keeps whichever landed last. karasu already hit it — its PR #2406 conflicted on graph/build.md with 71 / 70 / 72, the #26 scenario verbatim, after 0.0.11. Fifteen committed files there still carried a count. `adr visualize` keeps its count, unchanged: that output is a stdout query result, not a versioned file. The tests missed it because they pinned absence file by file, for the two files someone thought of. Replaced with a sweep over everything buildGeneratedFiles returns, so a new output is covered by default rather than by remembering, with a length guard so the sweep cannot pass vacuously. Closes #29 Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Merged
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.
Problem
regeneratewrites aggregate ADR counts into the files it generates. A count is a property of the whole set, so two PRs that each regenerate against their own base produce headers that are individually correct and jointly wrong.Git never flags it: the per-ADR rows sit on separate lines and merge cleanly. The stale count only shows up on the default branch after the merge, as a drift-check failure needing a fix-up commit.
Observed downstream in
kompiro/karasu— two ADR PRs landed within a day of each other andmainwent red onadr regenerate --check, with a two-line diff that was purely the counts (karasu#2396).Change
Drop the three counts that reach committed output:
effective.mdheaderAuto-generated by …. 302 of 311 ADRs are currently status: accepted…Auto-generated by …. Lists the ADRs that are status: accepted…graph.mdheader311 ADRs across 15 topics. Clusters group by topic…Clusters group by topic…graph.mdper-topic links- [\renderer`](graph/renderer.md) — 70 ADRs`- [\renderer`](graph/renderer.md)`Each sentence still says what the file is; only the numbers go.
renderOverviewno longer needs a per-topic tally, so its counting map becomes a plain sorted set of topics.adr visualizekeeps its count — that output goes to stdout as a query result, not into a versioned file, so it cannot drift.Why not keep the counts and fix the race another way
Removing the only global value is the change proportional to the failure: the per-ADR rows were never the problem.
Tests
The replaced test now pins the absence of a count rather than its wording, so the header can be reworded later without letting a count quietly back in, plus a new one covering
graph.mdand its per-topic links.pnpm test142 passed, lint and typecheck clean.Downstream
Needs a release before
kompiro/karasucan pick it up (currently on^0.0.10). Adopting it there is one dependency bump plus onepnpm adr:regeneratecommit.