fix(tests): the compact band pins three holding states, not two (#4100)
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 10s
CI & Build / integration (push) Successful in 41s
CI & Build / TypeScript typecheck (push) Successful in 52s
CI & Build / Python tests (push) Successful in 1m32s
CI & Build / Build & push image (push) Successful in 25s

CI run 6945: 11 failures down to 1. The survivor is
test_shortening_a_line_does_not_decide_what_it_says_about_holding, which
asserted "no longer hold it" appears in the compact line for seen=True — the
phrase that now belongs to the OPENED state, not the named one.

Its subject is a property, not a string: `compact` and the ledger are
independent axes, and shortening a line must not change what it claims about
holding. So the fix follows the axis rather than swapping the phrase. The axis
grew from two states to three, and the test now checks all three are distinct
under compact — pinning only two would let the compact branch collapse the new
middle state into either neighbour, which is the same regression it was
written for with one more place to hide.

Added the assertion that matters most when room is short: a line the session
never opened must not imply it did.

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:35:08 -04:00
co-authored by Claude Opus 5
parent ebd6cb203c
commit 957a72c501
+19 -6
View File
@@ -149,16 +149,29 @@ def test_shortening_a_line_does_not_decide_what_it_says_about_holding():
precisely because the session may no longer HOLD what it was told — and precisely because the session may no longer HOLD what it was told — and
the tail is the entire difference a reader can act on. the tail is the entire difference a reader can act on.
`compact` and `seen` are independent axes. How much room a line gets is a `compact` and the ledger are independent axes. How much room a line gets is
fact about its rank; whether the session holds it is a fact about the a fact about its rank; what the session holds is a fact about the ledger;
ledger; and neither may be allowed to answer the other's question. and neither may be allowed to answer the other's question.
THREE STATES SINCE #4100, so this checks three. The axis grew and the test
grew with it — pinning only two would leave the compact branch free to
collapse the new middle state into either neighbour, which is the same
regression this was written for with one more place to hide.
""" """
rule = fake_rule(id=4, title="dev is home", when_to_apply=_TRIGGER) rule = fake_rule(id=4, title="dev is home", when_to_apply=_TRIGGER)
seen = _rule_hint_line(rule, where="here", seen=True, compact=True)
fresh = _rule_hint_line(rule, where="here", seen=False, compact=True) fresh = _rule_hint_line(rule, where="here", seen=False, compact=True)
assert seen != fresh named = _rule_hint_line(rule, where="here", seen=True, compact=True)
assert "no longer hold it" in seen held = _rule_hint_line(rule, where="here", seen=True, held=True, compact=True)
assert len({fresh, named, held}) == 3, (
"the compact branch collapsed two holding states into one line"
)
assert "not in this session's loaded set" in fresh assert "not in this session's loaded set" in fresh
assert "not opened" in named
assert "no longer hold it" in held
# The claim that most needs to survive shortening: a line the session never
# opened must not imply it did, however little room the line was given.
assert "no longer hold it" not in named
def test_a_compact_line_is_materially_shorter_than_a_full_one(): def test_a_compact_line_is_materially_shorter_than_a_full_one():