pytest -m p0).
search_knowledge) — routing, grounding, and
citations are reproducible without real inference in the automated run
@pytest.mark.unit / @pytest.mark.integration —
by type; @pytest.mark.p0 / p1 — by priority,
orthogonal to type
tokens_used = the whole turn's round (input + output); assistant only; the raw material of chat spend per person (AI usage)GET /conversations/{id} of your own conversation → 200; the body carries user+assistant messages in order, citations tied to their assistant messages{id} → 404, not 500: the absence of a resource is a normal response, not a failure404, not 403: existence is not revealed (anti-IDOR), consistent with test_acl_passthrough; a request without a session → 401conversations row server-side and returns its id; no separate POST /conversations for an empty chat is required — the contract is pinned here
Split by type: unit/ — pure logic without a database and without
a live LLM (routing, RRF fusion, citation assembly, access-signal, cache gate,
window budget, model choice, feedback), runs on every PR. integration/ — against a fake model and a
stubbed Knowledge Store, as a separate, less frequent step. Priority
(P0–P1) is orthogonal to the folders and set by markers
(pytest -m p0).
tests/query_engine/module catalog
conftest.pyfake chat model (controllable search decision) · stubbed KS client (records identity) · fake candidate cache (key query+identity) · session and conversation-history factoriesunit/pure logic without a database or a live LLM
test_route · test_rerank_rrf · test_source_attribution · test_access_signal · test_cache_gatesearch decision (multi-tool in one round), RRF fusion, citation assembly, access signal, cache gate keyed on query+identitytest_context_budget · test_model_selection · test_feedbackshared window budget (history+context+answer reserve), sticky model choice (intent≠fact), answer rating (CHECK ±1, in-place, assistant only)integration/fake model + stubbed KS
test_grounding · test_acl_passthroughP0 — load-bearing: grounding from context, passing identity to KStest_streaming · test_multi_turn · test_session_boundaryP1 — SSE streaming without a queue, context carry-over between messages, conversation boundary by conversation_id