test_splice_inheritance.py¶
tests/integration/test_splice_inheritance.py
An edited base class keeps the classes that derive from it in OTHER files (entropic, 2.0.0).
test_a_refresh_under_strip_from_path_keeps_inheritance
None test_splice_inheritance.test_a_refresh_under_strip_from_path_keeps_inheritance(Path tmp_path)
Edit, refresh and revert under STRIP_FROM_PATH equal fresh builds.
tests/integration/test_splice_inheritance.py:134
Checks
assert ("compoundref", "Base>Derived") in want, f"vacuous: {want}"assert _inheritance(_pipeline(root, live)) == _inheritance(_pipeline(root, fresh)), "edit"assert _inheritance(_pipeline(root, live)) == want, "revert"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CLI-001 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → report_stats |
| REQ-DDB-CLI-002 | inferred | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → _doxygen_or_partial → _doxygen_stage → _run_doxygen_from_args → run_doxygen → doxygen_supports_sqlite3 |
| REQ-DDB-CONFIG-001 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → git_argv |
| REQ-DDB-CONFIG-003 | inferred | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml → _is_flat_req_list |
| REQ-DDB-CONFIG-004 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_preprocessor |
| REQ-DDB-CONFIG-005 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig |
| REQ-DDB-CONFIG-006 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _recorded_entry_patterns → recorded_explicit |
| REQ-DDB-CONFIG-007 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature |
| REQ-DDB-CONFIG-009 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _apply_toolchain_exclusions → load_toolchain_config |
| REQ-DDB-GUARD-012 | inferred | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → load_guard_config → read_guard_config → read_requirements_section |
| REQ-DDB-GUARD-019 | inferred | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → parse_doxygen_tags |
| REQ-DDB-GUARD-024 | inferred | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → apply_autobrief |
| REQ-DDB-INDEX-001 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _verify_extra_input_is_read → effective_file_patterns |
| REQ-DDB-INDEX-002 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → build_lock |
| REQ-DDB-INDEX-003 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → report_index_coverage |
| REQ-DDB-INDEX-004 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → recover_ast_symbols |
| REQ-DDB-INDEX-005 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → stamp_external_provenance |
| REQ-DDB-INDEX-006 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → record_code_text → code_text_rows |
| REQ-DDB-INDEX-007 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → record_owners |
| REQ-DDB-INDEX-008 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_licenses |
| REQ-DDB-INDEX-009 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc |
| REQ-DDB-INDEX-010 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_ast_includes |
| REQ-DDB-INDEX-011 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_property_keys |
| REQ-DDB-MCP-001 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _operator_excludes → meta_section |
| REQ-DDB-MCP-004 | measured | |
| REQ-DDB-PIPE-001 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_database |
| REQ-DDB-PIPE-003 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → build_call_edges |
| REQ-DDB-PIPE-004 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → python_entry_seeds |
| REQ-DDB-PIPE-005 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature |
| REQ-DDB-PIPE-006 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → run_rustdoc → _require_nightly_rustdoc → clean_subprocess_env |
| REQ-DDB-PIPE-007 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig_gates |
| REQ-DDB-PIPE-008 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs |
| REQ-DDB-PIPE-009 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → prune_dominated_fuzzy_call_edges |
| REQ-DDB-PIPE-010 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _build_inferred_edges |
| REQ-DDB-PIPE-011 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_ast_includes → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → build_harvest_plan → js_symbol_harvester |
| REQ-DDB-PIPE-013 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings |
| REQ-DDB-PIPE-014 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc → within_repo |
| REQ-DDB-PIPE-015 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_config_defaults |
| REQ-DDB-QUERY-003 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → mark_test_scope |
| REQ-DDB-QUERY-011 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads → _ensure_threads_tables |
| REQ-DDB-SCHEMA-001 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads |
| REQ-DDB-SCHEMA-002 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _writer_dispatch_map |
| REQ-DDB-SCHEMA-003 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest |
| REQ-DDB-SCHEMA-005 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_key_alias_prefixes |
| REQ-DDB-SCHEMA-006 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml |
| REQ-DDB-SCHEMA-007 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-009 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_event_edges |
| REQ-DDB-SCHEMA-011 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → extract_context_conflicts |
| REQ-DDB-SCHEMA-012 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest → declaration_origin |
| REQ-DDB-SCHEMA-013 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → import_data_model_keys |
| REQ-DDB-SCHEMA-014 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs → ensure_file_docs_table |
| REQ-DDB-SCHEMA-015 | measured | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml |
| REQ-DDB-WIKI-054 | inferred | test_a_refresh_under_strip_from_path_keeps_inheritance → _pipeline → _run_pipeline → _run_pipeline_inner → _build_stages → recover_ast_symbols → _recover_into → all |
Source · 53 lines
def test_a_refresh_under_strip_from_path_keeps_inheritance(tmp_path: Path) -> None:
"""ENTROPIC'S RERUN OF 314e4696 (7ea9724): through the real pipeline a doc-only edit to
adapter_base.h still took compoundref 133 -> 125 and reimplements 248 -> 221, and reverting it
left 128 / 228. entropic's Doxyfile declares `STRIP_FROM_PATH = include src`, so the cached
master spells `include/x/base.h` as `x/base.h`; `_incremental_plan` ran `xref_closure` on that
RAW master, where no row can match the changed file — the closure was the changed file alone,
for xrefs too. The two-header test above has no stripping and could not see it.
@brief Edit, refresh and revert under STRIP_FROM_PATH equal fresh builds.
"""
root = tmp_path / "repo"
(root / "include" / "x").mkdir(parents=True)
(root / "src" / "x").mkdir(parents=True)
(root / "include" / "x" / "base.h").write_text(
"/** @brief A base. */\nstruct Base {\n /** @brief Area. */\n virtual int area() const;\n"
" virtual ~Base() {}\n};\n",
encoding="utf-8",
)
(root / "src" / "x" / "derived.h").write_text(
'#include "x/base.h"\n/** @brief A derived. */\nstruct Derived : Base {\n'
" /** @brief Area. */\n int area() const override;\n};\n",
encoding="utf-8",
)
(root / "Doxyfile").write_text(
"PROJECT_NAME = strip\nINPUT = include src\nRECURSIVE = YES\nEXTRACT_ALL = YES\n"
"FULL_PATH_NAMES = YES\nSTRIP_FROM_PATH = include src\nSTRIP_FROM_INC_PATH = include\n",
encoding="utf-8",
)
import subprocess
from clew.gitenv import git_argv
subprocess.run(git_argv("init", "-q"), cwd=root, check=True)
subprocess.run(git_argv("add", "-A"), cwd=root, check=True)
subprocess.run(
git_argv("-c", "user.email=t@t", "-c", "user.name=t", "commit", "-qm", "base"),
cwd=root,
check=True,
)
live = tmp_path / "live" / "clew.db"
live.parent.mkdir()
want = _inheritance(_pipeline(root, live))
assert ("compoundref", "Base>Derived") in want, f"vacuous: {want}"
base = root / "include" / "x" / "base.h"
original = base.read_text(encoding="utf-8")
base.write_text(original.replace("A base.", "A base, reworded."), encoding="utf-8")
fresh = tmp_path / "fresh" / "clew.db"
fresh.parent.mkdir()
assert _inheritance(_pipeline(root, live)) == _inheritance(_pipeline(root, fresh)), "edit"
base.write_text(original, encoding="utf-8")
assert _inheritance(_pipeline(root, live)) == want, "revert"1 more lines, not shown
Activity · 23 steps
test_editing_a_base_class_keeps_its_derived_classes_in_other_files
None test_splice_inheritance.test_editing_a_base_class_keeps_its_derived_classes_in_other_files(Path tmp_path)
Cross-file inheritance survives a splice of the base's file.
tests/integration/test_splice_inheritance.py:70
Called by none
Calls _inheritance, _run, include_expansion, splice_doxygen, xref_closure
Checks
assert ("compoundref", "Base>Derived") in want, (f"vacuous: the rebuild has no inheritance {want}" )assert ("reimplements", "Derived::area>Base::area") in want, f"vacuous: no override {want}"assert not report.skipped, report.skippedassert _inheritance(spliced) == want, (f"subset {subset}: the splice lost cross-file inheritance — missing " f"{sorted(want - _inheritance(spliced))}" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CLI-002 | inferred | test_editing_a_base_class_keeps_its_derived_classes_in_other_files → _run → run_doxygen → doxygen_supports_sqlite3 |
| REQ-DDB-INDEX-001 | measured | test_editing_a_base_class_keeps_its_derived_classes_in_other_files → _run → run_doxygen |
| REQ-DDB-INDEX-002 | measured | test_editing_a_base_class_keeps_its_derived_classes_in_other_files → splice_doxygen |
| REQ-DDB-PIPE-003 | measured | test_editing_a_base_class_keeps_its_derived_classes_in_other_files → _run → run_doxygen → _build_doxyfile_content → extra_input_clears_exclude |
| REQ-DDB-PIPE-006 | measured | test_editing_a_base_class_keeps_its_derived_classes_in_other_files → _run → run_doxygen → clean_subprocess_env |
Source · 56 lines
def test_editing_a_base_class_keeps_its_derived_classes_in_other_files(tmp_path: Path) -> None:
"""THE BASE'S FILE IS THE ONLY CHANGE, and the derived class's file has no call into it — the
shape of entropic's adapters. A full rebuild is the ground truth.
@brief Cross-file inheritance survives a splice of the base's file.
"""
root = tmp_path / "repo"
(root / "include").mkdir(parents=True)
(root / "include" / "base.h").write_text(
"/** @brief A base. */\nstruct Base {\n /** @brief Area. */\n virtual int area() const;\n"
" virtual ~Base() {}\n};\n",
encoding="utf-8",
)
(root / "include" / "derived.h").write_text(
'#include "base.h"\n/** @brief A derived. */\nstruct Derived : Base {\n'
" /** @brief Area. */\n int area() const override;\n};\n",
encoding="utf-8",
)
doxyfile = tmp_path / "Doxyfile"
doxyfile.write_text(
f"PROJECT_NAME = inh\nINPUT = {root}\nGENERATE_SQLITE3 = YES\nEXTRACT_ALL = YES\n"
"REFERENCED_BY_RELATION = YES\nREFERENCES_RELATION = YES\n",
encoding="utf-8",
)
master = tmp_path / "master-kept.db"
shutil.copy2(_run(doxyfile, tmp_path / "master", root), master)
## A DOC-ONLY EDIT TO THE BASE, as 7ea9724 was.
base = root / "include" / "base.h"
base.write_text(base.read_text().replace("A base.", "A base, reworded."), encoding="utf-8")
changed = {"include/base.h"}
truth = tmp_path / "truth-kept.db"
shutil.copy2(_run(doxyfile, tmp_path / "truth", root), truth)
want = _inheritance(truth)
assert ("compoundref", "Base>Derived") in want, (
f"vacuous: the rebuild has no inheritance {want}"
)
assert ("reimplements", "Derived::area>Base::area") in want, f"vacuous: no override {want}"
subset = sorted(xref_closure(master, changed, root))
subset_db = _run(doxyfile, tmp_path / "subset", root, subset=subset)
extra = include_expansion(subset_db, master, 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, subset_db, changed, spliced, root)
assert not report.skipped, report.skipped
assert _inheritance(spliced) == want, (
f"subset {subset}: the splice lost cross-file inheritance — missing "
f"{sorted(want - _inheritance(spliced))}"
)