test_the_source_fingerprint_ignores_mtime_and_tracks_content

Tests › tests/test_freshness.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE CODE AXIS IS A HARD REFUSAL, so a false positive on it is expensive.

Given

  1. pkg = tmp_path / "pkg"
  2. pkg.mkdir()
2 more
  1. (pkg / "a.py").write_text("x = 1\n", encoding="utf-8")
  2. (pkg / "b.py").write_text("y = 2\n", encoding="utf-8")
→

When

  1. before = fr.source_fingerprint(pkg)
  2. os.utime(pkg / "a.py", ns=(10**18, 10**18))
  3. fr.source_fingerprint(pkg)
  4. (pkg / "a.py").write_text("x = 2\n", encoding="utf-8")
→

Then

  1. ✓ before holds
  2. ✓ fr.source_fingerprint(pkg) equals before
  3. ✓ fr.source_fingerprint(pkg) differs from before

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) · 1 of 142 steps

… 84 earlier steps

thread startthread startthread startthread startclew/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.py_first_build_worker85. db_status → code_identity85code_identity86. code_identity → source_fingerprint86source_fingerprint87. source_fingerprint → package_source_root87package_source_root▶ test enters88. code_identity → package_version88package_version89. db_status → notices89notices

… 53 later steps

2 more

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

What it checks (3)

  1. assert before, "a package with .py files must fingerprint to something" observes source_fingerprint via before
  2. assert fr.source_fingerprint(pkg) == before, ( "a touch with identical content moved the fingerprint, so the code axis fires on " "every git checkout and branch switch and disables auto-refresh with no edit at all" ) observes source_fingerprint
  3. assert fr.source_fingerprint(pkg) != before, ( "a real content edit did NOT move the fingerprint — the axis can no longer detect " "the stale process it exists to catch, which is worse than firing too often" ) observes source_fingerprint

Where the product reaches it

  • index → _index_action → build_or_refresh → code_identity → source_fingerprint (flow)

Call flow

test_the_source_fingerprint_ignores_mtime_and_tracks_content→source_fingerprint

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_the_source_fingerprint_ignores_mtime_and_tracks_content · 3 checkssource_fingerprintREQ-DDB-MCP-004 · measured
Also reaches 1 requirement

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