From dcc6c1955649fe635428b26b6f21fa2d22a40a14 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Tue, 24 Nov 2026 20:19:30 -0800 Subject: [PATCH 1/2] 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 --- seaweed-block/docs/design/invariants.md | 1 - seaweed-block/internal/invcheck/invariants_test.go | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index d438f2b839..402e405a6b 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -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. diff --git a/seaweed-block/internal/invcheck/invariants_test.go b/seaweed-block/internal/invcheck/invariants_test.go index deef7af9c5..eff9ca5c90 100644 --- a/seaweed-block/internal/invcheck/invariants_test.go +++ b/seaweed-block/internal/invcheck/invariants_test.go @@ -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) } } From 609b485604038eaa49793c43058f99cb240c9ef2 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Tue, 24 Nov 2026 20:20:59 -0800 Subject: [PATCH 2/2] docs: invcheck package comment matches the printed row count Co-Authored-By: Claude Opus 5.5 --- seaweed-block/internal/invcheck/invariants_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/seaweed-block/internal/invcheck/invariants_test.go b/seaweed-block/internal/invcheck/invariants_test.go index eff9ca5c90..08629162c7 100644 --- a/seaweed-block/internal/invcheck/invariants_test.go +++ b/seaweed-block/internal/invcheck/invariants_test.go @@ -1,7 +1,7 @@ -// Package invcheck checks docs/design/invariants.md against the code: the -// row count it states is the count its tables hold, every Go test a row -// names exists, an ACTIVE row names at least one test, and a statement is -// short (one property per row). +// Package invcheck checks docs/design/invariants.md against the code: every +// Go test a row names exists, an ACTIVE row names at least one test, a +// statement is short (one property per row), and the file keeps no hand-written +// row count (the test prints it). package invcheck import (