test_wiki_imports.py

tests/test_wiki_imports.py

Evidence imports beyond JUnit and Cobertura (1.4.0 W15, W16; owner 2026-11-15).

test_a_context_with_brackets_in_its_parameters_names_its_test

None test_wiki_imports.test_a_context_with_brackets_in_its_parameters_names_its_test(Path tmp_path)

Context nodeids with nested brackets.

tests/test_wiki_imports.py:572

Checks

  • assert parse_contexts(report, tmp_path) == {"a.py": {1: {"tests/t.py::test_x"}}}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-002inferredtest_a_context_with_brackets_in_its_parameters_names_its_test → parse_contexts → _contexts_from_data_file
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010catalog
REQ-DDB-WIKI-016measuredtest_a_context_with_brackets_in_its_parameters_names_its_test → parse_contexts
Source · 19 lines
def test_a_context_with_brackets_in_its_parameters_names_its_test(tmp_path: Path) -> None:
    """FOUND ON CLEW'S OWN WIKI (round 4): `tests/t.py::test_x[a::b[c]-enhanced]|run` read as a
    test called `enhanced]`. The parameters are cut at the first "[" before the name is taken.

    @brief Context nodeids with nested brackets.
    """
    from clew.wiki.imports import parse_contexts

    report = tmp_path / "coverage.json"
    report.write_text(
        json.dumps(
            {"files": {"a.py": {"contexts": {"1": ["tests/t.py::test_x[a::b[c]-enhanced]|run"]}}}}
        )
    )
    (tmp_path / "a.py").write_text("x = 1\n")
    ## W11 (2.0.0): the key keeps the test's file; the name is still `test_x`, not `enhanced]`.
    assert parse_contexts(report, tmp_path) == {"a.py": {1: {"tests/t.py::test_x"}}}

Activity · 5 steps
lines 578–578from clew.wiki.imports import parse_contextslines 580–580report = tmp_path / "coverage.json"lines 581–585report.write_text( json.dumps( {"files": {"a.py": {"contexts": {"1": ["tests/t.py::test_x[a::b[c]-enhanced]|run"]}}}} ) )lines 586–586(tmp_path / "a.py").write_text("x = 1\n")lines 588–588assert parse_contexts(report, tmp_path) == {"a.py": {1: {"tests/t.py::test_x"}}}

test_a_declared_report_that_is_not_there_is_unmeasured_not_a_crash

None test_wiki_imports.test_a_declared_report_that_is_not_there_is_unmeasured_not_a_crash(Path traced, Path tmp_path)

Missing JUnit and Cobertura: evidence still computed, unmeasured.

tests/test_wiki_imports.py:481

Checks

  • assert rows["R-A"].implementers_covered is None
  • assert rows["R-A"].tier in ("NOT_RUN", "MISSING")

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_a_declared_report_that_is_not_there_is_unmeasured_not_a_crash → requirement_evidence → connect
REQ-DDB-QUERY-003measuredtest_a_declared_report_that_is_not_there_is_unmeasured_not_a_crash → requirement_evidence → _implementer_spans → table_exists
REQ-DDB-WIKI-002measuredtest_a_declared_report_that_is_not_there_is_unmeasured_not_a_crash → requirement_evidence
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measured
REQ-DDB-WIKI-016measured
REQ-DDB-WIKI-017measured
REQ-DDB-WIKI-054inferredtest_a_declared_report_that_is_not_there_is_unmeasured_not_a_crash → requirement_evidence → _tier → all
Source · 19 lines
def test_a_declared_report_that_is_not_there_is_unmeasured_not_a_crash(
    traced: Path, tmp_path: Path
) -> None:
    """FOUND DOGFOODING (round 3, P6c): building clew's own wiki without CI's coverage file died
    with a raw FileNotFoundError. A report that is declared and absent was NOT MEASURED: coverage
    fields absent (None), results not run — never a traceback, never a zero.

    @brief Missing JUnit and Cobertura: evidence still computed, unmeasured.
    """
    rows = {
        r.req_id: r
        for r in requirement_evidence(
            traced, junit=[tmp_path / "gone.xml"], coverage=tmp_path / "gone-cov.xml"
        )
    }
    assert rows["R-A"].implementers_covered is None
    assert rows["R-A"].tier in ("NOT_RUN", "MISSING")

Activity · 3 steps
lines 490–495rows = { r.req_id: r for r in requirement_evidence( traced, junit=[tmp_path / "gone.xml"], coverage=tmp_path / "gone-cov.xml" ) }lines 496–496assert rows["R-A"].implementers_covered is Nonelines 497–497assert rows["R-A"].tier in ("NOT_RUN", "MISSING")

test_a_mapping_file_reads_yaml_and_csv

None test_wiki_imports.test_a_mapping_file_reads_yaml_and_csv(Path tmp_path)

{REQ: [tests]} YAML, or a `req,test` CSV.

tests/test_wiki_imports.py:164

Checks

  • assert parse_mapping(yml) == {"R-A": ("Store loads", "Store saves"), "R-B": ("store_loads",)}
  • assert parse_mapping(csv) == {"R-A": ("Store loads",), "R-C": ("flashes",)}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measuredtest_a_mapping_file_reads_yaml_and_csv → parse_mapping
REQ-DDB-WIKI-016catalog
Source · 10 lines
def test_a_mapping_file_reads_yaml_and_csv(tmp_path: Path) -> None:
    """@brief {REQ: [tests]} YAML, or a `req,test` CSV."""
    yml = tmp_path / "map.yaml"
    yml.write_text("R-A: [Store loads, Store saves]\nR-B: store_loads\n")
    csv = tmp_path / "map.csv"
    csv.write_text("req,test\nR-A,Store loads\nR-C,flashes\n")
    assert parse_mapping(yml) == {"R-A": ("Store loads", "Store saves"), "R-B": ("store_loads",)}
    assert parse_mapping(csv) == {"R-A": ("Store loads",), "R-C": ("flashes",)}

Activity · 6 steps
lines 166–166yml = tmp_path / "map.yaml"lines 167–167yml.write_text("R-A: [Store loads, Store saves]\nR-B: store_loads\n")lines 168–168csv = tmp_path / "map.csv"lines 169–169csv.write_text("req,test\nR-A,Store loads\nR-C,flashes\n")lines 170–170assert parse_mapping(yml) == {"R-A": ("Store loads", "Store saves"), "R-B": ("store_loads",)}lines 171–171assert parse_mapping(csv) == {"R-A": ("Store loads",), "R-C": ("flashes",)}

test_an_lcov_tracefile_s_test_sections_are_per_test_contexts

None test_wiki_imports.test_an_lcov_tracefile_s_test_sections_are_per_test_contexts(Path tmp_path)

`contexts` accepts LCOV: TN sections become tests per line.

tests/test_wiki_imports.py:620

