test_a_shared_path_prefix_does_not_misattribute_a_sibling_tree

Tests › tests/test_external_provenance.py

passed Passed in the packaged run.

What this test is for

Why it exists

`vendor/lib` and `vendor/lib-utils` share a prefix, and a bare `startswith` would tag the second repo's files as belonging to the first — a WRONG attribution, which is worse than an absent one because it reads as a confident measurement rather than as missing knowledge.

Verifies REQ-DDB-PIPE-014

Given

  1. db_path, root = _indexed( tmp_path, [("vendor/lib/a.c", 3), ("vendor/lib-utils/b.c", 3)], nested=("vendor/lib", "vendor/lib-utils"), )
→

When

  1. stamp_external_provenance(db_path, root)
  2. owners = {entry.path: entry.external_root for entry in q.list_files(db_path)}
→

Then

  1. ✓ owners["vendor/lib/a.c"] equals "vendor/lib"
  2. ✓ owners["vendor/lib-utils/b.c"] equals "vendor/lib-utils"

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

clew — `main` (clew/cli.py) · 11 of 400 steps

… 45 earlier steps

command-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filestry (line 1003)tryopt (line 845)optloop (line 1239)loopopt (line 847)optloop (line 746)loopmain46. whole_repo_scope → _gitignored_paths46_gitignored_paths47. _gitignored_paths → git_argv47git_argv48. git_argv → _no_ext_diff48_no_ext_diff▶ test enters49. git_argv → list49list50. _gitignored_paths → git_env50git_env51. whole_repo_scope → list51list52. whole_repo_scope → nested_repo_roots52nested_repo_roots53. nested_repo_roots → _nested_repos_under53_nested_repos_under▶ test enters54–56. _nested_repos_under → _warn_unwalkable54_warn_unwalkable +2 more57. nested_repo_roots → _nested_repos_under57_nested_repos_under58. whole_repo_scope → _gitignored_paths58_gitignored_paths

… 157 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyloop (line 1576)loopmain216. _memberdef_corpora → _expansion_sql216_expansion_sql217. _expansion_sql → has_columns217has_columns218. has_columns → table_exists218table_exists219. _memberdef_corpora → _memberdef_candidates219_memberdef_candidates220. _memberdef_candidates → table_exists220table_exists

… 119 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesopt (line 504)optmain340. _files_corpus → one340one341. _files_corpus → list_files341list_files342. list_files → connect342connect▶ test enters343. list_files → has_columns343has_columns344. list_files → table_exists344table_exists345. list_files → _matches345_matches346. _files_corpus → files_miss346files_miss347. corpus_payload → lock_roster347lock_roster

… 53 later steps

6 more

tests/test_external_provenance.py:431 · its file's page

What it checks (2)

  1. assert owners["vendor/lib/a.c"] == "vendor/lib" observes list_files via owners
  2. assert owners["vendor/lib-utils/b.c"] == "vendor/lib-utils" observes list_files via owners

Where the product reaches it

  • main → query_main → _payload → export_search → corpus_payload → _files_corpus → list_files (flow)

Call flow

test_a_shared_path_prefix_does_not_misattribute_a_sibling_tree→_indexed→stamp_external_provenance→list_files

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

test_a_shared_path_prefix_does_not_misattribute_a_sibling_tree · 2 checksstamp_external_provenanceexternal_rootsdependency_rootsREQ-DDB-CONFIG-001 · measuredstamp_external_provenanceREQ-DDB-INDEX-005 · measuredlist_filesREQ-DDB-QUERY-001 · measuredlist_filestable_existsREQ-DDB-QUERY-003 · measured

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-PIPE-014catalogunknown
Also reaches 4 requirements

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