docs: the invariant row count is printed by the test, not kept in the file

Every pull request that added a row edited the hand-kept count line, so
each merge to main re-conflicted every open pull request. The check now
prints the count and fails if the file states one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-24 20:19:30 -08:00
1 parent f4dad3a8d6
commit dcc6c19556
2 files changed
+6 -9

No files matched your search

-1
View File
@@ -553,7 +553,6 @@ stateDiagram-v2
## Part B. Invariant ledger
360 rows: 289 ACTIVE, 67 STUB, 4 ARCHIVED; 15 kept from the internal ledger, 345 new.
The "Machine / transition" column refers to Part A. Notes under a table record what a row does not cover and, for kept rows, what was narrowed from the internal ledger.
@@ -175,19 +175,17 @@ func TestInvariantRowsNameExistingTests(t *testing.T) {
}
}
func TestInvariantRowCountMatchesTables(t *testing.T) {
func TestInvariantRowCount(t *testing.T) {
rows, doc := partB(t, repoRoot(t))
by := map[string]int{}
for _, r := range rows {
by[r.status]++
}
want := fmt.Sprintf("%d rows: %d ACTIVE, %d STUB, %d ARCHIVED", len(rows), by["ACTIVE"], by["STUB"], by["ARCHIVED"])
m := strings.Replace(countLine.FindString(doc), "`INV-` ", "", 1)
if m == "" {
t.Fatalf("invariants.md states no row count; the tables hold: %s", want)
}
if m != want {
t.Fatalf("invariants.md says %q; its tables hold %q", m, want)
// The count is printed here, never kept by hand in the file: a hand-kept
// line made every pull request conflict with every merge.
t.Logf("%d rows: %d ACTIVE, %d STUB, %d ARCHIVED", len(rows), by["ACTIVE"], by["STUB"], by["ARCHIVED"])
if m := countLine.FindString(doc); m != "" {
t.Fatalf("invariants.md states a row count (%q); remove it, this test prints the count", m)
}
}