From 957a72c501fc35cb85ef257cbc9ccc3e697a33b8 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 16 Sep 2026 17:35:08 -0400 Subject: [PATCH] fix(tests): the compact band pins three holding states, not two (#4100) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Claude-Session: https://claude.ai/code/session_01821k5B3Ysecp9fNYs92Kuy --- tests/test_rule_hint_band.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/test_rule_hint_band.py b/tests/test_rule_hint_band.py index c86ffdd..dc0d0b4 100644 --- a/tests/test_rule_hint_band.py +++ b/tests/test_rule_hint_band.py @@ -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 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 - fact about its rank; whether the session holds it is a fact about the - ledger; and neither may be allowed to answer the other's question. + `compact` and the ledger are independent axes. How much room a line gets is + a fact about its rank; what the session holds is a fact about the ledger; + 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) - seen = _rule_hint_line(rule, where="here", seen=True, compact=True) fresh = _rule_hint_line(rule, where="here", seen=False, compact=True) - assert seen != fresh - assert "no longer hold it" in seen + named = _rule_hint_line(rule, where="here", seen=True, compact=True) + 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 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():