From 9b3874b65753c9a1d3c6da27752b50d8839bff6b Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sat, 8 Aug 2026 22:32:58 -0400 Subject: [PATCH] test: the auto-inject path now logs two retrievals, and that is the point MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 45ba4aa made the reuse slot log its query (source: reuse_slot). The margin-gate test pinned record_retrieval to exactly one call, which was asserting the very asymmetry #2463 fixed — the displaced hit logged, the displacing query not. Assert both sources in order instead. Refs #2463 --- tests/test_services_plugin_context.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_services_plugin_context.py b/tests/test_services_plugin_context.py index e45c98e..7c96f96 100644 --- a/tests/test_services_plugin_context.py +++ b/tests/test_services_plugin_context.py @@ -104,9 +104,12 @@ async def test_build_autoinject_hint_titles_only_with_margin_gate(): assert "#33" not in out["context"] # Title-first: no body text, ever. assert "get_note(id)" in out["context"] - # Telemetry fired with the auto_inject source and the full candidate set. - rec.assert_called_once() - assert rec.call_args.kwargs["source"] == "auto_inject" + # Telemetry fired for BOTH retrievals this path runs: the scored menu and + # the reuse-slot query competing against it. The slot's query used to be + # the one unlogged retrieval on this path — the hit it displaced was in + # retrieval_logs, the query that displaced it was not (#2463). + sources = [c.kwargs["source"] for c in rec.call_args_list] + assert sources == ["auto_inject", "reuse_slot"] @pytest.mark.asyncio