test: the auto-inject path now logs two retrievals, and that is the point
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 9s
CI & Build / integration (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 22s
CI & Build / Python tests (push) Successful in 48s
CI & Build / Build & push image (push) Successful in 28s

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
This commit is contained in:
2026-08-08 22:32:58 -04:00
parent 45ba4aab25
commit 9b3874b657
+6 -3
View File
@@ -104,9 +104,12 @@ async def test_build_autoinject_hint_titles_only_with_margin_gate():
assert "#33" not in out["context"] assert "#33" not in out["context"]
# Title-first: no body text, ever. # Title-first: no body text, ever.
assert "get_note(id)" in out["context"] assert "get_note(id)" in out["context"]
# Telemetry fired with the auto_inject source and the full candidate set. # Telemetry fired for BOTH retrievals this path runs: the scored menu and
rec.assert_called_once() # the reuse-slot query competing against it. The slot's query used to be
assert rec.call_args.kwargs["source"] == "auto_inject" # 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 @pytest.mark.asyncio