test_a_non_positive_cull_age_leaves_every_current_index_alone

Tests › tests/test_registry_hygiene.py

passed Passed in the packaged run.

What this test is for

Why it exists

M4, 1.1.0 SECURITY AUDIT. `age > max_age_days` with `max_age_days=0` is true for every database that exists, so one call — from an agent reading "age threshold in days" and passing 0 to mean "no age limit", which is what 0 means in most such knobs — deleted every index on the machine, including repositories this session had never heard of. The blast radius is the whole state root because ONE server answers about every target.

Given

  1. home = tmp_path / "state"
  2. kept = []
→

When

  1. for name in ("alpha", "beta"): repo = tmp_path / name repo.mkdir() target = target_for(repo, home) Path(target.db_path).parent.mkdir(parents=True, exist_ok=True) Path(target.db_path).write_text("", encoding="utf-8") write_build_signature(Path(target.db_path)) TargetRegistry(home).register(repo) ## AGED BY AN HOUR, because `db_status` rounds `age_days` and a database written this ## instant rounds to 0.0 — which is not `> 0` and would make this test pass against the ## defect. An hour-old index is the ordinary case the sweep must not touch. os.utime(target.db_path, (time.time() - 3600, time.time() - 3600)) kept.append(Path(target.db_path))
  2. culled = cull(TargetRegistry(home), max_age_days=0, include_stale=False)
  3. for db in kept: assert db.exists(), f"{db} was deleted by a zero age threshold"
→

Then

  1. ✓ culled equals []

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

… 32 earlier steps

thread startthread startthread startthread startclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pytry (line 1664)tryopt (line 1666)optopt (line 352)opt_first_build_worker33. _first_build_worker → target_for33target_for34. target_for → _safe_index_name34_safe_index_name35. target_for → state_home35state_home▶ test enters36. _first_build_worker → _run_build36_run_build37. _run_build → nested_tree_cache37nested_tree_cache

… 26 steps between

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

5 more

tests/test_registry_hygiene.py:273 · its file's page

What it checks (2)

  1. assert culled == [], f"a zero age threshold culled current indexes: {culled}" not attributed
  2. assert db.exists(), f"{db} was deleted by a zero age threshold" not attributed

Where the product reaches it

  • main → query_main → _locate → target_for (flow)

Call flow

test_a_non_positive_cull_age_leaves_every_current_index_alone→target_for→write_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_a_non_positive_cull_age_leaves_every_current_index_alone · 2 checkswrite_build_signatureREQ-DDB-CONFIG-006 · measuredwrite_build_signatureREQ-DDB-CONFIG-007 · measuredtarget_forREQ-DDB-MCP-001 · measuredwrite_build_signatureREQ-DDB-PIPE-005 · measured
Also reaches 6 requirements

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