Checks

  • assert lines[3] == {"decodes a frame", "rejects a short frame"}
  • assert lines[7] == {"decodes a frame"} and lines[9] == {"rejects a short frame"}
  • assert 4 not in lines and 12 not in lines

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-002inferredtest_an_lcov_tracefile_s_test_sections_are_per_test_contexts → parse_contexts → _contexts_from_data_file
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010catalog
REQ-DDB-WIKI-016measuredtest_an_lcov_tracefile_s_test_sections_are_per_test_contexts → parse_contexts
Source · 25 lines
def test_an_lcov_tracefile_s_test_sections_are_per_test_contexts(tmp_path: Path) -> None:
    """OWNER 2026-11-17 (round 5): per-test coverage for C/C++ is THE REPOSITORY'S OWN REPORT,
    read rather than stitched together by clew. LCOV carries one `TN:` section per test; a line
    with hits > 0 in a section ran in that test, a zero-hit line did not, and an unnamed section
    is unattributed (dropped, as coverage.py's empty context is). Paths are made repo-relative.

    @brief `contexts` accepts LCOV: TN sections become tests per line.
    @return None.
    """
    from clew.wiki.imports import parse_contexts

    src = tmp_path / "src" / "codec.c"
    src.parent.mkdir()
    src.write_text("x\n" * 20)
    info = tmp_path / "build" / "per-test.info"
    info.parent.mkdir()
    info.write_text(
        f"TN:decodes a frame\nSF:{src}\nDA:3,1\nDA:4,0\nDA:7,2\nend_of_record\n"
        "TN:rejects a short frame\nSF:src/codec.c\nDA:3,1,abc\nDA:9,1\nend_of_record\n"
        f"TN:\nSF:{src}\nDA:12,5\nend_of_record\n"
    )
    lines = parse_contexts(info, tmp_path)["src/codec.c"]
    assert lines[3] == {"decodes a frame", "rejects a short frame"}
    assert lines[7] == {"decodes a frame"} and lines[9] == {"rejects a short frame"}
    assert 4 not in lines and 12 not in lines

1 more lines, not shown

Activity · 11 steps
lines 629–629from clew.wiki.imports import parse_contextslines 631–631src = tmp_path / "src" / "codec.c"lines 632–632src.parent.mkdir()lines 633–633src.write_text("x\n" * 20)lines 634–634info = tmp_path / "build" / "per-test.info"lines 635–635info.parent.mkdir()lines 636–640info.write_text( f"TN:decodes a frame\nSF:{src}\nDA:3,1\nDA:4,0\nDA:7,2\nend_of_record\n" "TN:rejects a short frame\nSF:src/codec.c\nDA:3,1,abc\nDA:9,1\nend_of_record\n" f"TN:\nSF:{src}\nDA:12,5\nend_of_record\n" )lines 641–641lines = parse_contexts(info, tmp_path)["src/codec.c"]lines 642–642assert lines[3] == {"decodes a frame", "rejects a short frame"}lines 643–643assert lines[7] == {"decodes a frame"} and lines[9] == {"rejects a short frame"}lines 644–644assert 4 not in lines and 12 not in lines

test_an_unknown_result_format_is_refused

None test_wiki_imports.test_an_unknown_result_format_is_refused(Path tmp_path)

A format is declared, never guessed.

tests/test_wiki_imports.py:156

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measuredtest_an_unknown_result_format_is_refused → parse_results
REQ-DDB-WIKI-016catalog
Source · 8 lines
def test_an_unknown_result_format_is_refused(tmp_path: Path) -> None:
    """@brief A format is declared, never guessed."""
    report = tmp_path / "r.xml"
    report.write_text("<x/>")
    with pytest.raises(ValueError, match="unknown"):
        parse_results("nunit", report)

Activity · 4 steps
lines 158–158report = tmp_path / "r.xml"lines 159–159report.write_text("<x/>")lines 160–160with pytest.raises(ValueError, match="unknown")lines 161–161parse_results("nunit", report)

test_before_tests_a_report_a_run_produces_is_not_yet_required

None test_wiki_imports.test_before_tests_a_report_a_run_produces_is_not_yet_required(Path traced, Path tmp_path)

check_wiki(before_tests=True).

tests/test_wiki_imports.py:290

Show on the map →

Called by none

Calls check_wiki

Checks

  • assert "junit.xml" not in early and "coverage.xml" not in early and "t.tap" not in early
  • assert "build/*.gcov" not in early
  • assert "missing-map.yaml" in early
  • assert "'build/junit.xml' does not exist" in full

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → pin_problems → git_text → git_argv
REQ-DDB-CONFIG-003inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → composite_problems → compose → _root_source → declared_catalog → _is_flat_req_list
REQ-DDB-GUARD-012measuredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-GUARD-024inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → composite_problems → compose → _root_source → declared_catalog → load_guard_config → read_guard_config → load_config → apply_opt_in_languages
REQ-DDB-GUARD-027inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → catalog_requirements → read_catalog_at
REQ-DDB-QUERY-001measuredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → _flow_problems → connect
REQ-DDB-QUERY-003measuredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → _flow_problems → identity_rowids
REQ-DDB-QUERY-010inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → _flow_problems → identity_rowids
REQ-DDB-SCHEMA-006inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → composite_problems → compose → _root_source → declared_catalog → resolve_catalog_path
REQ-DDB-SCHEMA-015inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → composite_problems → compose → _nodes → link_ids
REQ-DDB-WIKI-003measuredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki
REQ-DDB-WIKI-004measuredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → load_nodes
REQ-DDB-WIKI-005measuredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems
REQ-DDB-WIKI-006inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → _mutation_problems → parse_mutations
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010catalogtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → _mapping_problems → parse_mapping
REQ-DDB-WIKI-015inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → composite_problems → compose → _root_source → declared_catalog
REQ-DDB-WIKI-016catalog
REQ-DDB-WIKI-040inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → trace_problems → composite_problems
REQ-DDB-WIKI-054inferredtest_before_tests_a_report_a_run_produces_is_not_yet_required → check_wiki → load_wiki_config → _comments → all
Source · 28 lines
def test_before_tests_a_report_a_run_produces_is_not_yet_required(
    traced: Path, tmp_path: Path
) -> None:
    """A PRE-COMMIT HOOK RUNS BEFORE THE TESTS (round 3, P6c, found dogfooding): the JUnit,
    coverage, result and gcov reports are what the test run WRITES, so in pre-commit they do not
    exist yet and the shipped `clew-wiki-check` hook failed every commit of a repository that
    declared them. `before_tests` drops only those; files the repository HOLDS — the mapping,
    feature files, mutation records — are still required, and the full check (after the tests,
    in CI) still names a missing report.

    @brief check_wiki(before_tests=True).
    """
    from clew.wiki.check import check_wiki

    (tmp_path / ".clew.yaml").write_text(
        ## FIXTURE CHANGED (2.0.0, R5-CFG F20): the evidence is the top-level `tests:` section.
        "wiki:\n  docs: []\ntests:\n  junit: [build/junit.xml]\n"
        "  coverage: build/coverage.xml\n  results: [{format: tap, path: build/t.tap}]\n"
        "  gcov: ['build/*.gcov']\n  mapping: missing-map.yaml\n"
    )
    early = "\n".join(check_wiki(tmp_path, traced, before_tests=True))
    assert "junit.xml" not in early and "coverage.xml" not in early and "t.tap" not in early
    assert "build/*.gcov" not in early
    assert "missing-map.yaml" in early
    full = "\n".join(check_wiki(tmp_path, traced))
    assert "'build/junit.xml' does not exist" in full

