[object Object]

← back to Designerwallcoverings

TK-11483: skipped foreign ledger lines are reported, never silent

67d7eb3755dc8bbd1a6243e9419e9b7f54eb4ad6 · 2026-09-11 12:45:30 -0700 · Steve Abrams

Second-model review flagged that relevance-scoped ledger parsing could mask
degradation of the shared ledger. The counter existed but was never surfaced, so a
rising number of unparseable non-receipt lines - which is exactly the signal that
this guard's reliability is decaying - would have gone unseen. It now prints.

On the real ledger this fires immediately: "skipped 2 unparseable non-receipt
ledger line(s)", the same 2 foreign lines that would have bricked candidate
7fe6f885 into holding every row every day.

Test 22/22.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Jc7e5vG4Jx68iXSYhwUiA

Files touched

Diff

commit 67d7eb3755dc8bbd1a6243e9419e9b7f54eb4ad6
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Sep 11 12:45:30 2026 -0700

    TK-11483: skipped foreign ledger lines are reported, never silent
    
    Second-model review flagged that relevance-scoped ledger parsing could mask
    degradation of the shared ledger. The counter existed but was never surfaced, so a
    rising number of unparseable non-receipt lines - which is exactly the signal that
    this guard's reliability is decaying - would have gone unseen. It now prints.
    
    On the real ledger this fires immediately: "skipped 2 unparseable non-receipt
    ledger line(s)", the same 2 foreign lines that would have bricked candidate
    7fe6f885 into holding every row every day.
    
    Test 22/22.
    
    Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_018Jc7e5vG4Jx68iXSYhwUiA
---
 scripts/dwpw-grs-migrate.py         |  5 +++++
 scripts/tests/test_receipt_guard.py | 15 +++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/scripts/dwpw-grs-migrate.py b/scripts/dwpw-grs-migrate.py
index 587d573..4002f1d 100644
--- a/scripts/dwpw-grs-migrate.py
+++ b/scripts/dwpw-grs-migrate.py
@@ -328,6 +328,11 @@ def require_no_prior_creation(grs, ledger_path=None):
     except (OSError, UnicodeError, ValueError) as exc:
         raise RuntimeError(
             "HISTORY_HOLD: unavailable or malformed creation history") from exc
+    if foreign_unparseable:
+        # Skipped, but never SILENTLY skipped: a rising count means the shared ledger
+        # is degrading, and this guard's reliability degrades with it.
+        print(f"  # note: skipped {foreign_unparseable} unparseable non-receipt "
+              f"ledger line(s) while checking {grs}")
     if prior:
         raise RuntimeError(
             f"HISTORY_HOLD: {grs} already has {len(prior)} recorded product(s) "
diff --git a/scripts/tests/test_receipt_guard.py b/scripts/tests/test_receipt_guard.py
index ef6a8df..758d62d 100644
--- a/scripts/tests/test_receipt_guard.py
+++ b/scripts/tests/test_receipt_guard.py
@@ -198,6 +198,20 @@ def t_corrupt_relevant_line_holds():
         finally:
             os.unlink(led)
 
+def t_foreign_lines_are_reported_not_silent():
+    """A skipped foreign line must be COUNTED and SURFACED. Silently swallowing ledger
+    corruption is how this guard would quietly stop being reliable."""
+    import io, contextlib
+    led = ledger_file(["[4AM-loop] junk", "more junk", receipt(grs="GRS-99999")])
+    buf = io.StringIO()
+    try:
+        with contextlib.redirect_stdout(buf):
+            M.require_no_prior_creation(GRS, led)
+    finally:
+        os.unlink(led)
+    out = buf.getvalue()
+    assert "skipped 2 unparseable" in out, f"foreign lines not reported: {out!r}"
+
 def t_corrupt_foreign_line_does_not_brick():
     """REGRESSION GUARD on the candidate's real defect: the SHARED ledger contains
     plain-text lines from other agents. Holding on those would make the migration a
@@ -363,6 +377,7 @@ if __name__ == "__main__":
                  ("malformed receipt -> HOLD", t_malformed_receipt_holds),
                  ("corrupt line that may be ours -> HOLD", t_corrupt_relevant_line_holds),
                  ("foreign corrupt line -> does NOT brick", t_corrupt_foreign_line_does_not_brick),
+                 ("foreign lines reported, not silent", t_foreign_lines_are_reported_not_silent),
                  ("foreign junk + real prior -> still HOLD", t_corrupt_foreign_line_still_holds_on_real_prior),
                  ("missing ledger -> HOLD", t_missing_ledger_holds),
                  ("invalid GRS -> HOLD", t_invalid_grs_holds)]:

← 81ba2dd TK-11483: receipt guard stops the daily Fentucci duplicate m  ·  back to Designerwallcoverings  ·  auto-data-snapshot: 2026-09-11T12:47:38 (3 data files) — scr 96eef6f →