diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 9256f4453b..74648461d0 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 -364 rows: 293 ACTIVE, 67 STUB, 4 ARCHIVED; 15 kept from the internal ledger, 349 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..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 ( @@ -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) } }