test_dispatch.py¶
tests/test_dispatch.py
Layer 6: the declared indirect-dispatch recovery (tasks #60 / #30 / #35 / #37).
test_a_declared_alias_prefix_does_not_displace_the_ingot_default
None test_dispatch.test_a_declared_alias_prefix_does_not_displace_the_ingot_default(Path tmp_path)
REWRITTEN FOR gh#319, and the old contract is the point of the rewrite.
Called by none
Calls _key_edges, _wrapper_db, _wrapper_manifest, import_shared_key_edges_inferred, shared_key_document
Checks
assert _key_edges(db) == [(1, 2, "WIDGET_ENABLED")]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-006 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred → shared_key_harvester → resolve_shared_key_patterns |
| REQ-DDB-CONFIG-007 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred → _log_undeclared_accessor_hint → detect_undeclared_accessor_families |
| REQ-DDB-INDEX-002 | inferred | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred → shared_key_harvester → _inferred_cache_key → manifest_key → hash_file |
| REQ-DDB-PIPE-003 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest |
| REQ-DDB-PIPE-010 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred → _build_inferred_edges |
| REQ-DDB-PIPE-011 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-SCHEMA-002 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred → _writer_dispatch_map |
| REQ-DDB-SCHEMA-004 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → shared_key_document |
| REQ-DDB-SCHEMA-005 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred |
| REQ-DDB-SCHEMA-007 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → import_shared_key_edges_inferred → _ensure_shared_key_edges_table |
| REQ-DDB-SCHEMA-012 | measured | test_a_declared_alias_prefix_does_not_displace_the_ingot_default → _wrapper_manifest → load_dispatch_manifest → declaration_origin |
Source · 27 lines
def test_a_declared_alias_prefix_does_not_displace_the_ingot_default(tmp_path: Path) -> None:
"""REWRITTEN FOR gh#319, and the old contract is the point of the rewrite.
This test used to be `..._replace_the_builtin_default` and asserted `[]` — that
declaring `EXAMPLE_KEY_` KILLED the `DM_KEY_` normalization, so the write half
became an orphan and no edge formed. It pinned as intended behaviour the one
constant the gh#319 audit found combining wrongly.
`DEFAULT_KEY_ALIAS_PREFIXES` is a TIER-4 known-ecosystem signature — the ingot
generator's own enum prefix, not a guess about anyone's naming — so it
accumulates and a declaration adds to it. That also makes it consistent with
the writers and readers from the SAME generator, which have always accumulated.
`DM_KEY_WIDGET_ENABLED` and `EXAMPLE_KEY_` are INVENTED. Provenance for an
identifier in a public test is not decidable by reading it — a name lifted from
a closed repo looks exactly like a name someone made up, which is why this
project audits SHAPES rather than keeping a list of strings it must hide. The
fixture only needs a prefix that is not the default.
"""
db = _wrapper_db(tmp_path)
import_shared_key_edges_inferred(
db, tmp_path, None, None, shared_key_document(_wrapper_manifest(["EXAMPLE_KEY_"]))
)
assert _key_edges(db) == [(1, 2, "WIDGET_ENABLED")]
Activity · 3 steps
test_a_declared_alias_prefix_still_normalizes_its_own_spelling
None test_dispatch.test_a_declared_alias_prefix_still_normalizes_its_own_spelling(Path tmp_path)
THE OTHER HALF, without which the test above passes on a build that ignores the declaration entirely.
Called by none
Calls _key_edges, _wrapper_manifest, import_shared_key_edges_inferred, shared_key_document
Checks
assert _key_edges(db) == [(1, 2, "WIDGET_ENABLED")]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-006 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred → shared_key_harvester → resolve_shared_key_patterns |
| REQ-DDB-CONFIG-007 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred → _log_undeclared_accessor_hint → detect_undeclared_accessor_families |
| REQ-DDB-INDEX-002 | inferred | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred → shared_key_harvester → _inferred_cache_key → manifest_key → hash_file |
| REQ-DDB-PIPE-003 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest |
| REQ-DDB-PIPE-010 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred → _build_inferred_edges |
| REQ-DDB-PIPE-011 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-SCHEMA-002 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred → _writer_dispatch_map |
| REQ-DDB-SCHEMA-004 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → shared_key_document |
| REQ-DDB-SCHEMA-005 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred |
| REQ-DDB-SCHEMA-007 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → import_shared_key_edges_inferred → _ensure_shared_key_edges_table |
| REQ-DDB-SCHEMA-012 | measured | test_a_declared_alias_prefix_still_normalizes_its_own_spelling → _wrapper_manifest → load_dispatch_manifest → declaration_origin |
Source · 28 lines
def test_a_declared_alias_prefix_still_normalizes_its_own_spelling(tmp_path: Path) -> None:
"""THE OTHER HALF, without which the test above passes on a build that ignores
the declaration entirely.
"The default survived" and "the declaration was honoured" are two claims, and
accumulation is only demonstrated by both. Same fixture with the site keyed on
`EXAMPLE_KEY_WIDGET_ENABLED` instead.
"""
(tmp_path / "src").mkdir()
(tmp_path / "src" / "dm.c").write_text(
_WRAPPER_SRC.replace("DM_KEY_WIDGET_ENABLED", "EXAMPLE_KEY_WIDGET_ENABLED"),
encoding="utf-8",
)
db = _make_db(
tmp_path,
[
(1, "report_stall_state", "void report_stall_state(int v)", 1, 3),
(2, "read_widget_enabled", "int read_widget_enabled(void)", 5, 7),
],
rel_path="src/dm.c",
)
import_shared_key_edges_inferred(
db, tmp_path, None, None, shared_key_document(_wrapper_manifest(["EXAMPLE_KEY_"]))
)
assert _key_edges(db) == [(1, 2, "WIDGET_ENABLED")]
Activity · 5 steps
test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site
None test_dispatch.test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site(Path tmp_path)
The weakest-link rule governs synthetic CALL edges, not boundaries, and the asymmetry is deliberate. A boundary records the AUTHOR's claim that calls to this interface leave the repo — that claim does not become less true because one particular call site was resolved fuzzily, so `_boundary_rows` ignores incoming confidence while `_crossed_edges` respects it.
Called by none
Calls _boundaries, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert _boundaries(db), "the declared boundary must survive a fuzzy call site"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | inferred | test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 22 lines
def test_a_declared_boundary_is_recorded_even_from_a_fuzzy_call_site(tmp_path: Path) -> None:
"""The weakest-link rule governs synthetic CALL edges, not boundaries, and the
asymmetry is deliberate. A boundary records the AUTHOR's claim that calls to
this interface leave the repo — that claim does not become less true because
one particular call site was resolved fuzzily, so `_boundary_rows` ignores
incoming confidence while `_crossed_edges` respects it."""
db = _make_db(
tmp_path,
_IFACE_FUNCTIONS,
compounds=_IFACE_COMPOUNDS,
reimplements=[(11, 10)],
call_edges=[(12, 10)],
call_confidence=CALL_MATCH_FUZZY,
)
manifest = load_dispatch_manifest(
{"interfaces": [{"interface": "ILinkPort", "binds": "SerialLinkPort", "boundary": True}]}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
assert _boundaries(db), "the declared boundary must survive a fuzzy call site"
Activity · 4 steps
test_a_manifest_file_that_is_not_a_mapping_refuses_the_build
None test_dispatch.test_a_manifest_file_that_is_not_a_mapping_refuses_the_build(Path tmp_path)
A YAML list (or scalar) where a mapping belongs is refused.
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-SCHEMA-004 | measured | test_a_manifest_file_that_is_not_a_mapping_refuses_the_build → load_dispatch_manifest |
| REQ-DDB-SCHEMA-012 | inferred | test_a_manifest_file_that_is_not_a_mapping_refuses_the_build → load_dispatch_manifest → declaration_origin |
Source · 6 lines
def test_a_manifest_file_that_is_not_a_mapping_refuses_the_build(tmp_path: Path) -> None:
"""@brief A YAML list (or scalar) where a mapping belongs is refused."""
path = tmp_path / "dispatch.yaml"
path.write_text("- interface: ILinkPort\n", encoding="utf-8")
with pytest.raises(DeclarationError, match="must contain a mapping"):
load_dispatch_manifest(path)1 more lines, not shown
Activity · 4 steps
test_a_missing_required_endpoint_refuses_the_build
None test_dispatch.test_a_missing_required_endpoint_refuses_the_build()
There is no honest default for "which interface" or "which dispatcher" — inventing one binds a call graph the author never described. And an `interfaces:` entry with neither `binds` nor `boundary: true` asks for nothing, which is far more likely a half-finished edit than an intent.
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-SCHEMA-004 | measured | test_a_missing_required_endpoint_refuses_the_build → load_dispatch_manifest |
| REQ-DDB-SCHEMA-012 | measured | test_a_missing_required_endpoint_refuses_the_build → load_dispatch_manifest → declaration_origin |
Source · 15 lines
def test_a_missing_required_endpoint_refuses_the_build() -> None:
"""There is no honest default for "which interface" or "which dispatcher" —
inventing one binds a call graph the author never described. And an
`interfaces:` entry with neither `binds` nor `boundary: true` asks for
nothing, which is far more likely a half-finished edit than an intent."""
with pytest.raises(DeclarationError, match="interface"):
load_dispatch_manifest({"interfaces": [{"binds": "C"}]})
with pytest.raises(DeclarationError, match="would do nothing"):
load_dispatch_manifest({"interfaces": [{"interface": "I"}]})
with pytest.raises(DeclarationError, match="dispatch_via"):
load_dispatch_manifest({"dispatch_tables": [{"register_via": "r"}]})
with pytest.raises(DeclarationError, match="pattern"):
load_dispatch_manifest({"shared_key_wrappers": [{"direction": "write"}]})
Activity · 8 steps
test_a_misspelled_entry_field_refuses_the_build
None test_dispatch.test_a_misspelled_entry_field_refuses_the_build()
One level down, and worse than "declared nothing": `key_arg_idx` silently defaults the key to argument 0, so a typo does not produce NO dataflow, it produces the WRONG dataflow — a specific, real claim invented from a slip.
Checks
assert "'key_arg_idx'" in str(exc.value)assert "key_arg_index" in str(exc.value)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-SCHEMA-004 | measured | test_a_misspelled_entry_field_refuses_the_build → load_dispatch_manifest |
| REQ-DDB-SCHEMA-012 | measured | test_a_misspelled_entry_field_refuses_the_build → load_dispatch_manifest → declaration_origin |
Source · 16 lines
def test_a_misspelled_entry_field_refuses_the_build() -> None:
"""One level down, and worse than "declared nothing": `key_arg_idx` silently
defaults the key to argument 0, so a typo does not produce NO dataflow, it
produces the WRONG dataflow — a specific, real claim invented from a slip."""
with pytest.raises(DeclarationError) as exc:
load_dispatch_manifest({"shared_key_wrappers": [{"pattern": "w", "key_arg_idx": 2}]})
assert "'key_arg_idx'" in str(exc.value)
assert "key_arg_index" in str(exc.value)
with pytest.raises(DeclarationError):
load_dispatch_manifest({"interfaces": [{"interface": "I", "bind": "C"}]})
with pytest.raises(DeclarationError):
load_dispatch_manifest(
{"dispatch_tables": [{"register_via": "r", "dispatch_via": "d", "handler": 0}]}
)
Activity · 8 steps
test_a_misspelled_section_refuses_the_build
None test_dispatch.test_a_misspelled_section_refuses_the_build(Path tmp_path)
The hole in the fail-closed promise, closed. An ABSENT section reads as "declared nothing", so every plausible singular/plural slip — `interface:`, `dispatch_table:`, `shared_key_wrapper:` — used to parse to an empty manifest and build GREEN while the author's declaration did nothing, which is indistinguishable from a repo that never declared anything.
Checks
assert repr(typo) in messageassert "interfaces" in message, "the error must name the allowed sections"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-SCHEMA-004 | measured | test_a_misspelled_section_refuses_the_build → load_dispatch_manifest |
| REQ-DDB-SCHEMA-012 | measured | test_a_misspelled_section_refuses_the_build → load_dispatch_manifest → declaration_origin |
Source · 14 lines
def test_a_misspelled_section_refuses_the_build(tmp_path: Path) -> None:
"""The hole in the fail-closed promise, closed. An ABSENT section reads as
"declared nothing", so every plausible singular/plural slip —
`interface:`, `dispatch_table:`, `shared_key_wrapper:` — used to parse to an
empty manifest and build GREEN while the author's declaration did nothing,
which is indistinguishable from a repo that never declared anything."""
for typo in ("interface", "dispatch_table", "shared_key_wrapper", "interfacs"):
with pytest.raises(DeclarationError) as exc:
load_dispatch_manifest({typo: [{"interface": "I", "boundary": True}]})
message = str(exc.value)
assert repr(typo) in message
assert "interfaces" in message, "the error must name the allowed sections"
Activity · 6 steps
test_a_section_that_is_not_a_list_of_mappings_refuses_the_build
None test_dispatch.test_a_section_that_is_not_a_list_of_mappings_refuses_the_build()
A section present but mis-SHAPED is a typo, not a declaration. Degrading it to "declared nothing" leaves the author with a green build and the gap they were closing still open.
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-SCHEMA-004 | measured | test_a_section_that_is_not_a_list_of_mappings_refuses_the_build → load_dispatch_manifest |
| REQ-DDB-SCHEMA-012 | measured | test_a_section_that_is_not_a_list_of_mappings_refuses_the_build → load_dispatch_manifest → declaration_origin |
Source · 9 lines
def test_a_section_that_is_not_a_list_of_mappings_refuses_the_build() -> None:
"""A section present but mis-SHAPED is a typo, not a declaration. Degrading it
to "declared nothing" leaves the author with a green build and the gap they
were closing still open."""
for bad in ("ILinkPort", {"interface": "I"}, ["ILinkPort"], [None]):
with pytest.raises(DeclarationError, match="must be a list of mappings"):
load_dispatch_manifest({"interfaces": bad})
Activity · 3 steps
test_a_typod_direction_refuses_instead_of_filing_the_opposite_role
None test_dispatch.test_a_typod_direction_refuses_instead_of_filing_the_opposite_role()
A `direction` of 'wrtie' normalized to a reader would invert the dataflow the entry exists to reveal, and the build would still succeed. The message names the origin, the token and the full allowed set.
Checks
assert ".clew.yaml [dispatch]" in messageassert "'wrtie'" in messageassert "write, read" in message
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-SCHEMA-004 | measured | test_a_typod_direction_refuses_instead_of_filing_the_opposite_role → load_dispatch_manifest |
| REQ-DDB-SCHEMA-012 | measured | test_a_typod_direction_refuses_instead_of_filing_the_opposite_role → load_dispatch_manifest → declaration_origin |
Source · 12 lines
def test_a_typod_direction_refuses_instead_of_filing_the_opposite_role() -> None:
"""A `direction` of 'wrtie' normalized to a reader would invert the dataflow
the entry exists to reveal, and the build would still succeed. The message
names the origin, the token and the full allowed set."""
with pytest.raises(DeclarationError) as exc:
load_dispatch_manifest({"shared_key_wrappers": [{"pattern": "w", "direction": "wrtie"}]})
message = str(exc.value)
assert ".clew.yaml [dispatch]" in message
assert "'wrtie'" in message
assert "write, read" in message
Activity · 6 steps
test_ambiguous_handler_name_records_NOTHING_rather_than_guessing
None test_dispatch.test_ambiguous_handler_name_records_NOTHING_rather_than_guessing(Path tmp_path)
gh#347, reaching the DECLARED dispatch layer through the shared resolution helper — and it belongs here as much as in the ast layer. A dispatch manifest declares that a handler is registered; the handler is named at the registration SITE, so when that name matches two indexed functions the declaration has told us a dispatch exists and NOT which target it reaches. Emitting both asserted two dispatches where one was registered.
Called by none
Calls _declared_edges, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert _declared_edges(db) == [], ("two same-named handlers means the target is unknown; one registration must not " "produce two dispatch edges" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_ambiguous_handler_name_records_NOTHING_rather_than_guessing → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | measured | test_ambiguous_handler_name_records_NOTHING_rather_than_guessing → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_ambiguous_handler_name_records_NOTHING_rather_than_guessing → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_ambiguous_handler_name_records_NOTHING_rather_than_guessing → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_ambiguous_handler_name_records_NOTHING_rather_than_guessing → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_ambiguous_handler_name_records_NOTHING_rather_than_guessing → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_ambiguous_handler_name_records_NOTHING_rather_than_guessing → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_ambiguous_handler_name_records_NOTHING_rather_than_guessing → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_ambiguous_handler_name_records_NOTHING_rather_than_guessing → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 45 lines
def test_ambiguous_handler_name_records_NOTHING_rather_than_guessing(
tmp_path: Path,
) -> None:
"""gh#347, reaching the DECLARED dispatch layer through the shared resolution helper — and
it belongs here as much as in the ast layer. A dispatch manifest declares that a handler is
registered; the handler is named at the registration SITE, so when that name matches two
indexed functions the declaration has told us a dispatch exists and NOT which target it
reaches. Emitting both asserted two dispatches where one was registered.
THE OLD NAME SAID "degrades to fuzzy", which was a euphemism for "emits all of them".
Its original reasoning is now stronger rather than discarded: it argued that fuzzy edges are
skipped by the reachability BFS and thread membership, "so a guess cannot promote itself
into the liveness answer". Under this rule there is no guess in the table at all, so the
protection no longer depends on every downstream consumer remembering to filter — which is
what `dossier`/`callers` failed to do (gh#26, three of four reported callers fabricated).
WHAT IS DELIBERATELY LOST: a repo with two same-named handlers gets no declared-dispatch
edge for that registration. That is the correct answer to "which one" being unknown, and the
manifest can name the handler unambiguously if the author wants the edge."""
(tmp_path / "src").mkdir()
(tmp_path / "src" / "broker.cpp").write_text(_BROKER_SRC, encoding="utf-8")
duplicated = [
*_BROKER_FUNCTIONS,
(5, "stage_shim", "void other::stage_shim(int key)", 20, 20),
]
db = _make_db(tmp_path, duplicated)
manifest = load_dispatch_manifest(
{
"dispatch_tables": [
{"register_via": "register_dispatcher", "dispatch_via": "Broker::fan"}
]
}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
assert _declared_edges(db) == [], (
"two same-named handlers means the target is unknown; one registration must not "
"produce two dispatch edges"
)
# ─── #37: argument-keyed shared-key wrappers ─────────────────────────────────
Activity · 7 steps
test_ambiguous_or_absent_class_is_skipped_not_guessed
None test_dispatch.test_ambiguous_or_absent_class_is_skipped_not_guessed(Path tmp_path)
Two indexed compounds sharing a tail would have DIFFERENT implementors, so picking one fabricates a call graph; and a declared type that is out of this build's scope (conditional compilation) must not fail a build, because a declaration is a standing statement across configurations.
Called by none
Calls _declared_edges, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert _declared_edges(db) == []assert _declared_edges(db) == []
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_ambiguous_or_absent_class_is_skipped_not_guessed → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | inferred | test_ambiguous_or_absent_class_is_skipped_not_guessed → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_ambiguous_or_absent_class_is_skipped_not_guessed → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_ambiguous_or_absent_class_is_skipped_not_guessed → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_ambiguous_or_absent_class_is_skipped_not_guessed → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_ambiguous_or_absent_class_is_skipped_not_guessed → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_ambiguous_or_absent_class_is_skipped_not_guessed → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_ambiguous_or_absent_class_is_skipped_not_guessed → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_ambiguous_or_absent_class_is_skipped_not_guessed → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 24 lines
def test_ambiguous_or_absent_class_is_skipped_not_guessed(tmp_path: Path) -> None:
"""Two indexed compounds sharing a tail would have DIFFERENT implementors, so
picking one fabricates a call graph; and a declared type that is out of this
build's scope (conditional compilation) must not fail a build, because a
declaration is a standing statement across configurations."""
compounds = dict(_IFACE_COMPOUNDS)
compounds["other::ILinkPort"] = []
db = _make_db(tmp_path, _IFACE_FUNCTIONS, compounds=compounds, call_edges=[(12, 10)])
ambiguous = load_dispatch_manifest(
{"interfaces": [{"interface": "ILinkPort", "binds": "SerialLinkPort"}]}
)
import_declared_dispatch_edges(db, tmp_path, ambiguous)
assert _declared_edges(db) == []
absent = load_dispatch_manifest(
{"interfaces": [{"interface": "INotIndexed", "binds": "AlsoAbsent"}]}
)
import_declared_dispatch_edges(db, tmp_path, absent)
assert _declared_edges(db) == []
# ─── #30: dispatch tables ────────────────────────────────────────────────────
Activity · 9 steps
test_an_undeclared_alias_spelling_is_not_normalized
None test_dispatch.test_an_undeclared_alias_spelling_is_not_normalized(Path tmp_path)
THE NEGATIVE CONTROL for the pair above: without the declaration the `EXAMPLE_KEY_` site is NOT stripped, so the write half keys on `EXAMPLE_KEY_WIDGET_ENABLED`, never meets the reader's `WIDGET_ENABLED`, and no edge forms. Without this, the previous test could be passing because some other mechanism strips unknown prefixes.
Called by none
Calls _key_edges, _wrapper_manifest, import_shared_key_edges_inferred, shared_key_document
Checks
assert _key_edges(db) == []
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-006 | measured | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred → shared_key_harvester → resolve_shared_key_patterns |
| REQ-DDB-CONFIG-007 | measured | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred → _log_undeclared_accessor_hint → detect_undeclared_accessor_families |
| REQ-DDB-INDEX-002 | inferred | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred → shared_key_harvester → _inferred_cache_key → manifest_key → hash_file |
| REQ-DDB-PIPE-003 | measured | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest |
| REQ-DDB-PIPE-010 | measured | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred → _build_inferred_edges |
| REQ-DDB-PIPE-011 | measured | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-SCHEMA-002 | measured | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred → _writer_dispatch_map |
| REQ-DDB-SCHEMA-004 | measured | test_an_undeclared_alias_spelling_is_not_normalized → shared_key_document |
| REQ-DDB-SCHEMA-005 | measured | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred |
| REQ-DDB-SCHEMA-007 | measured | test_an_undeclared_alias_spelling_is_not_normalized → import_shared_key_edges_inferred → _ensure_shared_key_edges_table |
| REQ-DDB-SCHEMA-012 | measured | test_an_undeclared_alias_spelling_is_not_normalized → _wrapper_manifest → load_dispatch_manifest → declaration_origin |
Source · 30 lines
def test_an_undeclared_alias_spelling_is_not_normalized(tmp_path: Path) -> None:
"""THE NEGATIVE CONTROL for the pair above: without the declaration the
`EXAMPLE_KEY_` site is NOT stripped, so the write half keys on
`EXAMPLE_KEY_WIDGET_ENABLED`, never meets the reader's `WIDGET_ENABLED`, and no
edge forms. Without this, the previous test could be passing because some other
mechanism strips unknown prefixes.
"""
(tmp_path / "src").mkdir()
(tmp_path / "src" / "dm.c").write_text(
_WRAPPER_SRC.replace("DM_KEY_WIDGET_ENABLED", "EXAMPLE_KEY_WIDGET_ENABLED"),
encoding="utf-8",
)
db = _make_db(
tmp_path,
[
(1, "report_stall_state", "void report_stall_state(int v)", 1, 3),
(2, "read_widget_enabled", "int read_widget_enabled(void)", 5, 7),
],
rel_path="src/dm.c",
)
import_shared_key_edges_inferred(
db, tmp_path, None, None, shared_key_document(_wrapper_manifest())
)
assert _key_edges(db) == []
# ─── fail closed ─────────────────────────────────────────────────────────────
Activity · 5 steps
test_boundary_flag_records_the_second_terminus_kind
None test_dispatch.test_boundary_flag_records_the_second_terminus_kind(Path tmp_path)
`external_boundaries` recorded exactly ONE shape — a function pointer forwarded to an out-of-repo registrar — which is why an interface-HAL C++ codebase measured zero termini with the detector working correctly. `boundary: true` records the other shape: a virtual call whose implementor lives outside the index, which only the author can assert.
Called by none
Calls _boundaries, _declared_edges, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert _boundaries(db) == [assert _declared_edges(db) == []
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_boundary_flag_records_the_second_terminus_kind → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | inferred | test_boundary_flag_records_the_second_terminus_kind → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_boundary_flag_records_the_second_terminus_kind → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_boundary_flag_records_the_second_terminus_kind → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_boundary_flag_records_the_second_terminus_kind → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_boundary_flag_records_the_second_terminus_kind → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_boundary_flag_records_the_second_terminus_kind → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_boundary_flag_records_the_second_terminus_kind → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_boundary_flag_records_the_second_terminus_kind → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 25 lines
def test_boundary_flag_records_the_second_terminus_kind(tmp_path: Path) -> None:
"""`external_boundaries` recorded exactly ONE shape — a function pointer
forwarded to an out-of-repo registrar — which is why an interface-HAL C++ codebase
measured zero termini with the detector working correctly. `boundary: true`
records the other shape: a virtual call whose implementor lives outside the
index, which only the author can assert."""
db = _make_db(tmp_path, _IFACE_FUNCTIONS, compounds=_IFACE_COMPOUNDS, call_edges=[(12, 10)])
manifest = load_dispatch_manifest(
{"interfaces": [{"interface": "ILinkPort", "boundary": True}]}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
assert _boundaries(db) == [
(
12,
"ILinkPort::transmit",
BOUNDARY_KIND_INTERFACE,
CALL_SOURCE_DECLARED_DISPATCH,
BOUNDARY_STRENGTH_HIGH,
)
]
# A boundary-only entry declares no implementor, so it must add no call edge.
assert _declared_edges(db) == []
Activity · 5 steps
test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers
None test_dispatch.test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers(Path tmp_path)
Called by none
Calls _declared_edges, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert (3, 2, CALL_MATCH_RESOLVED) in _declared_edges(db)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | measured | test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 30 lines
def test_declared_dispatch_table_connects_the_dispatcher_to_its_handlers(
tmp_path: Path,
) -> None:
"""#30's shape, which Layer 4 structurally cannot reach: Layer 4 keys on a
`GLOBAL = PARAM;` assignment, while a container-held pointer is registered by
a METHOD CALL whose callee is a `field_expression` and whose argument is a
`pointer_expression`. Declaring `register_via` + `dispatch_via` names both
endpoints an edge needs, and the harvested registration site supplies the
handler."""
(tmp_path / "src").mkdir()
(tmp_path / "src" / "broker.cpp").write_text(_BROKER_SRC, encoding="utf-8")
db = _make_db(tmp_path, _BROKER_FUNCTIONS)
manifest = load_dispatch_manifest(
{
"dispatch_tables": [
{
"register_via": "register_dispatcher",
"handler_arg_index": 0,
"dispatch_via": "Broker::fan",
}
]
}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
# `Broker::fan` (rowid 3) now reaches `stage_shim` (rowid 2), so the
# membership and reachability BFS can flow across the seam.
assert (3, 2, CALL_MATCH_RESOLVED) in _declared_edges(db)
Activity · 6 steps
test_declared_interface_binding_continues_the_chain_to_the_implementor
None test_dispatch.test_declared_interface_binding_continues_the_chain_to_the_implementor(Path tmp_path)
The whole point of #35. A virtual call DOES land on the interface method — it just stops there, so `StageDriver::emit_setpoint` reads as a zero-callee leaf even though its body crosses the HAL. Declaring the binding adds the sibling edge to the concrete override, and it carries the `declared_dispatch` provenance so a consumer can always ask whether the edge would exist without the manifest.
Called by none
Calls _declared_edges, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert _declared_edges(db) == [(12, 11, CALL_MATCH_RESOLVED)]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_declared_interface_binding_continues_the_chain_to_the_implementor → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | inferred | test_declared_interface_binding_continues_the_chain_to_the_implementor → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_declared_interface_binding_continues_the_chain_to_the_implementor → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_declared_interface_binding_continues_the_chain_to_the_implementor → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_declared_interface_binding_continues_the_chain_to_the_implementor → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_declared_interface_binding_continues_the_chain_to_the_implementor → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_declared_interface_binding_continues_the_chain_to_the_implementor → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_declared_interface_binding_continues_the_chain_to_the_implementor → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_declared_interface_binding_continues_the_chain_to_the_implementor → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 24 lines
def test_declared_interface_binding_continues_the_chain_to_the_implementor(
tmp_path: Path,
) -> None:
"""The whole point of #35. A virtual call DOES land on the interface method —
it just stops there, so `StageDriver::emit_setpoint` reads as a zero-callee
leaf even though its body crosses the HAL. Declaring the binding adds the
sibling edge to the concrete override, and it carries the `declared_dispatch`
provenance so a consumer can always ask whether the edge would exist without
the manifest."""
db = _make_db(
tmp_path,
_IFACE_FUNCTIONS,
compounds=_IFACE_COMPOUNDS,
reimplements=[(11, 10)],
call_edges=[(12, 10)],
)
manifest = load_dispatch_manifest(
{"interfaces": [{"interface": "ILinkPort", "binds": "SerialLinkPort"}]}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
assert _declared_edges(db) == [(12, 11, CALL_MATCH_RESOLVED)]
Activity · 4 steps
test_declared_key_wrapper_produces_the_dataflow_edge
None test_dispatch.test_declared_key_wrapper_produces_the_dataflow_edge(Path tmp_path)
Called by none
Calls _key_edges, _wrapper_db, import_shared_key_edges_inferred, load_dispatch_manifest, shared_key_document
Checks
assert _key_edges(db) == [(1, 2, "WIDGET_ENABLED")]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-006 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred → shared_key_harvester → resolve_shared_key_patterns |
| REQ-DDB-CONFIG-007 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred → _log_undeclared_accessor_hint → detect_undeclared_accessor_families |
| REQ-DDB-INDEX-002 | inferred | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred → shared_key_harvester → _inferred_cache_key → manifest_key → hash_file |
| REQ-DDB-PIPE-003 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest |
| REQ-DDB-PIPE-010 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred → _build_inferred_edges |
| REQ-DDB-PIPE-011 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-SCHEMA-002 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred → _writer_dispatch_map |
| REQ-DDB-SCHEMA-004 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → load_dispatch_manifest |
| REQ-DDB-SCHEMA-005 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred |
| REQ-DDB-SCHEMA-007 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → import_shared_key_edges_inferred → _ensure_shared_key_edges_table |
| REQ-DDB-SCHEMA-012 | measured | test_declared_key_wrapper_produces_the_dataflow_edge → load_dispatch_manifest → declaration_origin |
Source · 20 lines
def test_declared_key_wrapper_produces_the_dataflow_edge(tmp_path: Path) -> None:
"""#37 end to end. The write half's key is an ARGUMENT to a generic helper and
the read half's is embedded in the accessor NAME, so neither the literal nor
the name-embedded inference joins them. Declaring the wrapper feeds the SAME
Layer 5a matcher through `extra`, and the `DM_KEY_` alias normalization is
what makes the two spellings of one key meet — without it the declaration
yields an orphan write-half and no edge at all."""
db = _wrapper_db(tmp_path)
manifest = load_dispatch_manifest(
{
"shared_key_wrappers": [
{"pattern": "store_bool_on_delta", "key_arg_index": 0, "direction": "write"}
]
}
)
import_shared_key_edges_inferred(db, tmp_path, None, None, shared_key_document(manifest))
assert _key_edges(db) == [(1, 2, "WIDGET_ENABLED")]
Activity · 4 steps
test_declared_wrapper_direction_selects_the_matcher_list
None test_dispatch.test_declared_wrapper_direction_selects_the_matcher_list(Path tmp_path)
`direction` picks WHICH accessor list the wrapper joins. Filed as a READER, the same helper produces a read half with no write half to meet — so a typo'd direction would invert the dataflow the entry exists to reveal, which is exactly why the value is vocabulary-validated rather than defaulted.
Called by none
Calls _key_edges, _wrapper_db, import_shared_key_edges_inferred, load_dispatch_manifest, shared_key_document
Checks
assert _key_edges(db) == []
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-006 | measured | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred → shared_key_harvester → resolve_shared_key_patterns |
| REQ-DDB-CONFIG-007 | measured | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred → _log_undeclared_accessor_hint → detect_undeclared_accessor_families |
| REQ-DDB-INDEX-002 | inferred | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred → shared_key_harvester → _inferred_cache_key → manifest_key → hash_file |
| REQ-DDB-PIPE-003 | measured | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest |
| REQ-DDB-PIPE-010 | measured | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred → _build_inferred_edges |
| REQ-DDB-PIPE-011 | measured | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-SCHEMA-002 | measured | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred → _writer_dispatch_map |
| REQ-DDB-SCHEMA-004 | measured | test_declared_wrapper_direction_selects_the_matcher_list → load_dispatch_manifest |
| REQ-DDB-SCHEMA-005 | measured | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred |
| REQ-DDB-SCHEMA-007 | measured | test_declared_wrapper_direction_selects_the_matcher_list → import_shared_key_edges_inferred → _ensure_shared_key_edges_table |
| REQ-DDB-SCHEMA-012 | measured | test_declared_wrapper_direction_selects_the_matcher_list → load_dispatch_manifest → declaration_origin |
Source · 18 lines
def test_declared_wrapper_direction_selects_the_matcher_list(tmp_path: Path) -> None:
"""`direction` picks WHICH accessor list the wrapper joins. Filed as a READER,
the same helper produces a read half with no write half to meet — so a typo'd
direction would invert the dataflow the entry exists to reveal, which is
exactly why the value is vocabulary-validated rather than defaulted."""
db = _wrapper_db(tmp_path)
manifest = load_dispatch_manifest(
{
"shared_key_wrappers": [
{"pattern": "store_bool_on_delta", "key_arg_index": 0, "direction": "read"}
]
}
)
import_shared_key_edges_inferred(db, tmp_path, None, None, shared_key_document(manifest))
assert _key_edges(db) == []
Activity · 4 steps
test_inherited_members_do_not_pair_the_interface_with_itself
None test_dispatch.test_inherited_members_do_not_pair_the_interface_with_itself(Path tmp_path)
doxygen lists a base class's members under the DERIVED compound too, with the BASE's rowids — so pairing on membership alone emits `ILinkPort::~ILinkPort -> ILinkPort::~ILinkPort`. The `definition` boundary filter is what keeps a compound's OWNED members only, and without it a declaration fabricates self-recursion on every inherited member.
Called by none
Calls _declared_edges, all, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert (13, 13, CALL_MATCH_RESOLVED) not in edgesassert all(caller != callee for caller, callee, _ in edges)assert (12, 11, CALL_MATCH_RESOLVED) in edges
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_inherited_members_do_not_pair_the_interface_with_itself → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | inferred | test_inherited_members_do_not_pair_the_interface_with_itself → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_inherited_members_do_not_pair_the_interface_with_itself → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_inherited_members_do_not_pair_the_interface_with_itself → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_inherited_members_do_not_pair_the_interface_with_itself → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_inherited_members_do_not_pair_the_interface_with_itself → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_inherited_members_do_not_pair_the_interface_with_itself → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_inherited_members_do_not_pair_the_interface_with_itself → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_inherited_members_do_not_pair_the_interface_with_itself → all |
Source · 27 lines
def test_inherited_members_do_not_pair_the_interface_with_itself(tmp_path: Path) -> None:
"""doxygen lists a base class's members under the DERIVED compound too, with
the BASE's rowids — so pairing on membership alone emits
`ILinkPort::~ILinkPort -> ILinkPort::~ILinkPort`. The `definition`
boundary filter is what keeps a compound's OWNED members only, and without it
a declaration fabricates self-recursion on every inherited member."""
db = _make_db(
tmp_path,
_IFACE_FUNCTIONS,
compounds=_IFACE_COMPOUNDS,
# No reimplements rows: force the same-name fallback, which is the path
# that can see the inherited destructor as its own override.
call_edges=[(12, 10), (12, 13)],
)
manifest = load_dispatch_manifest(
{"interfaces": [{"interface": "ILinkPort", "binds": "SerialLinkPort"}]}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
edges = _declared_edges(db)
assert (13, 13, CALL_MATCH_RESOLVED) not in edges
assert all(caller != callee for caller, callee, _ in edges)
# The same-name fallback still recovers the real override without doxygen's
# reimplements relation (older doxygen, and C struct-of-fnptr "interfaces").
assert (12, 11, CALL_MATCH_RESOLVED) in edges
Activity · 7 steps
test_method_filter_narrows_the_binding
None test_dispatch.test_method_filter_narrows_the_binding(Path tmp_path)
`methods:` restricts an entry to the named methods. A HAL interface whose implementor also overrides lifecycle members should be bindable on the one method that is the seam.
Called by none
Calls _declared_edges, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert _declared_edges(db) == [(12, 11, CALL_MATCH_RESOLVED)]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_method_filter_narrows_the_binding → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | inferred | test_method_filter_narrows_the_binding → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_method_filter_narrows_the_binding → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_method_filter_narrows_the_binding → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_method_filter_narrows_the_binding → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_method_filter_narrows_the_binding → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_method_filter_narrows_the_binding → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_method_filter_narrows_the_binding → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_method_filter_narrows_the_binding → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 26 lines
def test_method_filter_narrows_the_binding(tmp_path: Path) -> None:
"""`methods:` restricts an entry to the named methods. A HAL interface whose
implementor also overrides lifecycle members should be bindable on the one
method that is the seam."""
db = _make_db(
tmp_path,
_IFACE_FUNCTIONS,
compounds=_IFACE_COMPOUNDS,
call_edges=[(12, 10), (12, 13)],
)
manifest = load_dispatch_manifest(
{
"interfaces": [
{
"interface": "ILinkPort",
"binds": "SerialLinkPort",
"methods": ["transmit"],
}
]
}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
assert _declared_edges(db) == [(12, 11, CALL_MATCH_RESOLVED)]
Activity · 4 steps
test_no_declaration_writes_nothing_at_all
None test_dispatch.test_no_declaration_writes_nothing_at_all(Path tmp_path)
The state every repo is in today. An undeclared repo has no indirection convention clew may assume, so zero synthetic rows is a correct negative — and every existing build must keep reproducing it exactly.
Called by none
Calls _boundaries, _declared_edges, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert manifest.is_empty()assert _declared_edges(db) == []assert _boundaries(db) == []
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_no_declaration_writes_nothing_at_all → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | inferred | test_no_declaration_writes_nothing_at_all → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_no_declaration_writes_nothing_at_all → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | inferred | test_no_declaration_writes_nothing_at_all → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | inferred | test_no_declaration_writes_nothing_at_all → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_no_declaration_writes_nothing_at_all → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | inferred | test_no_declaration_writes_nothing_at_all → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_no_declaration_writes_nothing_at_all → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_no_declaration_writes_nothing_at_all → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 15 lines
def test_no_declaration_writes_nothing_at_all(tmp_path: Path) -> None:
"""The state every repo is in today. An undeclared repo has no indirection
convention clew may assume, so zero synthetic rows is a correct negative —
and every existing build must keep reproducing it exactly."""
db = _make_db(tmp_path, _IFACE_FUNCTIONS, compounds=_IFACE_COMPOUNDS, call_edges=[(12, 10)])
manifest = load_dispatch_manifest(None)
assert manifest.is_empty()
import_declared_dispatch_edges(db, tmp_path, manifest)
assert _declared_edges(db) == []
# Not even the terminus table is created: the stage returns before touching
# the database at all.
assert _boundaries(db) == []
Activity · 6 steps
test_registration_site_is_harvested_but_is_not_itself_a_call_edge
None test_dispatch.test_registration_site_is_harvested_but_is_not_itself_a_call_edge(Path tmp_path)
`wire_up` STORES the handler; it does not invoke it. The registration site is what tells the stage which handler the table holds, but synthesizing `wire_up -> stage_shim` would assert a call that never happens, and an invented call edge is worse than a missing one — it feeds the same liveness and chain-trace surfaces a real edge does. Only the declared DISPATCHER gets the edge.
Called by none
Calls _declared_edges, all, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert edges == [(3, 2, CALL_MATCH_RESOLVED)]assert all(caller != 4 for caller, _callee, _conf in edges), ("the registrar's enclosing function must not be given a synthetic call edge" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_registration_site_is_harvested_but_is_not_itself_a_call_edge → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | measured | test_registration_site_is_harvested_but_is_not_itself_a_call_edge → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_registration_site_is_harvested_but_is_not_itself_a_call_edge → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_registration_site_is_harvested_but_is_not_itself_a_call_edge → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_registration_site_is_harvested_but_is_not_itself_a_call_edge → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_registration_site_is_harvested_but_is_not_itself_a_call_edge → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_registration_site_is_harvested_but_is_not_itself_a_call_edge → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_registration_site_is_harvested_but_is_not_itself_a_call_edge → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_registration_site_is_harvested_but_is_not_itself_a_call_edge → all |
Source · 28 lines
def test_registration_site_is_harvested_but_is_not_itself_a_call_edge(
tmp_path: Path,
) -> None:
"""`wire_up` STORES the handler; it does not invoke it. The registration site
is what tells the stage which handler the table holds, but synthesizing
`wire_up -> stage_shim` would assert a call that never happens, and
an invented call edge is worse than a missing one — it feeds the same
liveness and chain-trace surfaces a real edge does. Only the declared
DISPATCHER gets the edge."""
(tmp_path / "src").mkdir()
(tmp_path / "src" / "broker.cpp").write_text(_BROKER_SRC, encoding="utf-8")
db = _make_db(tmp_path, _BROKER_FUNCTIONS)
manifest = load_dispatch_manifest(
{
"dispatch_tables": [
{"register_via": "register_dispatcher", "dispatch_via": "Broker::fan"}
]
}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
edges = _declared_edges(db)
assert edges == [(3, 2, CALL_MATCH_RESOLVED)]
assert all(caller != 4 for caller, _callee, _conf in edges), (
"the registrar's enclosing function must not be given a synthetic call edge"
)
Activity · 8 steps
test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise
None test_dispatch.test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise(Path tmp_path)
A synthetic edge must never be more confident than the edge it was derived FROM. The premise here is a fuzzy incoming call: "a function of this name calls this interface method, though its class was never confirmed" (#48's `ast_member` case, which is mostly fuzzy by construction).
Called by none
Calls _declared_edges, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert _declared_edges(db) == [(12, 11, CALL_MATCH_FUZZY)]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | inferred | test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 35 lines
def test_synthetic_edge_inherits_the_weakest_link_from_a_fuzzy_premise(
tmp_path: Path,
) -> None:
"""A synthetic edge must never be more confident than the edge it was derived
FROM. The premise here is a fuzzy incoming call: "a function of this name
calls this interface method, though its class was never confirmed" (#48's
`ast_member` case, which is mostly fuzzy by construction).
The binding itself is unambiguous — exactly one override — so before the
weakest-link rule this produced `resolved`, a high-confidence conclusion drawn
from a low-confidence premise. That matters beyond provenance: BOTH the
reachability BFS and thread membership traverse `resolved` and SKIP `fuzzy`,
so an unverified premise would have propagated through the entire liveness
graph as fact.
Same fixture and same manifest as
`test_declared_interface_binding_continues_the_chain_to_the_implementor`,
which yields RESOLVED — the confidence of the incoming edge is the only
difference between the two."""
db = _make_db(
tmp_path,
_IFACE_FUNCTIONS,
compounds=_IFACE_COMPOUNDS,
reimplements=[(11, 10)],
call_edges=[(12, 10)],
call_confidence=CALL_MATCH_FUZZY,
)
manifest = load_dispatch_manifest(
{"interfaces": [{"interface": "ILinkPort", "binds": "SerialLinkPort"}]}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
assert _declared_edges(db) == [(12, 11, CALL_MATCH_FUZZY)]
Activity · 4 steps
test_the_declaration_route_reaches_the_stage_and_the_flag_wins
None test_dispatch.test_the_declaration_route_reaches_the_stage_and_the_flag_wins(Path tmp_path)
The reason a `dispatch:` section exists at all. The MCP server passes NO manifest arguments — the repo root is the only route it needs — so a convention reachable solely by CLI flag is invisible on the primary surface and the built-in defaults become the whole policy, which is precisely the hardcoded-only assumption the no-hardcoding mandate forbids. Discovery from the repo root is what closes that, and an explicit flag still wins because the file is a standing statement while the flag is a deliberate one-off.
Checks
assert SECTION_DISPATCH in declassert [b.interface for b in from_declaration.interfaces] == ["FromDeclaration"]assert [b.interface for b in from_flag.interfaces] == ["FromFlag"]assert load_dispatch_manifest(_declared_or_flag(None, {}, SECTION_DISPATCH)).is_empty()
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_the_declaration_route_reaches_the_stage_and_the_flag_wins → load_declaration |
| REQ-DDB-GUARD-012 | inferred | test_the_declaration_route_reaches_the_stage_and_the_flag_wins → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node |
| REQ-DDB-SCHEMA-004 | measured | test_the_declaration_route_reaches_the_stage_and_the_flag_wins → load_dispatch_manifest |
| REQ-DDB-SCHEMA-012 | measured | test_the_declaration_route_reaches_the_stage_and_the_flag_wins → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_the_declaration_route_reaches_the_stage_and_the_flag_wins → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_list_section → all |
Source · 29 lines
def test_the_declaration_route_reaches_the_stage_and_the_flag_wins(tmp_path: Path) -> None:
"""The reason a `dispatch:` section exists at all. The MCP server passes NO
manifest arguments — the repo root is the only route it needs — so a convention
reachable solely by CLI flag is invisible on the primary surface and the
built-in defaults become the whole policy, which is precisely the
hardcoded-only assumption the no-hardcoding mandate forbids. Discovery from
the repo root is what closes that, and an explicit flag still wins because the
file is a standing statement while the flag is a deliberate one-off."""
(tmp_path / DECLARATION_NAME).write_text(
"dispatch:\n interfaces:\n - interface: FromDeclaration\n boundary: true\n",
encoding="utf-8",
)
decl = load_declaration(tmp_path)
assert SECTION_DISPATCH in decl
from_declaration = load_dispatch_manifest(_declared_or_flag(None, decl, SECTION_DISPATCH))
assert [b.interface for b in from_declaration.interfaces] == ["FromDeclaration"]
override = tmp_path / "override.yaml"
override.write_text(
"interfaces:\n - interface: FromFlag\n boundary: true\n", encoding="utf-8"
)
from_flag = load_dispatch_manifest(_declared_or_flag(str(override), decl, SECTION_DISPATCH))
assert [b.interface for b in from_flag.interfaces] == ["FromFlag"]
# A repo declaring nothing reaches the stage with an empty manifest, not None.
assert load_dispatch_manifest(_declared_or_flag(None, {}, SECTION_DISPATCH)).is_empty()
Activity · 10 steps
test_the_dispatch_manifest_participates_in_the_stage_cache_key
None test_dispatch.test_the_dispatch_manifest_participates_in_the_stage_cache_key(Path tmp_path)
The declaration decides what the per-file registration harvest MATCHES, so editing it has to re-harvest. A manifest that did not reach the cache key would leave a stale payload in place and the edit would appear to do nothing — the same class of silent failure as a dropped declaration.
Called by none
Calls _inferred_cache_key, load_dispatch_manifest, manifest_key, shared_key_document
Checks
assert manifest_key(shared_key_document(one)) != manifest_key(shared_key_document(two))assert _inferred_cache_key(None, None) == DEFAULT_SHARED_KEY_PATTERNS_VERSIONassert _inferred_cache_key(None, shared_key_document(one)) != _inferred_cache_key(None, None)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-002 | inferred | test_the_dispatch_manifest_participates_in_the_stage_cache_key → manifest_key → hash_file |
| REQ-DDB-PIPE-003 | measured | test_the_dispatch_manifest_participates_in_the_stage_cache_key → manifest_key |
| REQ-DDB-SCHEMA-004 | measured | test_the_dispatch_manifest_participates_in_the_stage_cache_key → load_dispatch_manifest |
| REQ-DDB-SCHEMA-012 | measured | test_the_dispatch_manifest_participates_in_the_stage_cache_key → load_dispatch_manifest → declaration_origin |
Source · 14 lines
def test_the_dispatch_manifest_participates_in_the_stage_cache_key(tmp_path: Path) -> None:
"""The declaration decides what the per-file registration harvest MATCHES, so
editing it has to re-harvest. A manifest that did not reach the cache key
would leave a stale payload in place and the edit would appear to do nothing —
the same class of silent failure as a dropped declaration."""
one = load_dispatch_manifest({"shared_key_wrappers": [{"pattern": "a", "key_arg_index": 0}]})
two = load_dispatch_manifest({"shared_key_wrappers": [{"pattern": "a", "key_arg_index": 1}]})
assert manifest_key(shared_key_document(one)) != manifest_key(shared_key_document(two))
# An undeclared build must keep the exact key it had before this parameter
# existed, so no existing cache is invalidated by the merge point alone.
assert _inferred_cache_key(None, None) == DEFAULT_SHARED_KEY_PATTERNS_VERSION
assert _inferred_cache_key(None, shared_key_document(one)) != _inferred_cache_key(None, None)
Activity · 5 steps
test_unresolvable_dispatch_via_leaves_the_handlers_unconnected
None test_dispatch.test_unresolvable_dispatch_via_leaves_the_handlers_unconnected(Path tmp_path)
A `dispatch_via` that resolves to no unique indexed function fails CLOSED: the handlers stay unconnected rather than being attributed to some other function, because attributing a whole dispatched sub-graph to the wrong caller is the one error here that is indistinguishable from a real graph.
Called by none
Calls _declared_edges, import_declared_dispatch_edges, load_dispatch_manifest
Checks
assert _declared_edges(db) == []
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-003 | measured | test_unresolvable_dispatch_via_leaves_the_handlers_unconnected → import_declared_dispatch_edges → _harvest_sites → run_harvest |
| REQ-DDB-PIPE-011 | measured | test_unresolvable_dispatch_via_leaves_the_handlers_unconnected → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_unresolvable_dispatch_via_leaves_the_handlers_unconnected → import_declared_dispatch_edges → _harvest_sites → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-003 | measured | test_unresolvable_dispatch_via_leaves_the_handlers_unconnected → import_declared_dispatch_edges → _table_edges → _definition_preferring_name_index |
| REQ-DDB-SCHEMA-003 | measured | test_unresolvable_dispatch_via_leaves_the_handlers_unconnected → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-004 | measured | test_unresolvable_dispatch_via_leaves_the_handlers_unconnected → load_dispatch_manifest |
| REQ-DDB-SCHEMA-007 | measured | test_unresolvable_dispatch_via_leaves_the_handlers_unconnected → import_declared_dispatch_edges → _ensure_external_boundaries_table |
| REQ-DDB-SCHEMA-012 | measured | test_unresolvable_dispatch_via_leaves_the_handlers_unconnected → load_dispatch_manifest → declaration_origin |
| REQ-DDB-WIKI-054 | inferred | test_unresolvable_dispatch_via_leaves_the_handlers_unconnected → import_declared_dispatch_edges → _table_edges → _record_handlers → _ast_record_call_edge → _narrow_by_receiver → _one_class → all |
Source · 20 lines
def test_unresolvable_dispatch_via_leaves_the_handlers_unconnected(tmp_path: Path) -> None:
"""A `dispatch_via` that resolves to no unique indexed function fails CLOSED:
the handlers stay unconnected rather than being attributed to some other
function, because attributing a whole dispatched sub-graph to the wrong
caller is the one error here that is indistinguishable from a real graph."""
(tmp_path / "src").mkdir()
(tmp_path / "src" / "broker.cpp").write_text(_BROKER_SRC, encoding="utf-8")
db = _make_db(tmp_path, _BROKER_FUNCTIONS)
manifest = load_dispatch_manifest(
{
"dispatch_tables": [
{"register_via": "register_dispatcher", "dispatch_via": "Absent::fan"}
]
}
)
import_declared_dispatch_edges(db, tmp_path, manifest)
assert _declared_edges(db) == []
Activity · 6 steps
test_without_the_declaration_the_same_dataflow_is_invisible
None test_dispatch.test_without_the_declaration_the_same_dataflow_is_invisible(Path tmp_path)
The correct negative that makes the previous test mean something: the built-in defaults see the name-embedded READ and nothing at all on the write side, so the key has no dataflow. The declaration is what closes it — not some pre-existing inference that would have fired anyway.
Checks
assert _key_edges(db) == []
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-006 | measured | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → shared_key_harvester → resolve_shared_key_patterns |
| REQ-DDB-CONFIG-007 | measured | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → _log_undeclared_accessor_hint → detect_undeclared_accessor_families |
| REQ-DDB-INDEX-002 | inferred | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → shared_key_harvester → _inferred_cache_key → manifest_key → hash_file |
| REQ-DDB-PIPE-003 | measured | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest |
| REQ-DDB-PIPE-010 | measured | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → _build_inferred_edges |
| REQ-DDB-PIPE-011 | measured | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → _walk_all_files_for_shared_keys → run_harvest → _harvest_one_file → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-SCHEMA-002 | measured | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → _writer_dispatch_map |
| REQ-DDB-SCHEMA-005 | measured | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred |
| REQ-DDB-SCHEMA-007 | measured | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → _ensure_shared_key_edges_table |
| REQ-DDB-SCHEMA-012 | measured | test_without_the_declaration_the_same_dataflow_is_invisible → import_shared_key_edges_inferred → shared_key_harvester → resolve_shared_key_patterns → load_shared_key_patterns → declaration_origin |
Source · 11 lines
def test_without_the_declaration_the_same_dataflow_is_invisible(tmp_path: Path) -> None:
"""The correct negative that makes the previous test mean something: the
built-in defaults see the name-embedded READ and nothing at all on the write
side, so the key has no dataflow. The declaration is what closes it — not some
pre-existing inference that would have fired anyway."""
db = _wrapper_db(tmp_path)
import_shared_key_edges_inferred(db, tmp_path, None, None, None)
assert _key_edges(db) == []