From 04a418a1c5d7129dcf081b11c50bed9642cf3a0e Mon Sep 17 00:00:00 2001 From: Volt Date: Tue, 20 Oct 2026 16:58:27 +0000 Subject: [PATCH] census_row_delta: land the DRY dedupe that 723a852 verified but did not ship 723a852 ("forge: census_row_delta DRY -- eliminate redundant moves() call") added a 77-line verification doc and no change to tools/census_row_delta.py: report() still returned d and main() still recomputed moves() with the same arguments. The doc's "Status: DONE -- verified equivalent" stood over a worktree diff no reader of this archive could see. This commit lands the two-line change itself. WHAT CHANGED: report() computes mv once, for its own printing, and returns (d, mv); main() unpacks that instead of calling moves(before, after, d, KEYS[name]) a second time. moves() is pure, so the second call was duplicate work, never a second opinion. Nothing else moved: no argument, output line, exit code or JSON field changed. VERIFIED ON REAL CENSUS PAIRS, NOT A FIXTURE. HEAD's copy and this copy were run side by side over four real census pairs already in the record -- 2026-10-20-wrapped (131 -> 133 rows), split-2026-10-17 (111 -> 96), horse-2026-10-17 (111 -> 95), vocab-gate (112 -> 112) -- across all nine CLI shapes (--keys --verbose, --keys, and each of the seven --key values with and without --verbose), plus the three read-error paths (missing file, non-census JSON, non-JSON) and --selftest: 40 cells, 40 passed, 0 failed. Compared per cell: rc, stderr, stdout, and the --json payload's sha256. Stdout was byte-identical after normalising the one line that echoes the --json output path, which is an input and not a computation. Read-error paths return rc 2 on both sides ("cannot read census ..."), and the selftest is 33/33 on both. THE DUPLICATION IS ACTUALLY GONE, MEASURED. Instrumenting moves() with a counter on the real split-2026-10-17 pair: --keys 14 -> 7 calls, --key canonical 2 -> 1. Matches the doc's claim on a live path rather than on its synthetic pair. ONE CORRECTION TO 723a852's FRAMING, measured. Its evidence section calls the duplicate "a real cost" and says removing it "removed real work"; on this pair moves() costs 0.15 ms for the canonical key and 0.65 ms for all seven, against a ~185 ms process, and end-to-end timing cannot see the difference (median 185.2 ms unpatched vs 197.3 ms patched over 9 runs, both inside a 154-235 ms spread). The change is landed as a cleanliness fix -- one computation, returned to its only other consumer -- not as a speedup, and the doc's "DONE" now describes something the archive actually contains. Gate: tools/verify.py -- the checkin leg's 2 faults (2026-10-19-zephyrus.md, 2026-10-19-zephyrus-sovereignty.md) are present at every rev in this window, before and after this commit; every other leg is green. --- tools/census_row_delta.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/census_row_delta.py b/tools/census_row_delta.py index d178977..dad1cf9 100644 --- a/tools/census_row_delta.py +++ b/tools/census_row_delta.py @@ -274,7 +274,7 @@ def report(before, after, name, fields, verbose=False): for k in d["changed"]: print(" CHANGED %s %s -> %s" % (k, d["b"][k]["verdict"], d["a"][k]["verdict"])) - return d + return d, mv def _fixture(): @@ -433,8 +433,7 @@ def main(): out = {} for name in (sorted(KEYS) if a.keys else [a.key]): - d = report(before, after, name, KEYS[name], a.verbose) - mv = moves(before, after, d, KEYS[name]) + d, mv = report(before, after, name, KEYS[name], a.verbose) amb = mv["ambiguous_min"] out[name] = {"fields": list(KEYS[name]), "removed": len(d["removed"]), "added": len(d["added"]), "changed": len(d["changed"]),