From d0bdf39dad2e9f140c770cefaeff7e3b83f14a59 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Mon, 14 Sep 2026 18:34:18 -0700 Subject: [PATCH] test: rewind-exclusion assertion inspects the real `results` key The discovery payload exposes hits under `results`, not `matches`, so the loop over `result_rewind.get("matches", [])` never iterated and the invariant (the rewound row never surfaces, even via the OR-relaxed retry) was not being checked. Assert on the anchor message id and snippet of each returned result instead. --- tests/tools/test_session_search.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/tools/test_session_search.py b/tests/tools/test_session_search.py index 383c27d201..3d68a9dec5 100644 --- a/tests/tools/test_session_search.py +++ b/tests/tools/test_session_search.py @@ -931,18 +931,16 @@ class TestRewindExclusion: )) assert result_compact["count"] >= 1 - # Rewound content should NOT be discoverable. (The OR-relaxed - # zero-result retry may surface OTHER active rows sharing a common - # term like "content" — that's fine; the invariant is that the - # rewound row itself never comes back.) + # Rewound content should NOT be discoverable. The OR-relaxed zero-result + # retry may legitimately surface OTHER active rows sharing the common term + # "content"; the invariant is that the rewound row itself never comes back. result_rewind = json.loads(session_search( query="rewound content gamma", db=db, current_session_id="s_mixed", )) - for m in result_rewind.get("matches", []): - snippet = (m.get("snippet") or "").lower() - assert "rewound" not in snippet - assert "gamma" not in snippet + for entry in result_rewind["results"]: + assert entry["match_message_id"] != mid2 + assert "gamma" not in (entry.get("snippet") or "").lower() class TestLegacyContinuationPlusDelegation: