test_stamping_the_refresh_section_preserves_scope_and_version

Tests › tests/test_freshness.py

passed Passed in the packaged run.

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

  1. db = tmp_path / "clew.db"
→

When

  1. write_build_signature(db, scope={"source": "doxygen-guard", "reason": "declared"})
  2. write_build_signature(db, refresh={"duration_ms": "42"})
  3. target = st.Target(repo_path=str(tmp_path), slug="t", db_path=str(db))
2 more
  1. status = st.db_status(target)
  2. read_build_signature(db)
→

Then

  1. ✓ status["scope"] equals {"source": "doxygen-guard", "reason": "declared"}
  2. ✓ status["refresh"] equals {"duration_ms": "42"}
  3. ✓ 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

thread startthread startthread startthread startthread startclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyother filesother filesother filesother filesother filestry (line 3260)try_first_build_worker64. _os_lock → lock_path64lock_path65. _run_build_walked → db_status65db_status66. db_status → _options_meta66_options_meta▶ test enters67. _options_meta → _meta_section67_meta_section68. _meta_section → meta_section68meta_section69. db_status → stated_options69stated_options70. db_status → read_build_signature70read_build_signature71–79. db_status → _source_drift71_source_drift +8 more80. db_status → list80list81–84. db_status → _diagnostics_meta81_diagnostics_meta +3 more85. db_status → code_identity85code_identity86–88. code_identity → source_fingerprint86source_fingerprint +2 more89. db_status → notices89notices90–91. notices → code_identity90code_identity +1 more92–94. _data_notice → _cost_clause92_cost_clause +2 more95–98. notices → _schema_notice95_schema_notice +3 more99. _run_build_walked → declared_scope_rejection99declared_scope_rejection100. declared_scope_rejection → _declared_index_scope100_declared_index_scope

… 42 later steps

2 more

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

What it checks (3)

  1. assert status["scope"] == {"source": "doxygen-guard", "reason": "declared"} observes db_status via status
  2. assert status["refresh"] == {"duration_ms": "42"} observes db_status via status
  3. assert read_build_signature(db) == CLEW_BUILD_VERSION observes read_build_signature

Where the product reaches it

  • index → _index_action → build_or_refresh → db_status (flow)
  • index → _index_action → build_or_refresh → db_status → read_build_signature (flow)

Call flow

test_stamping_the_refresh_section_preserves_scope_and_version→write_build_signature→db_status→read_build_signature

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_stamping_the_refresh_section_preserves_scope_and_version · 3 checksdb_statusREQ-DDB-CONFIG-006 · measureddb_statusREQ-DDB-CONFIG-007 · measureddb_status_coverage_metaREQ-DDB-INDEX-003 · measureddb_statusREQ-DDB-MCP-001 · measureddb_statusREQ-DDB-MCP-004 · measuredwrite_build_signatureREQ-DDB-PIPE-005 · measured
Also reaches 6 requirements

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