test_n_dossiers_share_the_budget_instead_of_each_claiming_it

Tests › tests/test_dossier_batch.py

passed Passed in the packaged run.

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

  1. rows = RESPONSE_BUDGET_BYTES // 64
  2. entries = [ {"name": f"fat_{i}", "callers": [{"name": f"c{j}" * 12, "line": j} for j in range(rows)]} for i in range(5) ]
→

When

  1. limited = _budget_batch(entries, overhead=200)
  2. all(f"{rows} ->" in v for v in limited["adjusted"].values())
→

Then

  1. ✓ sum(_size(e) for e in entries) is greater than RESPONSE_BUDGET_BYTES * 4
  2. ✓ sum(_size(e) for e in entries) + 200 is at most RESPONSE_BUDGET_BYTES
  3. ✓ limited is not None
  4. ✓ set(limited["adjusted"]) equals {f"fat_{i}.callers" for i in range(5)}
  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

callercallercallercallerclew/mcp_server/tools_query.pyclew/mcp_server/tools_query.pyclew/mcp_server/tools_query.pyclew/mcp_server/tools_query.pyother filesother filesother filesother filesopt (line 1181)optloop (line 973)looploop (line 1539)looploop (line 198)loopdossier96. repo → _route96_route97. _batched_dossiers → _budget_batch97_budget_batch98. _budget_batch → _fair_shares98_fair_shares▶ test enters99–100. _budget_batch → _shrink_to_budget99_shrink_to_budget +1 more101. _batched_dossiers → prune_absent_keys101prune_absent_keys102. prune_absent_keys → _absent102_absent

… 124 later steps

tests/test_dossier_batch.py:194 · its file's page

What it checks (5)

  1. assert sum(_size(e) for e in entries) > RESPONSE_BUDGET_BYTES * 4 observes _size
  2. assert sum(_size(e) for e in entries) + 200 <= RESPONSE_BUDGET_BYTES observes _size
  3. assert limited is not None observes _budget_batch via limited
  4. assert set(limited["adjusted"]) == {f"fat_{i}.callers" for i in range(5)} observes _budget_batch via limited
  5. assert all(f"{rows} ->" in v for v in limited["adjusted"].values()) observes all

Where the product reaches it

  • dossier → _batched_dossiers → _budget_batch (flow)
  • dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all (flow)

Call flow

test_n_dossiers_share_the_budget_instead_of_each_claiming_it→_size→_budget_batch→all

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.

test_n_dossiers_share_the_budget_instead_of_each_claiming_it · 5 checksallREQ-DDB-WIKI-054 · inferred
Also reaches 1 requirement

Its run touches their code; that is reach, not proof.