test_the_markdown_output_carries_the_product_trace

Tests › tests/test_wiki_composite.py

passed Passed in the packaged run.

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

  1. 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"))
  2. tree, _pins = _tree(tmp_path, probe=unknown)
→

When

  1. md = product_markdown(tree, Audience())
  2. product_markdown(tree, Audience(exclude_requirement_text=True))
→

Then

  1. ✓ md.startswith("# Product trace") holds
  2. ✓ md.index("`product:REQ-PRD-001`") < md.index("`lib:REQ-LIB-001`") < md.index("`hal:REQ-HAL-001`") holds
  3. ✓ md contains "\n - `lib:REQ-LIB-001` Bounded retry **unknown**"
  4. ✓ md contains "not indexed at pin"
  5. ✓ md contains str((tmp_path / "lib").resolve())
  6. ✓ md contains "REQ-PRD-999"
  7. ✓ md contains "## Nothing on the tree reaches"
  8. ✓ md contains "`lib:REQ-LIB-002`"
  9. ✓ md.replace("<br>", "") does not contain "<"
  10. ✓ 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

program launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyother filesother filesother filesother filesloop (line 267)looptry (line 269)tryopt (line 1336)optalt (line 1344)alttry (line 1352)tryloop (line 973)looploop (line 974)looploop (line 287)looploop (line 288)loopmain63. load_external_requirements → get_requirements63get_requirements64. load_external_requirements → read_catalog_at64read_catalog_at65. read_catalog_at → _refuse_url65_refuse_url▶ test enters66–69. read_catalog_at → git_text66git_text +3 more70. read_catalog_at → _refuse_url70_refuse_url71. read_catalog_at → _catalog_rows71_catalog_rows72. _validate_files → get_requirements72get_requirements73. _validate_files → check_satisfies73check_satisfies74. check_satisfies → link_ids74link_ids75. link_ids → satisfies_ids75satisfies_ids▶ test enters76. _validate_files → load_failure_mode_ids76load_failure_mode_ids77. load_failure_mode_ids → _get_requirements_config77_get_requirements_config

… 280 later steps

4 more

tests/test_wiki_composite.py:352 · its file's page

What it checks (7)

  1. assert md.startswith("# Product trace") observes product_markdown via md
  2. assert ( md.index("`product:REQ-PRD-001`") < md.index("`lib:REQ-LIB-001`") < md.index("`hal:REQ-HAL-001`") ) observes product_markdown via md
  3. assert "\n - `lib:REQ-LIB-001` Bounded retry **unknown**" in md observes product_markdown via md
  4. assert "not indexed at pin" in md and str((tmp_path / "lib").resolve()) in md observes product_markdown via md
  5. assert ( "REQ-PRD-999" in md and "## Nothing on the tree reaches" in md and "`lib:REQ-LIB-002`" in md ) observes product_markdown via md
  6. assert "<" not in md.replace("<br>", ""), ( "plain Markdown: no HTML a Markdown-only host would drop" ) observes product_markdown via md
  7. assert "Bounded retry" not in product_markdown(tree, Audience(exclude_requirement_text=True)) observes product_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

test_the_markdown_output_carries_the_product_trace→_tree→product_markdown

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_the_markdown_output_carries_the_product_trace · 7 checks_tree… 3 calls …load_guard_configREQ-DDB-CONFIG-001 · measured_tree… 3 calls …_is_flat_req_listREQ-DDB-CONFIG-003 · measured_tree… 5 calls …read_requirements_sectionREQ-DDB-GUARD-012 · inferred_tree… 6 calls …apply_opt_in_languagesREQ-DDB-GUARD-024 · inferred_tree… 3 calls …git_textREQ-DDB-GUARD-027 · measured_tree… 3 calls …resolve_catalog_pathREQ-DDB-SCHEMA-006 · measured_treecompose_nodeslink_idsREQ-DDB-SCHEMA-015 · measured_treecompose_root_sourcedeclared_catalogREQ-DDB-WIKI-015 · measuredproduct_markdownREQ-DDB-WIKI-040 · measured_tree… 4 calls …allREQ-DDB-WIKI-054 · inferred
Also reaches 10 requirements

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