test_the_pre_rename_cost_key_is_still_read

Tests › tests/test_freshness.py

passed Passed in the packaged run.

What this test is for

Why it exists

#470 renamed the persisted key `files_reprocessed` to `payloads_recomputed` because the old name named the wrong UNIT. An index built by an earlier version carries only the old key, and dropping to "unmeasured" there would discard a real measurement over a spelling.

Verifies REQ-DDB-MCP-004

Given

  1. —
→

When

  1. clause = fr._cost_clause({"duration_ms": "1612", "files_reprocessed": "45"})
→

Then

  1. ✓ clause contains "1612 ms"
  2. ✓ clause contains "45 cached stage payload(s)"
  3. ✓ clause does not contain "file(s)"

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.

thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 2 of 142 steps

… 90 earlier steps

thread startthread startthread startthread startclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.py_first_build_worker91–92. notices → _data_notice91_data_notice +1 more93. _cost_clause → _humanise_ms93_humanise_ms▶ test enters94. _cost_clause → _dominant_clause94_dominant_clause95–96. notices → _schema_notice95_schema_notice +1 more

… 46 later steps

2 more

tests/test_freshness.py:264 · its file's page

What it checks (3)

  1. assert "1612 ms" in clause observes _cost_clause via clause
  2. assert "45 cached stage payload(s)" in clause, ( f"the legacy key must still be read, and reported under the CORRECTED label — the old " f"name was wrong about the unit, not about the number: {clause}" ) observes _cost_clause via clause
  3. assert "file(s)" not in clause, "the corrected label applies to legacy values too" observes _cost_clause via clause

Where the product reaches it

  • index → _index_action → build_or_refresh → db_status → notices → _data_notice → _cost_clause (flow)

Call flow

test_the_pre_rename_cost_key_is_still_read→_cost_clause

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.

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-MCP-004catalogunknown