test_bytecode_does_not_move_the_fingerprint

Tests › tests/test_freshness.py

passed Passed in the packaged run.

What this test is for

Why it exists

`.pyc` is regenerated as a side effect of importing the very code being identified, and the house control procedure purges `__pycache__` between runs — so hashing bytecode would move the fingerprint because it was READ, and again because a control run cleaned up.

Given

  1. pkg = tmp_path / "pkg"
  2. (pkg / "__pycache__").mkdir(parents=True)
  3. (pkg / "a.py").write_text("x = 1\n", encoding="utf-8")
→

When

  1. before = fr.source_fingerprint(pkg)
  2. (pkg / "__pycache__" / "a.cpython-312.pyc").write_bytes(b"\x00\x01")
  3. fr.source_fingerprint(pkg)
→

Then

  1. ✓ fr.source_fingerprint(pkg) equals 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:433 · its file's page

What it checks (1)

  1. assert fr.source_fingerprint(pkg) == before observes source_fingerprint

Where the product reaches it

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

Call flow

test_bytecode_does_not_move_the_fingerprint→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_bytecode_does_not_move_the_fingerprint · 1 checkssource_fingerprintREQ-DDB-MCP-004 · measured
Also reaches 1 requirement

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