fix(shapes): the capped meaning pass reads new shapes first, and its miss withdraws an early flag (#4208)
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / integration (push) Failing after 51s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / Python tests (push) Successful in 1m33s
CI & Build / Build & push image (push) Successful in 21s

Measured on the first live refresh after 91cde6c deployed: the version bump
queued 1,533 rows for the semantic arm, the cap read 150 of them in row
order, and all six shapes new since the previous refresh - the only rows
flag_divergence acts on, and the highest ids - were flagged before the arm
reached them. The gate silenced nothing because it never got to look, and
since a flag persists until judged, a later conclusive miss could not take
it back.

- propose_for_repo sorts the semantic todo by _semantic_priority:
  unclassified before scoped, newest first.
- flag_divergence withdraws a standing flag when the row now carries a
  conclusive miss; that evidence alone withdraws one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01821k5B3Ysecp9fNYs92Kuy
This commit is contained in:
2026-09-22 08:05:49 -04:00
co-authored by Claude Opus 5
parent cef91f4cd4
commit 19438cc894
3 changed files with 169 additions and 4 deletions
+30
View File
@@ -180,3 +180,33 @@ def test_the_miss_basis_is_not_one_of_the_proposal_bases(value: str) -> None:
filters BY basis, and a collision there would mean confirming a miss as
though it were a match."""
assert BASIS_NO_SEMANTIC_MATCH != value
# ── the cap spends itself on the rows its verdict can act on ─────────────
class _AgedRow:
def __init__(self, name: str, status: str, created) -> None:
self.name, self.status, self.created_at = name, status, created
def test_the_capped_pass_reads_new_shapes_first() -> None:
"""Measured on the first live refresh after the gate shipped: a version
bump queued 1,533 rows, the cap read 150 of them in row order, and every
shape NEW since the previous refresh — the only rows `flag_divergence`
acts on, and the highest ids — was flagged before the arm reached it. The
gate silenced nothing because it never got to look."""
from datetime import datetime, timedelta, timezone
from scribe.services.shape_ledger import _semantic_priority
t = datetime(2026, 9, 22, tzinfo=timezone.utc)
rows = [
_AgedRow("scoped_new", "scoped", t),
_AgedRow("old", "unclassified", t - timedelta(days=30)),
_AgedRow("undated", "unclassified", None),
_AgedRow("new", "unclassified", t),
_AgedRow("scoped_old", "scoped", t - timedelta(days=30)),
]
order = [r.name for r in sorted(rows, key=_semantic_priority)]
assert order == ["new", "old", "undated", "scoped_new", "scoped_old"]