test_n_dossiers_share_the_budget_instead_of_each_claiming_it¶
Tests › tests/test_dossier_batch.py
What this test is for
Why it exists
THE FAILURE THIS PREVENTS IS ARITHMETIC. Trimming each entry to the whole-response ceiling would produce a reply that respects `RESPONSE_BUDGET_BYTES` N times over and exceeds it once — and nothing downstream would notice, because every individual payload passed its own check.
Given
rows = RESPONSE_BUDGET_BYTES // 64entries = [ {"name": f"fat_{i}", "callers": [{"name": f"c{j}" * 12, "line": j} for j in range(rows)]} for i in range(5) ]
When
limited = _budget_batch(entries, overhead=200)all(f"{rows} ->" in v for v in limited["adjusted"].values())
Then
- ✓ sum(_size(e) for e in entries) is greater than RESPONSE_BUDGET_BYTES * 4
- ✓ sum(_size(e) for e in entries) + 200 is at most RESPONSE_BUDGET_BYTES
- ✓ limited is not None
- ✓ set(limited["adjusted"]) equals {f"fat_{i}.callers" for i in range(5)}
- ✓ all(f"{rows} ->" in v for v in limited["adjusted"].values()) holds
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.
Look up one name: everything the index holds about it · 3 of 226 steps
… 95 earlier steps
… 124 later steps
tests/test_dossier_batch.py:194 · its file's page
What it checks (5)
assert sum(_size(e) for e in entries) > RESPONSE_BUDGET_BYTES * 4observes_sizeassert sum(_size(e) for e in entries) + 200 <= RESPONSE_BUDGET_BYTESobserves_sizeassert limited is not Noneobserves_budget_batchvialimitedassert set(limited["adjusted"]) == {f"fat_{i}.callers" for i in range(5)}observes_budget_batchvialimitedassert all(f"{rows} ->" in v for v in limited["adjusted"].values())observesall
Where the product reaches it
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 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-WIKI-054 inferred