test_incremental_splice_matches_a_full_rebuild

Tests › tests/integration/test_doxygen_splice.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE LOAD-BEARING CONTROL for task #483.

Given

  1. root = tmp_path / "repo"
  2. shutil.copytree(FIXTURE, root)
7 more
  1. (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", )
  2. (root / "vendor").mkdir(parents=True, exist_ok=True)
  3. (root / "vendor" / "third_party.c").write_text( "int vendored_helper(void) { return 7; }\n", encoding="utf-8" )
  4. doxyfile = _doxyfile(root, tmp_path / "Doxyfile")
  5. master = _run(doxyfile, tmp_path / "master", root)
  6. master_kept = tmp_path / "master-kept.db"
  7. shutil.copy2(master, master_kept)
→

When

  1. changed = set(in_doxygen_scope(sorted(_make_edit(root)), doxyfile, True))
  2. truth = _run(doxyfile, tmp_path / "truth", root)
  3. truth_kept = tmp_path / "truth-kept.db"
16 more
  1. shutil.copy2(truth, truth_kept)
  2. subset = sorted(xref_closure(master_kept, changed, root))
  3. list(root.rglob("*.c"))
  4. list(root.rglob("*.h"))
  5. subset_db = _run(doxyfile, tmp_path / "subset", root, subset=subset)
  6. extra = include_expansion(subset_db, master_kept, changed, set(subset), root)
  7. if extra: subset = sorted(set(subset) | extra) subset_db = _run(doxyfile, tmp_path / "subset2", root, subset=subset)
  8. spliced = tmp_path / "spliced.db"
  9. report = splice_doxygen(master_kept, subset_db, changed, spliced, root)
  10. got = _snapshot(spliced, root)
  11. want = _snapshot(truth_kept, root)
  12. 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" )
  13. 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" )
  14. added = [m for m in got["members"] if m[1] == "splice_probe_added"]
  15. probe = ("splice_probe_added", "sound_play_findme")
  16. 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

  1. ✓ changed is at most set(subset)
  2. ✓ len(subset) is less than len(list(root.rglob("*.c"))) + len(list(root.rglob("*.h")))
  3. ✓ report.skipped is false
  4. ✓ report.files_replaced is at least 2
  5. ✓ report.members_inserted is greater than 0
  6. ✓ report.relations_dropped equals 0
  7. ✓ report.compounds_inserted is greater than 0
  8. ✓ added holds
  9. ✓ any("vendor/" in f for f in want["indexed"]) is false
  10. ✓ want["named_edges"] contains probe
  11. ✓ got["named_edges"] contains probe

tests/integration/test_doxygen_splice.py:292 · its file's page

What it checks (14)

  1. assert changed <= set(subset), "the closure must contain the changed set itself" observes in_doxygen_scope via changed
  2. assert 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" ) observes list
  3. assert not report.skipped, f"splice skipped files: {report.skipped}" observes splice_doxygen via report
  4. assert report.files_replaced >= 2 observes splice_doxygen via report
  5. assert report.members_inserted > 0, "no members inserted — the splice did nothing" observes splice_doxygen via report
  6. assert 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" ) observes splice_doxygen via report
  7. assert 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" ) observes splice_doxygen via report
  8. 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" ) observes _snapshot via want
  9. 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" ) observes _snapshot via want
  10. assert added, "the edit's new function is absent from the spliced database" not attributed
  11. assert 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 _snapshot via want
  12. assert 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 _snapshot via want
  13. assert 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 _snapshot via got
  14. 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]}" ) observes include_expansion via extra

Where the product reaches it

  • main → _run (flow)
  • dossier → subject_payload → _flatten_subject → list (flow)

Call flow

test_incremental_splice_matches_a_full_rebuild→_doxyfile→_run→in_doxygen_scope→_make_edit→xref_closure→list→include_expansion→splice_doxygen→_snapshot

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_incremental_splice_matches_a_full_rebuild · 14 checks_runrun_doxygendoxygen_supports_sqlite3REQ-DDB-CLI-002 · inferredin_doxygen_scopeeffective_file_patternsREQ-DDB-CONFIG-001 · measuredin_doxygen_scopeeffective_file_patternsREQ-DDB-INDEX-001 · measuredin_doxygen_scopeREQ-DDB-INDEX-002 · measured_runrun_doxygen_build_doxyfile_contentextra_input_clears_excludeREQ-DDB-PIPE-003 · measured_runrun_doxygenclean_subprocess_envREQ-DDB-PIPE-006 · measured
Also reaches 6 requirements

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