test_stamping_the_refresh_section_preserves_scope_and_version¶
Tests › tests/test_freshness.py
What this test is for
Why it exists
The pipeline stamps `refresh.*` in a SECOND `write_build_signature` call, after the atomic swap and the HTML stage, so the duration covers the whole build. That is only safe because the write UPSERTS — if it replaced the table, this stamp would silently delete the scope provenance that the entropic grid measured as the only clearly actionable gap in 56 marks.
Given
db = tmp_path / "clew.db"
When
write_build_signature(db, scope={"source": "doxygen-guard", "reason": "declared"})write_build_signature(db, refresh={"duration_ms": "42"})target = st.Target(repo_path=str(tmp_path), slug="t", db_path=str(db))
2 more
status = st.db_status(target)read_build_signature(db)
Then
- ✓ status["scope"] equals {"source": "doxygen-guard", "reason": "declared"}
- ✓ status["refresh"] equals {"duration_ms": "42"}
- ✓ read_build_signature(db) equals CLEW_BUILD_VERSION
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) · 30 of 142 steps
… 63 earlier steps
… 42 later steps
2 more
- Build, refresh and check the index · 30 of 153 steps
- `main` (scripts/stage_probe.py) · 30 of 37 steps
tests/test_freshness.py:527 · its file's page
What it checks (3)
assert status["scope"] == {"source": "doxygen-guard", "reason": "declared"}observesdb_statusviastatusassert status["refresh"] == {"duration_ms": "42"}observesdb_statusviastatusassert read_build_signature(db) == CLEW_BUILD_VERSIONobservesread_build_signature
Where the product reaches it
Call flow
test_stamping_the_refresh_section_preserves_scope_and_version→write_build_signature→db_status→read_build_signatureWhat 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 6 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-006 measured
- REQ-DDB-CONFIG-007 measured
- REQ-DDB-INDEX-003 measured
- REQ-DDB-MCP-001 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-PIPE-005 measured