test_dossier_one_shot.py¶
tests/test_dossier_one_shot.py
The one-shot dossier: body, lock panels, and unresolvable callee names.
test_a_clipped_body_says_so_and_still_reports_its_full_extent
None test_dossier_one_shot.test_a_clipped_body_says_so_and_still_reports_its_full_extent(Path rich_db, Path repo_root)
A SILENTLY clipped body is worse than no body: a reader who cannot see that lines were dropped reasons about a function it has only half read, and a body looks like proof. So `truncated` must flip, `end_line` must describe only what arrived, and `total_lines` must still report the whole extent so the reader knows how much is missing and can call `source` for the rest.
tests/test_dossier_one_shot.py:63
Checks
assert d is not None and d.body is not Noneassert len(d.body.lines) == 2assert d.body.truncated is Trueassert d.body.end_line == d.body.start_line + 1assert d.body.total_lines > 2, "the full extent must survive the clip"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_a_clipped_body_says_so_and_still_reports_its_full_extent → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 19 lines
def test_a_clipped_body_says_so_and_still_reports_its_full_extent(
rich_db: Path, repo_root: Path
) -> None:
"""A SILENTLY clipped body is worse than no body: a reader who cannot see that
lines were dropped reasons about a function it has only half read, and a body looks
like proof. So `truncated` must flip, `end_line` must describe only what arrived,
and `total_lines` must still report the whole extent so the reader knows how much
is missing and can call `source` for the rest.
Two lines rather than a boundary value, so the clip is unmistakable.
"""
d = q.function_dossier(rich_db, SETTER, repo_root=repo_root, max_body_lines=2)
assert d is not None and d.body is not None
assert len(d.body.lines) == 2
assert d.body.truncated is True
assert d.body.end_line == d.body.start_line + 1
assert d.body.total_lines > 2, "the full extent must survive the clip"
Activity · 6 steps
test_a_dossier_without_a_working_tree_keeps_every_index_panel
None test_dossier_one_shot.test_a_dossier_without_a_working_tree_keeps_every_index_panel(Path rich_db)
`repo_root` is OPTIONAL and its absence is a supported mode, not a degraded one: the R2 library is used directly by consumers holding only a database file, and a tool set bound without a repo provider is the shape most of this suite uses.
tests/test_dossier_one_shot.py:193
Checks
assert without is not Noneassert without.body is Noneassert without.external_callees == []assert without.sections, "the lock panels come from the index, not the working tree"assert without.callers == q.function_dossier(rich_db, SETTER).callers
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | inferred | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | inferred | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_a_dossier_without_a_working_tree_keeps_every_index_panel → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 17 lines
def test_a_dossier_without_a_working_tree_keeps_every_index_panel(rich_db: Path) -> None:
"""`repo_root` is OPTIONAL and its absence is a supported mode, not a degraded one:
the R2 library is used directly by consumers holding only a database file, and a
tool set bound without a repo provider is the shape most of this suite uses.
So the two panels that read bytes go quiet and NOTHING ELSE CHANGES. Compared
field by field against the full payload rather than spot-checked, so a panel that
silently depended on the working tree fails here.
"""
without = q.function_dossier(rich_db, SETTER)
assert without is not None
assert without.body is None
assert without.external_callees == []
assert without.sections, "the lock panels come from the index, not the working tree"
assert without.callers == q.function_dossier(rich_db, SETTER).callers
Activity · 6 steps
test_an_external_callee_is_never_promoted_to_a_call_edge
None test_dossier_one_shot.test_an_external_callee_is_never_promoted_to_a_call_edge(Path rich_db, Path repo_root)
A synthetic edge inherits the weakest link. `mark_reachability` and the thread BFS both traverse `call_edges`, so inserting a row for a name that resolves to nothing would propagate an unresolvable premise as fact — and worse, this panel is computed at QUERY time, so it would be a query mutating the index it reads.
tests/test_dossier_one_shot.py:134
Checks
assert d is not None and d.external_calleesassert after == before, "the external-callee panel must not write edges"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_an_external_callee_is_never_promoted_to_a_call_edge → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 28 lines
def test_an_external_callee_is_never_promoted_to_a_call_edge(
rich_db: Path, repo_root: Path
) -> None:
"""A synthetic edge inherits the weakest link. `mark_reachability` and the thread
BFS both traverse `call_edges`, so inserting a row for a name that resolves to
nothing would propagate an unresolvable premise as fact — and worse, this panel is
computed at QUERY time, so it would be a query mutating the index it reads.
Pinned by counting `call_edges` before and after the query rather than by reading
the payload: the payload cannot show a write that did not happen.
"""
conn = sqlite3.connect(f"file:{rich_db}?mode=ro", uri=True)
try:
before = conn.execute("SELECT COUNT(*) FROM call_edges").fetchone()[0]
finally:
conn.close()
d = q.function_dossier(rich_db, SETTER, repo_root=repo_root)
assert d is not None and d.external_callees
conn = sqlite3.connect(f"file:{rich_db}?mode=ro", uri=True)
try:
after = conn.execute("SELECT COUNT(*) FROM call_edges").fetchone()[0]
finally:
conn.close()
assert after == before, "the external-callee panel must not write edges"
Activity · 9 steps
test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier
None test_dossier_one_shot.test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier(Path rich_db, Path tmp_path)
The failure mode of a stale registry entry or a moved checkout. `dossier` must degrade to its index-only panels rather than raising, because the identity, the requirements and the call graph are all still true — and because a raise here would make the composite payload fail where the narrow `source` tool merely returns None.
tests/test_dossier_one_shot.py:355
Checks
assert d is not Noneassert d.body is Noneassert d.external_callees == []assert d.sections, "the index panels are unaffected by an unreadable tree"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | inferred | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | inferred | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 15 lines
def test_an_unreadable_working_tree_loses_the_body_and_not_the_dossier(
rich_db: Path, tmp_path: Path
) -> None:
"""The failure mode of a stale registry entry or a moved checkout. `dossier` must
degrade to its index-only panels rather than raising, because the identity, the
requirements and the call graph are all still true — and because a raise here would
make the composite payload fail where the narrow `source` tool merely returns None.
"""
d = q.function_dossier(rich_db, SETTER, repo_root=tmp_path / "no_such_checkout")
assert d is not None
assert d.body is None
assert d.external_callees == []
assert d.sections, "the index panels are unaffected by an unreadable tree"
Activity · 5 steps
test_call_lines_are_reported_in_source_order
None test_dossier_one_shot.test_call_lines_are_reported_in_source_order(Path rich_db, Path repo_root)
The harvester walks the tree with a STACK, so a body's sites arrive in roughly REVERSE source order — the first unfiltered output read `[208, 207, 205, 202, 198, 192]`. Descending line numbers read as corrupt, and worse, the per-name cap would then keep a function's LAST few call sites and drop the first, which is backwards for a panel whose value is "what does this thing do".
tests/test_dossier_one_shot.py:452
Checks
assert d is not None and d.external_calleesassert list(edge.call_lines) == sorted(edge.call_lines), (f"{edge.name} reports {edge.call_lines}, not in source order" )assert firsts == sorted(firsts)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_call_lines_are_reported_in_source_order → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_call_lines_are_reported_in_source_order → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_call_lines_are_reported_in_source_order → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_call_lines_are_reported_in_source_order → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_call_lines_are_reported_in_source_order → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 19 lines
def test_call_lines_are_reported_in_source_order(rich_db: Path, repo_root: Path) -> None:
"""The harvester walks the tree with a STACK, so a body's sites arrive in roughly
REVERSE source order — the first unfiltered output read `[208, 207, 205, 202, 198,
192]`. Descending line numbers read as corrupt, and worse, the per-name cap would
then keep a function's LAST few call sites and drop the first, which is backwards
for a panel whose value is "what does this thing do".
"""
d = q.function_dossier(rich_db, SETTER, repo_root=repo_root)
assert d is not None and d.external_callees
for edge in d.external_callees:
assert list(edge.call_lines) == sorted(edge.call_lines), (
f"{edge.name} reports {edge.call_lines}, not in source order"
)
## And the panel itself is in source order, so the first row is the first thing the
## function calls: mbedtls's wrappers lock before they unlock.
firsts = [e.call_lines[0] for e in d.external_callees]
assert firsts == sorted(firsts)
Activity · 6 steps
test_the_body_clip_does_not_hide_calls_below_the_cut
None test_dossier_one_shot.test_the_body_clip_does_not_hide_calls_below_the_cut(Path rich_db, Path repo_root)
THE ONE WAY THESE TWO PANELS COULD SILENTLY CONTRADICT EACH OTHER.
tests/test_dossier_one_shot.py:82
Checks
assert clipped is not Noneassert {e.name for e in clipped.external_callees} == _expected_externals()
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_the_body_clip_does_not_hide_calls_below_the_cut → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 14 lines
def test_the_body_clip_does_not_hide_calls_below_the_cut(rich_db: Path, repo_root: Path) -> None:
"""THE ONE WAY THESE TWO PANELS COULD SILENTLY CONTRADICT EACH OTHER.
`external_callees` walks the body's RECORDED extent, not the excerpt's clipped one.
Wiring it to the excerpt instead would have made a display cap quietly delete facts
— the panel would report fewer callees the smaller the body window got, with
nothing saying so. `pthread_mutex_unlock` sits several lines below a 2-line cut and
must still be named.
"""
clipped = q.function_dossier(rich_db, SETTER, repo_root=repo_root, max_body_lines=2)
assert clipped is not None
assert {e.name for e in clipped.external_callees} == _expected_externals()
Activity · 3 steps
test_the_dossier_carries_the_function_body_it_describes
None test_dossier_one_shot.test_the_dossier_carries_the_function_body_it_describes(Path rich_db, Path repo_root)
The body is what seven `source` calls were spent on in one graded cell.
tests/test_dossier_one_shot.py:43
Checks
assert d is not Noneassert d.body is not None, "the one-shot body panel is missing"assert d.body.file == d.file, "the body must come from the file the identity names"assert any("pthread_mutex_lock" in line for line in d.body.lines), ("the body panel is not showing this function's actual source" )assert d.body.truncated is Falseassert d.body.end_line - d.body.start_line + 1 == len(d.body.lines)assert d.body.total_lines == len(d.body.lines)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_the_dossier_carries_the_function_body_it_describes → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 20 lines
def test_the_dossier_carries_the_function_body_it_describes(rich_db: Path, repo_root: Path) -> None:
"""The body is what seven `source` calls were spent on in one graded cell.
Asserts a REAL LINE of the fixture's source, not merely that `lines` is non-empty:
a body panel wired to the wrong file, or to the wrong extent, still produces a
plausible-looking list of strings. The line span must also describe exactly what
arrived, because a reader given `start_line` will use it to quote the code.
"""
d = q.function_dossier(rich_db, SETTER, repo_root=repo_root)
assert d is not None
assert d.body is not None, "the one-shot body panel is missing"
assert d.body.file == d.file, "the body must come from the file the identity names"
assert any("pthread_mutex_lock" in line for line in d.body.lines), (
"the body panel is not showing this function's actual source"
)
assert d.body.truncated is False
assert d.body.end_line - d.body.start_line + 1 == len(d.body.lines)
assert d.body.total_lines == len(d.body.lines)
Activity · 8 steps
test_the_dossier_names_the_callees_the_index_cannot_resolve
None test_dossier_one_shot.test_the_dossier_names_the_callees_the_index_cannot_resolve(Path rich_db, Path repo_root)
FINDING 5 on mbedtls, reproduced on the synthetic index. `pthread_mutex_lock` has no memberdef row, so `call_edges` — whose `callee_rowid` is `NOT NULL REFERENCES memberdef(rowid)` — cannot represent the call at all, and the graph is silent about the only thing a mutex wrapper does.
tests/test_dossier_one_shot.py:96
Checks
assert d is not Noneassert named == _expected_externals()assert all(e.call_lines for e in d.external_callees), "each must say where it is called"assert d.body is not Noneassert all(d.body.start_line <= line <= last for line in edge.call_lines), (f"{edge.name} is reported at {edge.call_lines}, outside {d.body.start_line}..{last}" )assert not (named & resolved), "an unresolvable name must never appear as a resolved edge"assert "IntegerStorage_SetUINT8Key" in resolved, ("the resolved edge must survive — the external panel is additive" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_the_dossier_names_the_callees_the_index_cannot_resolve → function_dossier → _dossier_conn → locks_held_for_rowids |
| REQ-DDB-WIKI-054 | inferred | test_the_dossier_names_the_callees_the_index_cannot_resolve → all |
Source · 38 lines
def test_the_dossier_names_the_callees_the_index_cannot_resolve(
rich_db: Path, repo_root: Path
) -> None:
"""FINDING 5 on mbedtls, reproduced on the synthetic index. `pthread_mutex_lock`
has no memberdef row, so `call_edges` — whose `callee_rowid` is
`NOT NULL REFERENCES memberdef(rowid)` — cannot represent the call at all, and the
graph is silent about the only thing a mutex wrapper does.
THREE claims, and the second two are the guard rails:
* the unresolvable names are reported, with the line they are called on;
* they are NOT in `callees`, whose rows are resolved by contract;
* `callees` still carries the call that DID resolve, so the panel is additive
rather than a replacement.
"""
d = q.function_dossier(rich_db, SETTER, repo_root=repo_root)
assert d is not None
named = {e.name for e in d.external_callees}
assert named == _expected_externals()
assert all(e.call_lines for e in d.external_callees), "each must say where it is called"
## BOUNDED BY THIS FUNCTION'S BODY. The walk parses the whole FILE, and the fixture's
## `dm.c` calls the same two primitives from a sibling getter — so an unbounded walk
## would attribute the getter's call lines to this function and read as a wider
## claim than the source supports.
assert d.body is not None
last = d.body.start_line + d.body.total_lines - 1
for edge in d.external_callees:
assert all(d.body.start_line <= line <= last for line in edge.call_lines), (
f"{edge.name} is reported at {edge.call_lines}, outside {d.body.start_line}..{last}"
)
resolved = {c.name for c in d.callees}
assert not (named & resolved), "an unresolvable name must never appear as a resolved edge"
assert "IntegerStorage_SetUINT8Key" in resolved, (
"the resolved edge must survive — the external panel is additive"
)
Activity · 12 steps
test_the_dossier_returns_detail_prose_and_caps_it_loudly
None test_dossier_one_shot.test_the_dossier_returns_detail_prose_and_caps_it_loudly(Path tmp_path)
The @details prose is RETURNED, and a long one says where it stopped.
tests/test_dossier_one_shot.py:474
Checks
assert found is not Noneassert found.brief == "Brief only."assert "MBEDTLS_ALLOW_PRIVATE_ACCESS" in found.detail, ("the detail prose must be RETURNED — it was already being fetched" )assert _capped_detail(short) == short, "a short detail must not be altered at all"assert capped.startswith("y" * _DETAIL_CAP)assert "truncated" in capped and str(_DETAIL_CAP) in capped and str(len(long_text)) in capped, (f"the notice must name the cap AND the true length, got the tail {capped[-120:]!r}" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | inferred | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | inferred | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_the_dossier_returns_detail_prose_and_caps_it_loudly → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 61 lines
def test_the_dossier_returns_detail_prose_and_caps_it_loudly(tmp_path: Path) -> None:
"""FETCHED AND THROWN AWAY, for as long as the dossier has existed. `_identity` has always
selected `detaileddescription` and read only `extract_version` out of it, so a function's
`@details` text was in hand on every call and never returned.
Measured on mbedtls 2026-08-14: the deprecation warning about reaching past
`MBEDTLS_ALLOW_PRIVATE_ACCESS` lives in `mbedtls_ssl_handshake_step`'s detail — two graded Q2
marks turn on it — and the agent reached it by grepping and then READING
`include/mbedtls/ssl.h`, because this reply carried one sentence of `brief`. Verified after
the change: `dossier('mbedtls_ssl_handshake_step').detail` is 1,277 characters and contains
the token.
THE CAP SAYS SO. 4,268 mbedtls rows carry detail averaging 1,052 characters, so the common
case is small and the 14,804-character tail is what the cap is for. A silently truncated
reply reads as a complete one, which is the failure this project keeps paying for — so the
notice names both the cap and the true length.
"""
## The cap and the capper MOVED to `_common` in C1, when the file subject needed the same
## bound on its file-level documentation. Same constant, same notice, one implementation.
from clew.query._common import DETAIL_CAP as _DETAIL_CAP
from clew.query._common import capped_detail as _capped_detail
db = tmp_path / "clew.db"
conn = sqlite3.connect(str(db))
conn.executescript(
"""
CREATE TABLE path (rowid INTEGER PRIMARY KEY, name TEXT);
INSERT INTO path (rowid, name) VALUES (1, 'library/ssl_tls.c');
CREATE TABLE memberdef (
rowid INTEGER PRIMARY KEY, name TEXT, definition TEXT, argsstring TEXT,
file_id INTEGER, bodyfile_id INTEGER, bodystart INTEGER, bodyend INTEGER,
briefdescription TEXT, detaileddescription TEXT, kind TEXT, static INTEGER
);
INSERT INTO memberdef VALUES (
1, 'step', 'int step', '(void)', 1, 1, 10, 20,
'<para>Brief only.</para>',
'<para>Defining MBEDTLS_ALLOW_PRIVATE_ACCESS is deprecated.</para>',
'function', 0
);
"""
)
conn.commit()
conn.close()
found = q.function_dossier(db, "step")
assert found is not None
assert found.brief == "Brief only."
assert "MBEDTLS_ALLOW_PRIVATE_ACCESS" in found.detail, (
"the detail prose must be RETURNED — it was already being fetched"
)
## THE CAP, two-sided: short prose is untouched, long prose is cut AND says so with both
## numbers. A cap that reports nothing is the silent-truncation failure.
short = "x" * (_DETAIL_CAP - 1)
assert _capped_detail(short) == short, "a short detail must not be altered at all"
long_text = "y" * (_DETAIL_CAP + 500)
capped = _capped_detail(long_text)
assert capped.startswith("y" * _DETAIL_CAP)
assert "truncated" in capped and str(_DETAIL_CAP) in capped and str(len(long_text)) in capped, (
f"the notice must name the cap AND the true length, got the tail {capped[-120:]!r}"
)1 more lines, not shown
Activity · 17 steps
test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed
None test_dossier_one_shot.test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed(Path tmp_path)
MEASURED AS NOISE BEFORE IT WAS FILTERED. The unfiltered panel reported `len`, `str`, `max`, `range`, `isinstance`, `get`, `items` and `dumps` for one function of this repo's own code — eight rows, none of them a fact about the codebase, crowding out the kind of row the panel exists for.
tests/test_dossier_one_shot.py:423
Checks
assert py is not Noneassert {e.name for e in py.external_callees} == {"helper"}, ("the Python panel must keep the one unindexed project call and drop the rest" )assert c is not Noneassert {e.name for e in c.external_callees} == {"pow"}
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 29 lines
def test_the_external_panel_reports_signal_and_not_every_token_that_is_unindexed(
tmp_path: Path,
) -> None:
"""MEASURED AS NOISE BEFORE IT WAS FILTERED. The unfiltered panel reported
`len`, `str`, `max`, `range`, `isinstance`, `get`, `items` and `dumps` for one
function of this repo's own code — eight rows, none of them a fact about the
codebase, crowding out the kind of row the panel exists for.
THREE claims, and the third is the one a language-blind filter would break:
* a Python BUILTIN is dropped in a Python file;
* a member TAIL (`rows.append`) is dropped, because resolving it needs the
receiver's declared type and an unresolved tail says nothing;
* the SAME name in a C file is KEPT, because `pow` is also libc and a C caller
of it means it. This is why the builtin filter is gated on the grammar rather
than applied to the name.
"""
db = _noise_db(tmp_path)
py = q.function_dossier(db, "compute", repo_root=tmp_path)
assert py is not None
assert {e.name for e in py.external_callees} == {"helper"}, (
"the Python panel must keep the one unindexed project call and drop the rest"
)
c = q.function_dossier(db, "scale", repo_root=tmp_path)
assert c is not None
assert {e.name for e in c.external_callees} == {"pow"}
Activity · 7 steps
test_the_lock_panels_agree_with_the_tools_they_replace
None test_dossier_one_shot.test_the_lock_panels_agree_with_the_tools_they_replace(Path rich_db, Path repo_root, Path tmp_path)
`sections` and `locks_held` must be the SAME answers `sections_in` and `locks_held_when` give, or the one-shot is a second implementation of the lock layer rather than a cheaper route to it.
tests/test_dossier_one_shot.py:162
Checks
assert setter is not Noneassert setter.sections == q.sections_in(rich_db, SETTER)assert setter.sections, "the fixture's setter opens a critical section"assert inner is not Noneassert inner.locks_held == q.locks_held_when(db, "solo")assert [s.lock for s in inner.locks_held] == ["a_mutex"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → sections_in → rowids_for_name |
| REQ-DDB-QUERY-004 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_the_lock_panels_agree_with_the_tools_they_replace → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_the_lock_panels_agree_with_the_tools_they_replace → sections_in |
Source · 31 lines
def test_the_lock_panels_agree_with_the_tools_they_replace(
rich_db: Path, repo_root: Path, tmp_path: Path
) -> None:
"""`sections` and `locks_held` must be the SAME answers `sections_in` and
`locks_held_when` give, or the one-shot is a second implementation of the lock
layer rather than a cheaper route to it.
The two panels are asserted on DIFFERENT functions on purpose. They are different
questions with different join directions — what this function locks
(`holder_rowid`) versus what is already locked when it runs
(`critical_section_calls.callee_rowid`) — and a single function that satisfied both
would let one field be wired to the other's query undetected.
"""
setter = q.function_dossier(rich_db, SETTER, repo_root=repo_root)
assert setter is not None
assert setter.sections == q.sections_in(rich_db, SETTER)
assert setter.sections, "the fixture's setter opens a critical section"
## `locks_held` needs a call site whose callee RESOLVED — csample's two section
## members are both `resolution='ambiguous'` and therefore carry a null
## `callee_rowid` by design, so the shared fixture cannot state this half. The
## hand-built db carries `solo`, whose name is unique so the name-scoped tool and
## the identity-scoped panel are asking the same question and equality is a real
## claim rather than an artefact of both being empty.
db = _identity_db(tmp_path)
inner = q.function_dossier(db, "solo", repo_root=tmp_path)
assert inner is not None
assert inner.locks_held == q.locks_held_when(db, "solo")
assert [s.lock for s in inner.locks_held] == ["a_mutex"]
Activity · 9 steps
test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name
None test_dossier_one_shot.test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name(Path tmp_path)
gh#26 IS STILL LIVE, and this payload is where it would hurt most: a body quoted under the wrong heading reads as proof, and a lock attributed to the wrong function is a fabricated synchronization claim.
tests/test_dossier_one_shot.py:298
Checks
assert d is not Noneassert d.file == "a.c", "the definition-preferring pick is the a.c helper"assert d.body is not Noneassert any("port_a_drain" in line for line in d.body.lines)assert not any("port_b_drain" in line for line in d.body.lines)assert {e.name for e in d.external_callees} == {"port_a_drain"}assert [s.lock for s in d.sections] == ["a_mutex"]assert {s.lock for s in q.sections_in(db, "flush")} == {"a_mutex", "b_mutex"}, ("the name-scoped tool must keep unioning — this test is about the DOSSIER" )assert held is not None and held.file == "a.c"assert [s.lock for s in held.locks_held] == ["a_mutex"]assert {s.lock for s in q.locks_held_when(db, "drain")} == {"a_mutex", "b_mutex"}
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → sections_in → rowids_for_name |
| REQ-DDB-QUERY-004 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name → sections_in |
Source · 36 lines
def test_the_one_shot_panels_key_on_the_resolved_identity_not_the_name(tmp_path: Path) -> None:
"""gh#26 IS STILL LIVE, and this payload is where it would hurt most: a body quoted
under the wrong heading reads as proof, and a lock attributed to the wrong function
is a fabricated synchronization claim.
Both directions are asserted — the picked identity's own facts present, the
namesake's ABSENT — because a panel that returned the union would satisfy the first
half alone. `sections_in` on the same name is asserted to return BOTH, which is
correct for a tool a human typed a name into and is exactly the widening this
payload must not inherit.
"""
db = _identity_db(tmp_path)
d = q.function_dossier(db, "flush", repo_root=tmp_path)
assert d is not None
assert d.file == "a.c", "the definition-preferring pick is the a.c helper"
assert d.body is not None
assert any("port_a_drain" in line for line in d.body.lines)
assert not any("port_b_drain" in line for line in d.body.lines)
assert {e.name for e in d.external_callees} == {"port_a_drain"}
assert [s.lock for s in d.sections] == ["a_mutex"]
assert {s.lock for s in q.sections_in(db, "flush")} == {"a_mutex", "b_mutex"}, (
"the name-scoped tool must keep unioning — this test is about the DOSSIER"
)
## The OTHER lock panel, whose join runs the other way. `drain` exists once per
## module and each is called inside its own module's section, so the name-scoped
## tool reports two mutexes and the identity-scoped panel must report one.
held = q.function_dossier(db, "drain", repo_root=tmp_path)
assert held is not None and held.file == "a.c"
assert [s.lock for s in held.locks_held] == ["a_mutex"]
assert {s.lock for s in q.locks_held_when(db, "drain")} == {"a_mutex", "b_mutex"}
Activity · 14 steps
test_the_panels_survive_a_database_that_predates_the_lock_layer
None test_dossier_one_shot.test_the_panels_survive_a_database_that_predates_the_lock_layer(Path tmp_path)
A consumer may be pointed at an older artifact and must get an empty answer, not an `OperationalError` — the #41 contract, now reached through a payload that asks four more questions than it used to.
tests/test_dossier_one_shot.py:334
Checks
assert d is not Noneassert d.sections == []assert d.locks_held == []assert d.body is not None, "the body panel does not depend on the lock layer"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → symbol_provenance |
| REQ-DDB-PIPE-003 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_harvest_calls → is_python_tree |
| REQ-DDB-PIPE-011 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → _body_and_external → external_callees → _harvest_file → _ast_parse_one_file → _parseable_file |
| REQ-DDB-PIPE-012 | inferred | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → _body_and_external → external_callees → _ts_language_for → _grammar_available → has_language |
| REQ-DDB-QUERY-001 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → unresolved_inbound_for_rowids |
| REQ-DDB-QUERY-003 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → function_candidates |
| REQ-DDB-QUERY-004 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier |
| REQ-DDB-QUERY-006 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → gates_covering |
| REQ-DDB-QUERY-009 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier |
| REQ-DDB-QUERY-010 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier |
| REQ-DDB-QUERY-012 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → _macro_dossier |
| REQ-DDB-QUERY-013 | inferred | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → config_defaults_conn |
| REQ-DDB-SCHEMA-011 | measured | test_the_panels_survive_a_database_that_predates_the_lock_layer → function_dossier → _dossier_conn → locks_held_for_rowids |
Source · 21 lines
def test_the_panels_survive_a_database_that_predates_the_lock_layer(tmp_path: Path) -> None:
"""A consumer may be pointed at an older artifact and must get an empty answer, not
an `OperationalError` — the #41 contract, now reached through a payload that asks
four more questions than it used to.
Reuses the identity fixture and DROPS the lock tables, so the two lock panels are
the only difference between this and the test above.
"""
db = _identity_db(tmp_path)
conn = sqlite3.connect(db)
conn.executescript("DROP TABLE critical_section_calls; DROP TABLE lock_acquisitions;")
conn.commit()
conn.close()
d = q.function_dossier(db, "flush", repo_root=tmp_path)
assert d is not None
assert d.sections == []
assert d.locks_held == []
assert d.body is not None, "the body panel does not depend on the lock layer"