Activity · 8 steps
lines 302–302from clew.wiki.check import check_wikilines 304–309(tmp_path / ".clew.yaml").write_text( ## FIXTURE CHANGED (2.0.0, R5-CFG F20): the evidence is the top-level `tests:` section. "wiki:\n docs: []\ntests:\n junit: [build/junit.xml]\n" " coverage: build/coverage.xml\n results: [{format: tap, path: build/t.tap}]\n" " gcov: ['build/*.gcov']\n mapping: missing-map.yaml\n" )lines 310–310early = "\n".join(check_wiki(tmp_path, traced, before_tests=True))lines 311–311assert "junit.xml" not in early and "coverage.xml" not in early and "t.tap" not in earlylines 312–312assert "build/*.gcov" not in earlylines 313–313assert "missing-map.yaml" in earlylines 314–314full = "\n".join(check_wiki(tmp_path, traced))lines 315–315assert "'build/junit.xml' does not exist" in full

test_by_default_inference_is_the_full_transitive_closure

None test_wiki_imports.test_by_default_inference_is_the_full_transitive_closure(Path traced, Path tmp_path)

Unbounded transitive inference by default, with extent.

tests/test_wiki_imports.py:528

Show on the map →

Called by none

Calls _with_calls, requirement_evidence

Checks

  • assert rows["R-A"].inferred_tests == ("test_far", "test_infer")
  • assert dict(rows["R-A"].extent) == {"test_far": ("impl",), "test_infer": ("impl",)}
  • assert dict(rows["R-A"].distance) == {"test_far": 3, "test_infer": 2}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measured
REQ-DDB-QUERY-001measuredtest_by_default_inference_is_the_full_transitive_closure → requirement_evidence → connect
REQ-DDB-QUERY-003measuredtest_by_default_inference_is_the_full_transitive_closure → requirement_evidence → _implementer_spans → table_exists
REQ-DDB-SCHEMA-006measured
REQ-DDB-WIKI-002measuredtest_by_default_inference_is_the_full_transitive_closure → requirement_evidence
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measured
REQ-DDB-WIKI-015measured
REQ-DDB-WIKI-016measured
REQ-DDB-WIKI-017measured
REQ-DDB-WIKI-054inferredtest_by_default_inference_is_the_full_transitive_closure → requirement_evidence → _tier → all
Source · 21 lines
def test_by_default_inference_is_the_full_transitive_closure(traced: Path, tmp_path: Path) -> None:
    """OWNER 2026-11-17: tests are linked to source by what they reach, transitively — "we should
    EXPLICITLY know which tests are related to which requirements by transitive linkage". A fixed
    hop cap was a guess: clew's REQ-DDB-GUARD-021 implementer sits 4 calls under its tests, so the
    demo read it MISSING. With no `infer_depth` declared, every test whose calls reach an
    implementer at ANY depth is linked; the cap stays available, and 0 still turns it off. The
    link's extent names the implementers each inferred test reaches.

    @brief Unbounded transitive inference by default, with extent.
    """
    db = _with_calls(traced, tmp_path)
    rows = {
        r.req_id: r
        for r in requirement_evidence(db, junit=[], inputs=EvidenceInputs(), repo_root=tmp_path)
    }
    assert rows["R-A"].inferred_tests == ("test_far", "test_infer")
    assert dict(rows["R-A"].extent) == {"test_far": ("impl",), "test_infer": ("impl",)}
    ## The nearest test is the one aimed at the code: test_infer is 2 calls away, test_far 3.
    assert dict(rows["R-A"].distance) == {"test_far": 3, "test_infer": 2}

Activity · 5 steps
lines 538–538db = _with_calls(traced, tmp_path)lines 539–542rows = { r.req_id: r for r in requirement_evidence(db, junit=[], inputs=EvidenceInputs(), repo_root=tmp_path) }lines 543–543assert rows["R-A"].inferred_tests == ("test_far", "test_infer")lines 544–544assert dict(rows["R-A"].extent) == {"test_far": ("impl",), "test_infer": ("impl",)}lines 546–546assert dict(rows["R-A"].distance) == {"test_far": 3, "test_infer": 2}

test_check_names_every_missing_import

None test_wiki_imports.test_check_names_every_missing_import(Path traced, Path tmp_path)

`clew wiki check` covers the W15/W16 inputs.

tests/test_wiki_imports.py:324

Show on the map →

Called by none

Calls check_wiki

Checks

  • assert "'missing.tap' does not exist" in problems
  • assert "'nunit' is not known" in problems
  • assert "'build/*.gcov' matches no file" in problems
  • assert "'features/*.feature' matches no file" in problems
  • assert "R-NOPE" in problems and "R-A" not in problems.replace("R-A:", "")

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001inferredtest_check_names_every_missing_import → check_wiki → trace_problems → pin_problems → git_text → git_argv
REQ-DDB-CONFIG-003inferredtest_check_names_every_missing_import → check_wiki → trace_problems → composite_problems → compose → _root_source → declared_catalog → _is_flat_req_list
REQ-DDB-GUARD-012measuredtest_check_names_every_missing_import → check_wiki → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-GUARD-024inferredtest_check_names_every_missing_import → check_wiki → trace_problems → composite_problems → compose → _root_source → declared_catalog → load_guard_config → read_guard_config → load_config → apply_opt_in_languages
REQ-DDB-GUARD-027inferredtest_check_names_every_missing_import → check_wiki → trace_problems → catalog_requirements → read_catalog_at
REQ-DDB-QUERY-001measuredtest_check_names_every_missing_import → check_wiki → _flow_problems → connect
REQ-DDB-QUERY-003measuredtest_check_names_every_missing_import → check_wiki → _flow_problems → identity_rowids
REQ-DDB-QUERY-010inferredtest_check_names_every_missing_import → check_wiki → _flow_problems → identity_rowids
REQ-DDB-SCHEMA-006inferredtest_check_names_every_missing_import → check_wiki → trace_problems → composite_problems → compose → _root_source → declared_catalog → resolve_catalog_path
REQ-DDB-SCHEMA-015inferredtest_check_names_every_missing_import → check_wiki → trace_problems → composite_problems → compose → _nodes → link_ids
REQ-DDB-WIKI-003measuredtest_check_names_every_missing_import → check_wiki
REQ-DDB-WIKI-004measuredtest_check_names_every_missing_import → check_wiki → trace_problems → load_nodes
REQ-DDB-WIKI-005measuredtest_check_names_every_missing_import → check_wiki → trace_problems
REQ-DDB-WIKI-006inferredtest_check_names_every_missing_import → check_wiki → trace_problems → _mutation_problems → parse_mutations
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measuredtest_check_names_every_missing_import → check_wiki → trace_problems → _mapping_problems → parse_mapping
REQ-DDB-WIKI-015inferredtest_check_names_every_missing_import → check_wiki → trace_problems → composite_problems → compose → _root_source → declared_catalog
REQ-DDB-WIKI-016catalog
REQ-DDB-WIKI-040inferredtest_check_names_every_missing_import → check_wiki → trace_problems → composite_problems
REQ-DDB-WIKI-054inferredtest_check_names_every_missing_import → check_wiki → load_wiki_config → _comments → all
Source · 23 lines
def test_check_names_every_missing_import(traced: Path, tmp_path: Path) -> None:
    """A GLOB THAT MATCHES NOTHING is a problem: a misspelled gcov or feature glob would otherwise
    yield a trace that reads as "no coverage measured" or "no scenarios".

    @brief `clew wiki check` covers the W15/W16 inputs.
    """
    from clew.wiki.check import check_wiki

    (tmp_path / "map.yaml").write_text("R-A: [x]\nR-NOPE: [y]\n")
    (tmp_path / ".clew.yaml").write_text(
        "wiki:\n  docs: []\ntests:\n"
        "  results: [{format: tap, path: missing.tap}, {format: nunit, path: n.xml}]\n"
        "  gcov: ['build/*.gcov']\n  features: ['features/*.feature']\n"
        "  mapping: map.yaml\n"
    )
    problems = "\n".join(check_wiki(tmp_path, traced))
    assert "'missing.tap' does not exist" in problems
    assert "'nunit' is not known" in problems
    assert "'build/*.gcov' matches no file" in problems
    assert "'features/*.feature' matches no file" in problems
    assert "R-NOPE" in problems and "R-A" not in problems.replace("R-A:", "")

Activity · 9 steps
lines 330–330from clew.wiki.check import check_wikilines 332–332(tmp_path / "map.yaml").write_text("R-A: [x]\nR-NOPE: [y]\n")lines 333–338(tmp_path / ".clew.yaml").write_text( "wiki:\n docs: []\ntests:\n" " results: [{format: tap, path: missing.tap}, {format: nunit, path: n.xml}]\n" " gcov: ['build/*.gcov']\n features: ['features/*.feature']\n" " mapping: map.yaml\n" )lines 339–339problems = "\n".join(check_wiki(tmp_path, traced))lines 340–340assert "'missing.tap' does not exist" in problemslines 341–341assert "'nunit' is not known" in problemslines 342–342assert "'build/*.gcov' matches no file" in problemslines 343–343assert "'features/*.feature' matches no file" in problemslines 344–344assert "R-NOPE" in problems and "R-A" not in problems.replace("R-A:", "")

test_contexts_are_read_from_coverage_s_own_data_file

None test_wiki_imports.test_contexts_are_read_from_coverage_s_own_data_file(Path traced, Path tmp_path)

Per-test contexts from a `.coverage` data file.

tests/test_wiki_imports.py:549

Checks

  • assert rows["R-A"].measured_tests == ("test_cov",)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measured
REQ-DDB-QUERY-001measuredtest_contexts_are_read_from_coverage_s_own_data_file → requirement_evidence → connect
REQ-DDB-QUERY-003measuredtest_contexts_are_read_from_coverage_s_own_data_file → requirement_evidence → _implementer_spans → table_exists
REQ-DDB-SCHEMA-006measured
REQ-DDB-WIKI-002measuredtest_contexts_are_read_from_coverage_s_own_data_file → requirement_evidence
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measured
REQ-DDB-WIKI-015measured
REQ-DDB-WIKI-016measured
REQ-DDB-WIKI-017measured
REQ-DDB-WIKI-041measured
REQ-DDB-WIKI-054inferredtest_contexts_are_read_from_coverage_s_own_data_file → requirement_evidence → _tier → all
Source · 23 lines
def test_contexts_are_read_from_coverage_s_own_data_file(traced: Path, tmp_path: Path) -> None:
    """FOUND ON CLEW'S OWN SUITE (round 4): the JSON report with per-test contexts was 3.9 GB for
    3,176 tests — every line repeating every test that ran it. coverage.py's data file holds the
    same contexts compactly (SQLite), so `contexts:` also takes it, read through coverage's API.

    @brief Per-test contexts from a `.coverage` data file.
    """
    from coverage import CoverageData

    data = CoverageData(basename=str(tmp_path / ".coverage"))
    data.set_context("tests/unit/test_c.py::test_cov|run")
    data.add_lines({str(tmp_path / "src" / "a.c"): [11]})
    data.set_context("tests/unit/test_c.py::test_elsewhere|run")
    data.add_lines({str(tmp_path / "src" / "a.c"): [40]})
    data.write()
    inputs = EvidenceInputs(contexts=".coverage", infer_depth=0)
    rows = {
        r.req_id: r
        for r in requirement_evidence(traced, junit=[], inputs=inputs, repo_root=tmp_path)
    }
    assert rows["R-A"].measured_tests == ("test_cov",)

Activity · 10 steps
lines 556–556from coverage import CoverageDatalines 558–558data = CoverageData(basename=str(tmp_path / ".coverage"))lines 559–559data.set_context("tests/unit/test_c.py::test_cov|run")lines 560–560data.add_lines({str(tmp_path / "src" / "a.c"): [11]})lines 561–561data.set_context("tests/unit/test_c.py::test_elsewhere|run")lines 562–562data.add_lines({str(tmp_path / "src" / "a.c"): [40]})lines 563–563data.write()lines 564–564inputs = EvidenceInputs(contexts=".coverage", infer_depth=0)lines 565–568rows = { r.req_id: r for r in requirement_evidence(traced, junit=[], inputs=inputs, repo_root=tmp_path) }lines 569–569assert rows["R-A"].measured_tests == ("test_cov",)

test_each_declared_result_format_folds_to_statuses

None test_wiki_imports.test_each_declared_result_format_folds_to_statuses(Path tmp_path, str fmt, str text, dict[str, str] expected)

CTest, Catch2, TAP and pytest-json-report results.

tests/test_wiki_imports.py:144

Checks

  • assert {k: v.status for k, v in parse_results(fmt, report).items()} == expected

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measuredtest_each_declared_result_format_folds_to_statuses → parse_results
REQ-DDB-WIKI-016catalog
Source · 12 lines
def test_each_declared_result_format_folds_to_statuses(
    tmp_path: Path, fmt: str, text: str, expected: dict[str, str]
) -> None:
    """A parametrized pytest node folds to its function and takes its WORST case.

    @brief CTest, Catch2, TAP and pytest-json-report results.
    """
    report = tmp_path / "report"
    report.write_text(text)
    assert {k: v.status for k, v in parse_results(fmt, report).items()} == expected

Activity · 3 steps
lines 151–151report = tmp_path / "report"lines 152–152report.write_text(text)lines 153–153assert {k: v.status for k, v in parse_results(fmt, report).items()} == expected

test_gcov_json_gz_relativises_absolute_paths

None test_wiki_imports.test_gcov_json_gz_relativises_absolute_paths(Path tmp_path)

gcov --json-format output (gzipped) with an absolute file path.

tests/test_wiki_imports.py:62

Show on the map →

Called by none

Calls parse_gcov

Checks

  • assert parse_gcov([report], tmp_path) == {"src/a.c": {10: 4, 11: 0}}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-009measuredtest_gcov_json_gz_relativises_absolute_paths → parse_gcov
REQ-DDB-WIKI-010catalog
REQ-DDB-WIKI-016catalog
Source · 16 lines
def test_gcov_json_gz_relativises_absolute_paths(tmp_path: Path) -> None:
    """@brief gcov --json-format output (gzipped) with an absolute file path."""
    doc = {
        "current_working_directory": str(tmp_path / "build"),
        "files": [
            {
                "file": str(tmp_path / "src" / "a.c"),
                "lines": [{"line_number": 10, "count": 4}, {"line_number": 11, "count": 0}],
            }
        ],
    }
    report = tmp_path / "a.gcov.json.gz"
    report.write_bytes(gzip.compress(json.dumps(doc).encode()))
    assert parse_gcov([report], tmp_path) == {"src/a.c": {10: 4, 11: 0}}

Activity · 4 steps
lines 64–72doc = { "current_working_directory": str(tmp_path / "build"), "files": [ { "file": str(tmp_path / "src" / "a.c"), "lines": [{"line_number": 10, "count": 4}, {"line_number": 11, "count": 0}], } ], }lines 73–73report = tmp_path / "a.gcov.json.gz"lines 74–74report.write_bytes(gzip.compress(json.dumps(doc).encode()))lines 75–75assert parse_gcov([report], tmp_path) == {"src/a.c": {10: 4, 11: 0}}

test_gcov_text_reads_hits_and_skips_non_executable_lines

None test_wiki_imports.test_gcov_text_reads_hits_and_skips_non_executable_lines(Path tmp_path)

.gcov text → hits.

tests/test_wiki_imports.py:48

Show on the map →

Called by none

Calls parse_gcov

Checks

  • assert parse_gcov([report], tmp_path) == {"src/a.c": {10: 5, 11: 0, 12: 2, 13: 0}}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-009measuredtest_gcov_text_reads_hits_and_skips_non_executable_lines → parse_gcov
REQ-DDB-WIKI-010catalog
REQ-DDB-WIKI-016catalog
Source · 14 lines
def test_gcov_text_reads_hits_and_skips_non_executable_lines(tmp_path: Path) -> None:
    """`#####` and `=====` are executable lines with no hits; `-` is not executable at all, so it
    is not a line with zero hits.

    @brief .gcov text → hits.
    """
    (tmp_path / "src").mkdir()
    (tmp_path / "src" / "a.c").write_text("x\n")
    report = tmp_path / "build" / "a.c.gcov"
    report.parent.mkdir()
    report.write_text(_GCOV)
    assert parse_gcov([report], tmp_path) == {"src/a.c": {10: 5, 11: 0, 12: 2, 13: 0}}

Activity · 6 steps
lines 54–54(tmp_path / "src").mkdir()lines 55–55(tmp_path / "src" / "a.c").write_text("x\n")lines 56–56report = tmp_path / "build" / "a.c.gcov"lines 57–57report.parent.mkdir()lines 58–58report.write_text(_GCOV)lines 59–59assert parse_gcov([report], tmp_path) == {"src/a.c": {10: 5, 11: 0, 12: 2, 13: 0}}

test_gherkin_scenarios_carry_their_own_and_inherited_tags

None test_wiki_imports.test_gherkin_scenarios_carry_their_own_and_inherited_tags(Path tmp_path)

Parse .feature scenarios.

tests/test_wiki_imports.py:192

Checks

  • assert [(s.file, s.line, s.name, s.tags) for s in scenarios] == [

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measuredtest_gherkin_scenarios_carry_their_own_and_inherited_tags → parse_features
REQ-DDB-WIKI-016catalog
Source · 16 lines
def test_gherkin_scenarios_carry_their_own_and_inherited_tags(tmp_path: Path) -> None:
    """A feature's tags apply to each of its scenarios; `@req:ID` and `@ID` both name one.

    @brief Parse .feature scenarios.
    """
    feat = tmp_path / "tests" / "features" / "pair.feature"
    feat.parent.mkdir(parents=True)
    feat.write_text(_FEATURE)
    scenarios = parse_features(tmp_path, ("tests/features/**/*.feature",))
    assert [(s.file, s.line, s.name, s.tags) for s in scenarios] == [
        ("tests/features/pair.feature", 5, "A tablet pairs", ("R-FEAT", "R-B", "smoke")),
        ("tests/features/pair.feature", 11, "A pairing fails", ("R-FEAT", "R-C")),
    ]


@pytest.fixture()

test_imports_join_the_trace

None test_wiki_imports.test_imports_join_the_trace(Path traced, Path tmp_path)

Imported results, mapping, scenarios, gcov and layers in requirement_evidence.

tests/test_wiki_imports.py:241

Checks

  • assert rows["R-A"].tier == "PASS" and rows["R-A"].implementers_covered == ("impl",)
  • assert rows["R-A"].layers == (("unit", 1),)
  • assert rows["R-B"].tests == (("tests/features/pair.feature::A tablet pairs", "passed"),)
  • assert rows["R-B"].tier == "PASS" and rows["R-B"].layers == (("bdd", 1),)
  • assert {t for t, _s in rows["R-C"].tests} == {
  • assert rows["R-C"].tier == "GAP"
  • assert rows["R-C"].layers == (("bdd", 1), ("cpp", 1))
  • assert rows["R-D"].tier == "MISSING" and rows["R-D"].layers == ()

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measured
REQ-DDB-QUERY-001measuredtest_imports_join_the_trace → requirement_evidence → connect
REQ-DDB-QUERY-003measuredtest_imports_join_the_trace → requirement_evidence → _implementer_spans → table_exists
REQ-DDB-SCHEMA-006measured
REQ-DDB-WIKI-002measuredtest_imports_join_the_trace → requirement_evidence
REQ-DDB-WIKI-009measured
REQ-DDB-WIKI-010measured
REQ-DDB-WIKI-015measured
REQ-DDB-WIKI-016measured
REQ-DDB-WIKI-017measured
REQ-DDB-WIKI-054inferredtest_imports_join_the_trace → requirement_evidence → _tier → all
Source · 49 lines
def test_imports_join_the_trace(traced: Path, tmp_path: Path) -> None:
    """ONE TRACE FROM EVERY SOURCE: an indexed test with a pytest-json result, a scenario with a
    JUnit result under its own name, a Catch2 case linked by the mapping file, and gcov coverage.
    Layers count each requirement's tests by layer; R-D, tested nowhere, has no layers.

    @brief Imported results, mapping, scenarios, gcov and layers in requirement_evidence.
    """
    (tmp_path / "src").mkdir()
    (tmp_path / "src" / "a.c").write_text("x\n")
    (tmp_path / "a.c.gcov").write_text(_GCOV)
    (tmp_path / "r.json").write_text(
        json.dumps({"tests": [{"nodeid": "t.py::test_ok", "outcome": "passed"}]})
    )
    (tmp_path / "c.xml").write_text(_CATCH2)
    (tmp_path / "j.xml").write_text(
        '<testsuite><testcase name="A tablet pairs"/><testcase name="A pairing fails">'
        '<failure message="x"/></testcase></testsuite>'
    )
    (tmp_path / "map.yaml").write_text("R-C: [Store loads]\n")
    feat = tmp_path / "tests" / "features" / "pair.feature"
    feat.parent.mkdir(parents=True)
    feat.write_text(_FEATURE)
    inputs = EvidenceInputs(
        results=(("pytest-json", "r.json"), ("catch2", "c.xml")),
        gcov=("*.gcov",),
        mapping="map.yaml",
        features=("tests/features/*.feature",),
        layers=(("unit", ("tests/unit/*",)), ("bdd", ("tests/features/*",)), ("cpp", ("Store *",))),
        min_layers=2,
    )
    rows = {
        r.req_id: r
        for r in requirement_evidence(
            traced, junit=[tmp_path / "j.xml"], inputs=inputs, repo_root=tmp_path
        )
    }
    assert rows["R-A"].tier == "PASS" and rows["R-A"].implementers_covered == ("impl",)
    assert rows["R-A"].layers == (("unit", 1),)
    assert rows["R-B"].tests == (("tests/features/pair.feature::A tablet pairs", "passed"),)
    assert rows["R-B"].tier == "PASS" and rows["R-B"].layers == (("bdd", 1),)
    assert {t for t, _s in rows["R-C"].tests} == {
        "Store loads",
        "tests/features/pair.feature::A pairing fails",
    }
    assert rows["R-C"].tier == "GAP"
    assert rows["R-C"].layers == (("bdd", 1), ("cpp", 1))
    assert rows["R-D"].tier == "MISSING" and rows["R-D"].layers == ()

Activity · 20 steps
lines 248–248(tmp_path / "src").mkdir()lines 249–249(tmp_path / "src" / "a.c").write_text("x\n")lines 250–250(tmp_path / "a.c.gcov").write_text(_GCOV)lines 251–253(tmp_path / "r.json").write_text( json.dumps({"tests": [{"nodeid": "t.py::test_ok", "outcome": "passed"}]}) )lines 254–254(tmp_path / "c.xml").write_text(_CATCH2)lines 255–258(tmp_path / "j.xml").write_text( '<testsuite><testcase name="A tablet pairs"/><testcase name="A pairing fails">' '<failure message="x"/></testcase></testsuite>' )lines 259–259(tmp_path / "map.yaml").write_text("R-C: [Store loads]\n")lines 260–260feat = tmp_path / "tests" / "features" / "pair.feature"lines 261–261feat.parent.mkdir(parents=True)lines 262–262feat.write_text(_FEATURE)lines 263–270inputs = EvidenceInputs( results=(("pytest-json", "r.json"), ("catch2", "c.xml")), gcov=("*.gcov",), mapping="map.yaml", features=("tests/features/*.feature",), layers=(("unit", ("tests/unit/*",)), ("bdd", ("tests/features/*",)), ("cpp", ("Store *",))), min_layers=2, )lines 271–276rows = { r.req_id: r for r in requirement_evidence( traced, junit=[tmp_path / "j.xml"], inputs=inputs, repo_root=tmp_path ) }lines 277–277assert rows["R-A"].tier == "PASS" and rows["R-A"].implementers_covered == ("impl",)lines 278–278assert rows["R-A"].layers == (("unit", 1),)lines 279–279assert rows["R-B"].tests == (("tests/features/pair.feature::A tablet pairs", "passed"),)lines 280–280assert rows["R-B"].tier == "PASS" and rows["R-B"].layers == (("bdd", 1),)lines 281–284assert {t for t, _s in rows["R-C"].tests} == { "Store loads", "tests/features/pair.feature::A pairing fails", }lines 285–285assert rows["R-C"].tier == "GAP"lines 286–286assert rows["R-C"].layers == (("bdd", 1), ("cpp", 1))lines 287–287assert rows["R-D"].tier == "MISSING" and rows["R-D"].layers == ()

test_tests_named_by_the_catalog_evidence_field_are_linked

None test_wiki_imports.test_tests_named_by_the_catalog_evidence_field_are_linked(Path traced, Path tmp_path)

`x-evidence` test files link their tests, marked as declared.

tests/test_wiki_imports.py:366

Checks

  • assert rows["R-D"].tests == (("test_ok", "passed"),) and rows["R-D"].tier == "PASS"
  • assert rows["R-D"].declared_tests == ("test_ok",)
  • assert rows["R-A"].declared_tests == ()
  • assert next(r for r in plain if r.req_id == "R-D").tier == "MISSING"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measured
REQ-DDB-CONFIG-003measured
REQ-DDB-QUERY-001measuredtest_tests_named_by_the_catalog_evidence_field_are_linked → requirement_evidence → connect
REQ-DDB-QUERY-003measuredtest_tests_named_by_the_catalog_evidence_field_are_linked → requirement_evidence → _implementer_spans → table_exists
REQ-DDB-SCHEMA-006measured
REQ-DDB-WIKI-002measuredtest_tests_named_by_the_catalog_evidence_field_are_linked → requirement_evidence
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measured
REQ-DDB-WIKI-015measured
REQ-DDB-WIKI-016measured
REQ-DDB-WIKI-017measured
REQ-DDB-WIKI-054inferredtest_tests_named_by_the_catalog_evidence_field_are_linked → requirement_evidence → _tier → all
Source · 27 lines
def test_tests_named_by_the_catalog_evidence_field_are_linked(traced: Path, tmp_path: Path) -> None:
    """THE CATALOG IS A SOURCE TOO (owner 2026-11-15: clew's own trace read 92 MISSING because its
    tests carry no `@req` tags, while `requirements.yaml` names each requirement's test files in
    `x-evidence`). A test file named there links every test function the index holds in it — a
    FILE-LEVEL claim, so the row records which links came from the catalog.

    @brief `x-evidence` test files link their tests, marked as declared.
    """
    (tmp_path / "requirements.yaml").write_text(
        "- {id: R-D, title: d, x-evidence: 'src/a.c impl; tests/unit/test_a.py.'}\n"
    )
    (tmp_path / "r.json").write_text(
        json.dumps({"tests": [{"nodeid": "t.py::test_ok", "outcome": "passed"}]})
    )
    inputs = EvidenceInputs(results=(("pytest-json", "r.json"),))
    rows = {
        r.req_id: r
        for r in requirement_evidence(traced, junit=[], inputs=inputs, repo_root=tmp_path)
    }
    assert rows["R-D"].tests == (("test_ok", "passed"),) and rows["R-D"].tier == "PASS"
    assert rows["R-D"].declared_tests == ("test_ok",)
    assert rows["R-A"].declared_tests == ()
    off = EvidenceInputs(results=inputs.results, evidence_fields=())
    plain = requirement_evidence(traced, junit=[], inputs=off, repo_root=tmp_path)
    assert next(r for r in plain if r.req_id == "R-D").tier == "MISSING"

Activity · 10 steps
lines 374–376(tmp_path / "requirements.yaml").write_text( "- {id: R-D, title: d, x-evidence: 'src/a.c impl; tests/unit/test_a.py.'}\n" )lines 377–379(tmp_path / "r.json").write_text( json.dumps({"tests": [{"nodeid": "t.py::test_ok", "outcome": "passed"}]}) )lines 380–380inputs = EvidenceInputs(results=(("pytest-json", "r.json"),))lines 381–384rows = { r.req_id: r for r in requirement_evidence(traced, junit=[], inputs=inputs, repo_root=tmp_path) }lines 385–385assert rows["R-D"].tests == (("test_ok", "passed"),) and rows["R-D"].tier == "PASS"lines 386–386assert rows["R-D"].declared_tests == ("test_ok",)lines 387–387assert rows["R-A"].declared_tests == ()lines 388–388off = EvidenceInputs(results=inputs.results, evidence_fields=())lines 389–389plain = requirement_evidence(traced, junit=[], inputs=off, repo_root=tmp_path)lines 390–390assert next(r for r in plain if r.req_id == "R-D").tier == "MISSING"

test_tests_that_reach_an_implementer_are_inferred_within_the_depth

None test_wiki_imports.test_tests_that_reach_an_implementer_are_inferred_within_the_depth(Path traced, Path tmp_path)

Call-graph inference of test → requirement links.

tests/test_wiki_imports.py:422

Show on the map →

Called by none

Calls _with_calls, requirement_evidence

Checks

  • assert rows["R-A"].inferred_tests == ("test_infer",)
  • assert {t for t, _s in rows["R-A"].tests} == {"test_ok", "test_infer"}
  • assert next(r for r in deeper if r.req_id == "R-A").inferred_tests == ("test_far", "test_infer")
  • assert next(r for r in off if r.req_id == "R-A").inferred_tests == ()

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measured
REQ-DDB-QUERY-001measuredtest_tests_that_reach_an_implementer_are_inferred_within_the_depth → requirement_evidence → connect
REQ-DDB-QUERY-003measuredtest_tests_that_reach_an_implementer_are_inferred_within_the_depth → requirement_evidence → _implementer_spans → table_exists
REQ-DDB-SCHEMA-006measured
REQ-DDB-WIKI-002measuredtest_tests_that_reach_an_implementer_are_inferred_within_the_depth → requirement_evidence
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measured
REQ-DDB-WIKI-015measured
REQ-DDB-WIKI-016measured
REQ-DDB-WIKI-017measured
REQ-DDB-WIKI-054inferredtest_tests_that_reach_an_implementer_are_inferred_within_the_depth → requirement_evidence → _tier → all
Source · 29 lines
def test_tests_that_reach_an_implementer_are_inferred_within_the_depth(
    traced: Path, tmp_path: Path
) -> None:
    """NO TAG NEEDED (owner 2026-11-15: "can't that be inferred?"): a test whose calls reach a
    function tagged with a requirement, within `infer_depth` hops, is linked to it — and the row
    says the link was INFERRED, because reaching code is weaker than verifying it. A deeper chain
    is not linked, and a `binding` edge (a function value passed along) is not a call.

    @brief Call-graph inference of test → requirement links.
    """
    db = _with_calls(traced, tmp_path)
    rows = {
        r.req_id: r
        for r in requirement_evidence(
            db, junit=[], inputs=EvidenceInputs(infer_depth=2), repo_root=tmp_path
        )
    }
    assert rows["R-A"].inferred_tests == ("test_infer",)
    assert {t for t, _s in rows["R-A"].tests} == {"test_ok", "test_infer"}
    deeper = requirement_evidence(
        db, junit=[], inputs=EvidenceInputs(infer_depth=3), repo_root=tmp_path
    )
    assert next(r for r in deeper if r.req_id == "R-A").inferred_tests == ("test_far", "test_infer")
    off = requirement_evidence(
        db, junit=[], inputs=EvidenceInputs(infer_depth=0), repo_root=tmp_path
    )
    assert next(r for r in off if r.req_id == "R-A").inferred_tests == ()

Activity · 8 steps
lines 432–432db = _with_calls(traced, tmp_path)lines 433–438rows = { r.req_id: r for r in requirement_evidence( db, junit=[], inputs=EvidenceInputs(infer_depth=2), repo_root=tmp_path ) }lines 439–439assert rows["R-A"].inferred_tests == ("test_infer",)lines 440–440assert {t for t, _s in rows["R-A"].tests} == {"test_ok", "test_infer"}lines 441–443deeper = requirement_evidence( db, junit=[], inputs=EvidenceInputs(infer_depth=3), repo_root=tmp_path )lines 444–444assert next(r for r in deeper if r.req_id == "R-A").inferred_tests == ("test_far", "test_infer")lines 445–447off = requirement_evidence( db, junit=[], inputs=EvidenceInputs(infer_depth=0), repo_root=tmp_path )lines 448–448assert next(r for r in off if r.req_id == "R-A").inferred_tests == ()

test_the_trace_cli_reads_imports_from_the_config

None test_wiki_imports.test_the_trace_cli_reads_imports_from_the_config(Path traced, Path tmp_path, pytest.CaptureFixture[str] capsys)

`clew wiki trace --config FILE` applies the section's imports.

tests/test_wiki_imports.py:347

Show on the map →

Called by none

Calls wiki_main

Checks

  • assert wiki_main(argv) == 0
  • assert rows["R-B"]["tier"] == "PASS" and rows["R-B"]["layers"] == [["cpp", 1]]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CLI-001inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → report_stats
REQ-DDB-CLI-002inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → _doxygen_or_partial → _doxygen_stage → _run_doxygen_from_args → run_doxygen → doxygen_supports_sqlite3
REQ-DDB-CONFIG-001measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _apply_declared_document → stated_document_meta
REQ-DDB-CONFIG-003inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml → _is_flat_req_list
REQ-DDB-CONFIG-004inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_preprocessor
REQ-DDB-CONFIG-005inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig
REQ-DDB-CONFIG-006inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _recorded_entry_patterns → recorded_explicit
REQ-DDB-CONFIG-007inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature
REQ-DDB-CONFIG-009inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _apply_toolchain_exclusions → load_toolchain_config
REQ-DDB-GUARD-012measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _trace → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-GUARD-019inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → apply_autobrief
REQ-DDB-GUARD-027inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → check_wiki → trace_problems → catalog_requirements → read_catalog_at
REQ-DDB-INDEX-001inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _verify_extra_input_is_read → effective_file_patterns
REQ-DDB-INDEX-002inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → build_lock
REQ-DDB-INDEX-003inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → report_index_coverage
REQ-DDB-INDEX-004inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → recover_ast_symbols
REQ-DDB-INDEX-005inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → stamp_external_provenance
REQ-DDB-INDEX-006inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main
REQ-DDB-INDEX-007inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → record_owners
REQ-DDB-INDEX-008inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_licenses
REQ-DDB-INDEX-009inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc
REQ-DDB-INDEX-010inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_ast_includes
REQ-DDB-INDEX-011inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_property_keys
REQ-DDB-MCP-001inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → target_for
REQ-DDB-PIPE-001inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_database
REQ-DDB-PIPE-003inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → build_call_edges
REQ-DDB-PIPE-004inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → python_entry_seeds
REQ-DDB-PIPE-005inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature
REQ-DDB-PIPE-006inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → run_rustdoc → _require_nightly_rustdoc → clean_subprocess_env
REQ-DDB-PIPE-007inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig_gates
REQ-DDB-PIPE-008inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs
REQ-DDB-PIPE-009inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → prune_dominated_fuzzy_call_edges
REQ-DDB-PIPE-010inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _build_inferred_edges
REQ-DDB-PIPE-011inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → try_fast_refresh → _fast_refresh_locked → _plan → _line_anchors → _harvest_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → build_harvest_plan → js_symbol_harvester
REQ-DDB-PIPE-013inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings
REQ-DDB-PIPE-014inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc → within_repo
REQ-DDB-PIPE-015inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_config_defaults
REQ-DDB-QUERY-001measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _trace → requirement_evidence → connect
REQ-DDB-QUERY-003measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _flow → _flow_object → derive_flow → qualified_name_of
REQ-DDB-QUERY-004inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → symbol_pages → _owners_by_file → file_owners
REQ-DDB-QUERY-010inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → check_wiki → _flow_problems → identity_rowids
REQ-DDB-QUERY-011inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads → _ensure_threads_tables
REQ-DDB-SCHEMA-001inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads
REQ-DDB-SCHEMA-002inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _writer_dispatch_map
REQ-DDB-SCHEMA-003inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table
REQ-DDB-SCHEMA-004inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest
REQ-DDB-SCHEMA-005inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_key_alias_prefixes
REQ-DDB-SCHEMA-006measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml
REQ-DDB-SCHEMA-007inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table
REQ-DDB-SCHEMA-009inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_event_edges
REQ-DDB-SCHEMA-011inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → extract_context_conflicts
REQ-DDB-SCHEMA-012inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest → declaration_origin
REQ-DDB-SCHEMA-013inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → import_data_model_keys
REQ-DDB-SCHEMA-014inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs → ensure_file_docs_table
REQ-DDB-SCHEMA-015inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → refresh_main → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml
REQ-DDB-WIKI-001measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main
REQ-DDB-WIKI-002measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _trace → requirement_evidence
REQ-DDB-WIKI-003inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki
REQ-DDB-WIKI-004inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → nodes_page
REQ-DDB-WIKI-005inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → report_limit
REQ-DDB-WIKI-006inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → check_wiki → trace_problems → _mutation_problems → parse_mutations
REQ-DDB-WIKI-007inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _diff → diff_versions
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → parse_features
REQ-DDB-WIKI-011inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → _render → sphinx_settings
REQ-DDB-WIKI-012inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → requirements_page
REQ-DDB-WIKI-013inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → _burndown → burndown
REQ-DDB-WIKI-014inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → flow_page
REQ-DDB-WIKI-015measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → _prose → impact_path
REQ-DDB-WIKI-016measuredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → _coverage → parse_contexts
REQ-DDB-WIKI-017measured
REQ-DDB-WIKI-018inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → _all_flows → entry_point_flows
REQ-DDB-WIKI-019inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → build_graph
REQ-DDB-WIKI-020inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → write_quick_views → modal
REQ-DDB-WIKI-021inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → minimap_html
REQ-DDB-WIKI-022inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → requirements_page → requirement_pages
REQ-DDB-WIKI-023inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → flows_index
REQ-DDB-WIKI-024inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → impact_page
REQ-DDB-WIKI-025inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → commit_published
REQ-DDB-WIKI-026inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → gather
REQ-DDB-WIKI-027inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → _test_flows
REQ-DDB-WIKI-028inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → _fetch_issues → provider_for
REQ-DDB-WIKI-029inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → write_exports
REQ-DDB-WIKI-031inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → find_decisions
REQ-DDB-WIKI-035inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _trace_run
REQ-DDB-WIKI-036inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → root_name
REQ-DDB-WIKI-037inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → open_main
REQ-DDB-WIKI-038inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → _markdown
REQ-DDB-WIKI-040inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → check_wiki → trace_problems → composite_problems
REQ-DDB-WIKI-041inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _flow → _flow_object → derive_flow
REQ-DDB-WIKI-042inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → _ears_notes
REQ-DDB-WIKI-043inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _propose_modes
REQ-DDB-WIKI-045inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → symbol_pages → _section → _activity
REQ-DDB-WIKI-046inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → architecture_page
REQ-DDB-WIKI-047inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → _actor_of
REQ-DDB-WIKI-048inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → write_quick_views
REQ-DDB-WIKI-049inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _trace_run → overlay → _step_values
REQ-DDB-WIKI-050inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → flow_page
REQ-DDB-WIKI-051inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → sbom_page
REQ-DDB-WIKI-052inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → tests_index
REQ-DDB-WIKI-053inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _site → build_wiki → _build_site → api_pages
REQ-DDB-WIKI-054inferredtest_the_trace_cli_reads_imports_from_the_config → wiki_main → _trace → requirement_evidence → _tier → all
Source · 19 lines
def test_the_trace_cli_reads_imports_from_the_config(
    traced: Path, tmp_path: Path, capsys: pytest.CaptureFixture[str]
) -> None:
    """@brief `clew wiki trace --config FILE` applies the section's imports."""
    from clew.wiki.command import wiki_main

    (tmp_path / "r.tap").write_text("ok 1 - Store loads\n")
    (tmp_path / "map.yaml").write_text("R-B: [Store loads]\n")
    cfg = tmp_path / "wiki.yaml"
    cfg.write_text(
        "tests:\n  results: [{format: tap, path: r.tap}]\n  mapping: map.yaml\n"
        "  layers: {cpp: ['Store *']}\n"
    )
    argv = ["trace", "--index", str(traced), "--repo-root", str(tmp_path), "--config", str(cfg)]
    assert wiki_main(argv) == 0
    rows = {r["req_id"]: r for r in json.loads(capsys.readouterr().out)["requirements"]}
    assert rows["R-B"]["tier"] == "PASS" and rows["R-B"]["layers"] == [["cpp", 1]]

Activity · 9 steps
lines 351–351from clew.wiki.command import wiki_mainlines 353–353(tmp_path / "r.tap").write_text("ok 1 - Store loads\n")lines 354–354(tmp_path / "map.yaml").write_text("R-B: [Store loads]\n")lines 355–355cfg = tmp_path / "wiki.yaml"lines 356–359cfg.write_text( "tests:\n results: [{format: tap, path: r.tap}]\n mapping: map.yaml\n" " layers: {cpp: ['Store *']}\n" )lines 360–360argv = ["trace", "--index", str(traced), "--repo-root", str(tmp_path), "--config", str(cfg)]lines 361–361assert wiki_main(argv) == 0lines 362–362rows = {r["req_id"]: r for r in json.loads(capsys.readouterr().out)["requirements"]}lines 363–363assert rows["R-B"]["tier"] == "PASS" and rows["R-B"]["layers"] == [["cpp", 1]]

test_without_layers_the_field_is_absent

None test_wiki_imports.test_without_layers_the_field_is_absent(Path traced)

No layers configured → `layers is None`, not ().

tests/test_wiki_imports.py:318

Checks

  • assert row.layers is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_without_layers_the_field_is_absent → requirement_evidence → connect
REQ-DDB-QUERY-003measuredtest_without_layers_the_field_is_absent → requirement_evidence → _implementer_spans → table_exists
REQ-DDB-WIKI-002measuredtest_without_layers_the_field_is_absent → requirement_evidence
REQ-DDB-WIKI-009catalog
REQ-DDB-WIKI-010measured
REQ-DDB-WIKI-016measured
REQ-DDB-WIKI-017measured
REQ-DDB-WIKI-054inferredtest_without_layers_the_field_is_absent → requirement_evidence → _tier → all
Source · 6 lines
def test_without_layers_the_field_is_absent(traced: Path) -> None:
    """@brief No layers configured → `layers is None`, not ()."""
    row = next(r for r in requirement_evidence(traced, junit=[]) if r.req_id == "R-A")
    assert row.layers is None

Activity · 2 steps
lines 320–320row = next(r for r in requirement_evidence(traced, junit=[]) if r.req_id == "R-A")lines 321–321assert row.layers is None