test_the_markdown_output_carries_the_product_trace¶
Tests › tests/test_wiki_composite.py
What this test is for
Why it exists
#73 item 1 (owner Q/A 2026-11-23, 2.1): hosts that take only Markdown (an Azure DevOps code wiki) could not show the cross-repository tree — it existed only in the HTML site. The Markdown page has the same tree, the same states (indexed / unknown + why / absent) and the same lists.
Given
def unknown(dep: Path, pin: str, sha: str | None): return ("unknown", f"not indexed at pin {pin[:12]}; checkout is at 0000", Path("/x.db"))tree, _pins = _tree(tmp_path, probe=unknown)
When
md = product_markdown(tree, Audience())product_markdown(tree, Audience(exclude_requirement_text=True))
Then
- ✓ md.startswith("# Product trace") holds
- ✓ md.index("`product:REQ-PRD-001`") < md.index("`lib:REQ-LIB-001`") < md.index("`hal:REQ-HAL-001`") holds
- ✓ md contains "\n - `lib:REQ-LIB-001` Bounded retry **unknown**"
- ✓ md contains "not indexed at pin"
- ✓ md contains str((tmp_path / "lib").resolve())
- ✓ md contains "REQ-PRD-999"
- ✓ md contains "## Nothing on the tree reaches"
- ✓ md contains "`lib:REQ-LIB-002`"
- ✓ md.replace("<br>", "") does not contain "<"
- ✓ product_markdown(tree, Audience(exclude_requirement_text=True)) does not contain "Bounded retry"
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.
`main` (clew/guard/main.py) · 7 of 357 steps
… 62 earlier steps
… 280 later steps
4 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 2 of 142 steps
- Build this wiki from the index · 2 of 400 steps
- Build, refresh and check the index · 2 of 153 steps
- clew — `main` (clew/cli.py) · 2 of 400 steps
tests/test_wiki_composite.py:352 · its file's page
What it checks (7)
assert md.startswith("# Product trace")observesproduct_markdownviamdassert ( md.index("`product:REQ-PRD-001`") < md.index("`lib:REQ-LIB-001`") < md.index("`hal:REQ-HAL-001`") )observesproduct_markdownviamdassert "\n - `lib:REQ-LIB-001` Bounded retry **unknown**" in mdobservesproduct_markdownviamdassert "not indexed at pin" in md and str((tmp_path / "lib").resolve()) in mdobservesproduct_markdownviamdassert ( "REQ-PRD-999" in md and "## Nothing on the tree reaches" in md and "`lib:REQ-LIB-002`" in md )observesproduct_markdownviamdassert "<" not in md.replace("<br>", ""), ( "plain Markdown: no HTML a Markdown-only host would drop" )observesproduct_markdownviamdassert "Bounded retry" not in product_markdown(tree, Audience(exclude_requirement_text=True))observesproduct_markdown
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
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 10 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-CONFIG-003 measured
- REQ-DDB-GUARD-012 inferred
- REQ-DDB-GUARD-024 inferred
- REQ-DDB-GUARD-027 measured
- REQ-DDB-SCHEMA-006 measured
- REQ-DDB-SCHEMA-015 measured
- REQ-DDB-WIKI-015 measured
- REQ-DDB-WIKI-040 measured
- REQ-DDB-WIKI-054 inferred