fix(tests): the repeat tail is the middle state now, not the opened one (#4100)
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 9s
CI & Build / integration (push) Successful in 49s
CI & Build / TypeScript typecheck (push) Successful in 1m0s
CI & Build / Python tests (push) Failing after 1m10s
CI & Build / Build & push image (push) Skipped

CI run 6943: 11 failures, two causes, both existing guards correctly catching
the behaviour change rather than defects in it.

TEN were `_SEEN_TAIL = "You saw it earlier this session"`. Every one of those
tests drives an arm with `exclude_rule_ids` alone — the NAMING ledger — which
since this change is the middle state, not the opened one. That is the whole
point of the step: `seen` stopped meaning "you saw it". The constant now holds
the middle tail, so each test keeps asserting exactly what it was written to
assert (a repeat gets a line distinct from a first surfacing) against the
wording that is now true.

Added `_HELD_TAIL` and a negative assertion with it: neither call names an
opened ledger, so neither may claim the session read anything. That catches
`held` defaulting true, which would have every repeat assert the strongest of
the three claims on no evidence — and none of the ten existing tests would
have noticed.

THE ELEVENTH was my own test edit being wrong, not the code. I asserted
`held_rule_ids` would appear in `re.findall(r"printf '([a-z_]+)=", defs)`, but
`scribe_held_query` spells it `printf '&held_rule_ids=`, and the leading `&`
means that regex never matches it. The regex enumerates SCOPE keys — the
alternatives that open a query — and the ledger key is appended to a query
that already has one. Two different contracts that happened to share a file,
so they are now asserted separately and the difference is written down.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01821k5B3Ysecp9fNYs92Kuy
This commit is contained in:
2026-09-16 17:19:19 -04:00
co-authored by Claude Opus 5
parent ad26b3f458
commit ebd6cb203c
2 changed files with 28 additions and 7 deletions
+6 -3
View File
@@ -942,9 +942,12 @@ def test_route_reads_every_arg_the_hook_sends():
# helper so its ageing and format cannot drift from the naming ledger's.
assert "scribe_held_query" in hook, "hook no longer sends the opened ledger"
defs = (HOOK.parent / "scribe_defs.sh").read_text()
assert set(re.findall(r"printf '([a-z_]+)=", defs)) == {
"repo", "project_id", "held_rule_ids",
}
assert set(re.findall(r"printf '([a-z_]+)=", defs)) == {"repo", "project_id"}
# Its own leading `&` — it is appended to a query that already carries a
# scope key, rather than being one of the alternatives that opens one.
assert "printf '&held_rule_ids=" in defs, (
"the opened ledger's query key is no longer spelled in the helper"
)
def test_route_resolves_repo_to_a_project_not_to_a_location_filter():