Skip to content

fix(regenerate): stop counting on the per-topic graph pages too - #30

Merged
kompiro merged 1 commit into
mainfrom
fix/topic-view-adr-count
Aug 9, 2026
Merged

kompiro merged 1 commit into
mainfrom
fix/topic-view-adr-count

Conversation

@kompiro

@kompiro kompiro commented Aug 9, 2026 •

Copy link
Copy Markdown
Owner

Purpose

Closes #29

Summary

#26 said it dropped "the three counts that reach committed output". There were four. renderTopicMarkdown() still writes N ADRs in this topic into every docs/adr/graph/<topic>.md, and regenerate commits those files, so they drift exactly as #26 describes: two branches regenerating against different bases each write a locally correct number, and the merge keeps whichever landed last without conflicting on the header.

adr visualize keeps its count, unchanged — that output is a stdout query result, not a versioned file, which is the distinction #26 drew.

It already reproduced

karasu PR #2406 conflicted on docs/adr/graph/build.md with 71 / 70 / 72 ADRs in this topic, under 0.0.11. Fifteen committed files in that repo still carry a count.

Changes

  • src/visualizer.ts — renderTopicMarkdown() drops the count; the sentence still reads "Solid nodes belong to <topic>; gray dashed nodes are ghosts ..."
  • test/regenerator.test.ts — new sweep over every file buildGeneratedFiles returns, rejecting /\d+ ADRs/, with a length guard so it cannot pass vacuously
  • test/visualizer.test.ts — the renderTopicMarkdown unit test pins absence instead of asserting 3 ADRs

Why the sweep rather than a fourth named assertion

The bug is not that one file was forgotten; it is that the assertions were per-file, so coverage depended on someone listing the outputs. #26 added the right shape of test (pin absence, not wording) with the wrong scope. A sweep makes any output added later covered by default.

Verification

pnpm test 143 passed / 9 files, typecheck 0 errors, lint 0 warnings, format:check clean, build OK.

Confirmed the new sweep fails on the pre-fix code — reverting the visualizer change makes it report both per-topic pages the fixture produces:

- []
+ [
+   "graph/core-concepts.md: 1 ADRs in this topic. Solid nodes belong to `core-concepts`; ..."
+   "graph/parser.md: 2 ADRs in this topic. Solid nodes belong to `parser`; ..."
+ ]

Note on versioning

No version bump here, following the 0.0.11 convention (a separate chore(release): PR) — see #28, still open.

#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]>
@kompiro
kompiro merged commit 66bcd4e into main Aug 9, 2026
1 check passed
@kompiro
kompiro deleted the fix/topic-view-adr-count branch August 9, 2026 14:41
kompiro added a commit to kompiro/karasu that referenced this pull request Aug 9, 2026
…#2416)

0.0.11 removed the ADR counts from effective.md and graph.md but left
renderTopicMarkdown() writing "N ADRs in this topic" into all 15 committed
docs/adr/graph/*.md pages, so those kept drifting between parallel branches.
PR #2406 hit it: graph/build.md conflicted with 71 / 70 / 72.

adr-tools 0.0.12 (kompiro/adr-tools#30) drops that fourth count and replaces
the two named-file assertions with a sweep over every generated file, so a
future output is covered without anyone remembering to list it.

The lock diff is large but nothing moved version. Comparing name@version
across the lock with peer suffixes stripped, the only resolution changes are
adr-tools 0.0.11 -> 0.0.12 and the drop of @babel/helper-validator-identifier
and @types/estree, which nothing needs any more. The remaining ~550 lines are
pnpm re-keying peer suffixes; a fresh install on main is a no-op, so this is
the graph change re-keying, not pre-existing drift.

Refs #2407

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

Per-topic graph pages still write an ADR count (#26 missed the fourth one)

1 participant