test_incremental_splice_matches_a_full_rebuild¶
Tests › tests/integration/test_doxygen_splice.py
What this test is for
Why it exists
THE LOAD-BEARING CONTROL for task #483.
Given
root = tmp_path / "repo"shutil.copytree(FIXTURE, root)
7 more
(root / "src" / "shapes.cpp").write_text( "struct Base { virtual int area() const; virtual ~Base() {} };\n" "struct Derived : Base { int area() const override; };\n" "int Base::area() const { return 0; }\n" "int Derived::area() const { return 1; }\n", encoding="utf-8", )(root / "vendor").mkdir(parents=True, exist_ok=True)(root / "vendor" / "third_party.c").write_text( "int vendored_helper(void) { return 7; }\n", encoding="utf-8" )doxyfile = _doxyfile(root, tmp_path / "Doxyfile")master = _run(doxyfile, tmp_path / "master", root)master_kept = tmp_path / "master-kept.db"shutil.copy2(master, master_kept)
When
changed = set(in_doxygen_scope(sorted(_make_edit(root)), doxyfile, True))truth = _run(doxyfile, tmp_path / "truth", root)truth_kept = tmp_path / "truth-kept.db"
16 more
shutil.copy2(truth, truth_kept)subset = sorted(xref_closure(master_kept, changed, root))list(root.rglob("*.c"))list(root.rglob("*.h"))subset_db = _run(doxyfile, tmp_path / "subset", root, subset=subset)extra = include_expansion(subset_db, master_kept, changed, set(subset), root)if extra: subset = sorted(set(subset) | extra) subset_db = _run(doxyfile, tmp_path / "subset2", root, subset=subset)spliced = tmp_path / "spliced.db"report = splice_doxygen(master_kept, subset_db, changed, spliced, root)got = _snapshot(spliced, root)want = _snapshot(truth_kept, root)for layer in ("params", "reimplements", "compoundref", "includes"): assert want[layer], ( f"the rebuild produced NO {layer} rows, so comparing that table is vacuous and " f"the splice could drop it undetected — the fixture needs to populate it" )for layer in ("reimplements", "compoundref"): assert any("Extra" in ref for row in want[layer] for ref in row), ( f"no {layer} row involves the class the edit added, so that table is compared but " f"never exercised by the splice's delete path — two mutation controls passed " f"against exactly that shape" )added = [m for m in got["members"] if m[1] == "splice_probe_added"]probe = ("splice_probe_added", "sound_play_findme")for layer in ( "members", "compounds", "edges", "relations", "params", "reimplements", "compoundref", "includes", "named_edges", "indexed", ): missing = want[layer] - got[layer] extra = got[layer] - want[layer] assert not missing and not extra, ( f"{layer}: splice and rebuild disagree.\n" f" missing from splice ({len(missing)}): {sorted(missing)[:8]}\n" f" only in splice ({len(extra)}): {sorted(extra)[:8]}" )
Then
- ✓ changed is at most set(subset)
- ✓ len(subset) is less than len(list(root.rglob("*.c"))) + len(list(root.rglob("*.h")))
- ✓ report.skipped is false
- ✓ report.files_replaced is at least 2
- ✓ report.members_inserted is greater than 0
- ✓ report.relations_dropped equals 0
- ✓ report.compounds_inserted is greater than 0
- ✓ added holds
- ✓ any("vendor/" in f for f in want["indexed"]) is false
- ✓ want["named_edges"] contains probe
- ✓ got["named_edges"] contains probe
tests/integration/test_doxygen_splice.py:292 · its file's page
What it checks (14)
assert changed <= set(subset), "the closure must contain the changed set itself"observesin_doxygen_scopeviachangedassert len(subset) < len(list(root.rglob("*.c"))) + len(list(root.rglob("*.h"))), ( "the closure expanded to the whole tree, so this test would pass without " "exercising any subsetting at all" )observeslistassert not report.skipped, f"splice skipped files: {report.skipped}"observessplice_doxygenviareportassert report.files_replaced >= 2observessplice_doxygenviareportassert report.members_inserted > 0, "no members inserted — the splice did nothing"observessplice_doxygenviareportassert report.relations_dropped == 0, ( "a relation endpoint was missing from the working copy, which means the closure did " "not bring in a compound the subset needed" )observessplice_doxygenviareportassert report.compounds_inserted > 0, ( "no compounddefs inserted while some were deleted — every class, struct and " "file-compound in the changed file would be silently lost" )observessplice_doxygenviareportassert want[layer], ( f"the rebuild produced NO {layer} rows, so comparing that table is vacuous and " f"the splice could drop it undetected — the fixture needs to populate it" )observes_snapshotviawantassert any("Extra" in ref for row in want[layer] for ref in row), ( f"no {layer} row involves the class the edit added, so that table is compared but " f"never exercised by the splice's delete path — two mutation controls passed " f"against exactly that shape" )observes_snapshotviawantassert added, "the edit's new function is absent from the spliced database"not attributedassert not any("vendor/" in f for f in want["indexed"]), ( f"the full rebuild indexed the excluded vendor/ tree, so EXCLUDE_PATTERNS is not " f"taking effect and this test cannot see a scope widening: " f"{sorted(f for f in want['indexed'] if 'vendor' in f)}" )observes_snapshotviawantassert probe in want["named_edges"], ( f"the rebuild produced no {probe[0]} -> {probe[1]} edge, so this test cannot see " f"whether the splice preserves a NEWLY-ADDED cross-file call at all" )observes_snapshotviawantassert probe in got["named_edges"], ( f"the splice lost the new cross-file edge {probe[0]} -> {probe[1]}. The outbound " f"closure is computed from the PRE-EDIT master, where this call did not exist, so " f"{probe[1]}'s file never joined the subset and doxygen could not resolve the name" )observes_snapshotviagotassert not missing and not extra, ( f"{layer}: splice and rebuild disagree.\n" f" missing from splice ({len(missing)}): {sorted(missing)[:8]}\n" f" only in splice ({len(extra)}): {sorted(extra)[:8]}" )observesinclude_expansionviaextra
Where the product reaches it
Call flow
test_incremental_splice_matches_a_full_rebuild→_doxyfile→_run→in_doxygen_scope→_make_edit→xref_closure→list→include_expansion→splice_doxygen→_snapshotWhat 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 6 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CLI-002 inferred
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-INDEX-001 measured
- REQ-DDB-INDEX-002 measured
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-006 measured