test_the_query_tools_take_the_session_without_changing_their_schema¶
Tests › tests/test_wiki_channel.py
What this test is for
Why it exists
THE SCHEMA IS THE ONE SURFACE A CLIENT CANNOT TRUNCATE, so the session is taken through the SDK's own context injection — a `ctx` the SDK fills and leaves out of the JSON Schema.
Given
def dossier(subject: str, target: str | None = None) -> dict: return {"subject": subject}async def before(target, sub_index): # noqa: ANN001, ANN202 return None
When
wrapped = _answering_with_refresh(dossier, before)seen = SimpleNamespace(session=object())channel.CHANNEL.session = None
Then
- ✓ find_context_parameter(wrapped) equals "ctx"
- ✓ anyio.run(lambda: wrapped(subject="x", ctx=seen)) equals {"subject": "x"}
- ✓ channel.CHANNEL.session is seen.session
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
Build, refresh and check the index · 2 of 153 steps
… 28 earlier steps
… 119 later steps
tests/test_wiki_channel.py:24 · its file's page
What it checks (3)
assert find_context_parameter(wrapped) == "ctx"observes_answering_with_refreshviawrappedassert anyio.run(lambda: wrapped(subject="x", ctx=seen)) == {"subject": "x"}observes_answering_with_refreshviawrappedassert channel.CHANNEL.session is seen.sessionnot attributed
Where the product reaches it
index→_index_action→build_or_refresh→_activate_tier1→register_query_tools→_answering_with_refresh(flow)
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-MCP-004 measured
- REQ-DDB-WIKI-054 measured