test_status_reports_the_real_package_version_not_the_unknown_fallback

Tests › tests/test_freshness.py

passed Passed in the packaged run.

What this test is for

Why it exists

THIS SHIPPED THROUGH 1.0.0. `package_version()` asked `importlib.metadata` for `version("clew")` — the IMPORT name — while the distribution ships as `clew-trace`, so every `index(action='status')` reply reported `package_version: "unknown"`. That is the first field a consumer pastes into a bug report, and it named no version at all.

Given

  1. pyproject = Path(__file__).resolve().parent.parent / "pyproject.toml"
→

When

  1. declared = require_toml_module().loads(pyproject.read_text(encoding="utf-8"))
  2. want = declared["project"]["version"]
  3. reported = package_version()
2 more
  1. code_identity()
  2. if _installed_editable(): return
→

Then

  1. ✓ reported differs from "unknown"
  2. ✓ code_identity().get("package_version") equals reported
  3. ✓ reported equals want

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

… 83 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_worker84. _data_model_meta → _meta_section84_meta_section85. db_status → code_identity85code_identity86. code_identity → source_fingerprint86source_fingerprint▶ test enters87. source_fingerprint → package_source_root87package_source_root88. code_identity → package_version88package_version89. db_status → notices89notices90. notices → code_identity90code_identity

… 52 later steps

4 more

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

What it checks (3)

  1. assert reported != "unknown", ( "package_version() fell back to 'unknown'. Either the package is not installed in " f"this environment, or {pyproject.name} renamed the distribution and " "freshness._DISTRIBUTION was not updated with it — the exact defect that shipped." ) observes package_version via reported
  2. assert code_identity().get("package_version") == reported, ( "code_identity() is what reaches a status reply; it must carry the same version" ) observes code_identity
  3. assert reported == want, ( f"status would report package_version={reported!r} while pyproject declares {want!r}. " "This is a NON-EDITABLE install, so the code under test is the installed copy too — " "the whole run is exercising a version behind this working tree." ) observes package_version via reported

Where the product reaches it

  • index → _index_action → build_or_refresh → code_identity (flow)
  • index → _index_action → build_or_refresh → code_identity → package_version (flow)
  • build_wiki → _build_site → _all_flows → entry_point_flows → _scripts → console_scripts → _read_toml → require_toml_module (flow)

Call flow

test_status_reports_the_real_package_version_not_the_unknown_fallback→package_version→require_toml_module→code_identity→_installed_editable

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

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