test_an_edited_yaml_document_is_parsed_again¶
Tests › tests/test_datamodel.py
What this test is for
Why it exists
THE CONTROL. Content is the key, so an edit must re-derive — a cache that served a stale key list would put keys in the catalog that the repository no longer declares, and the declared-vs-observed diagnostic reads that as a fact about the code.
Given
repo = tmp_path / "repo"(repo / "conf").mkdir(parents=True)
13 more
listed = repo / "conf" / "keys.yaml"listed.write_text("- ALPHA_KEY\n", encoding="utf-8")cache_path = tmp_path / "clew.db.idxcache"cache = IndexCache(cache_path, repo)discover(repo, (), cache=cache)cache.commit()loads = {"n": 0}original = yaml.safe_loaddef counting(*args, **kwargs): # noqa: ANN002, ANN003, ANN202 loads["n"] += 1 return original(*args, **kwargs)monkeypatch.setattr(yaml, "safe_load", counting)listed.write_text("- ALPHA_KEY\n- GAMMA_KEY\n", encoding="utf-8")cache = IndexCache(cache_path, repo)discover(repo, (), cache=cache)
When
- —
Then
- ✓ loads["n"] is greater than 0
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) · 4 of 142 steps
… 8 earlier steps
… 126 later steps
2 more
- Build, refresh and check the index · 4 of 153 steps
- clew — `main` (clew/cli.py) · 4 of 400 steps
tests/test_datamodel.py:1005 · its file's page
What it checks (1)
assert loads["n"] > 0, "an edited document must be read again, not served from the cache"not attributed
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.
Also reaches 4 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-INDEX-002 measured
- REQ-DDB-INDEX-005 measured
- REQ-DDB-SCHEMA-013 measured