test_a_stray_developer_clone_the_parent_tracks_is_first_party¶
Tests › tests/test_external_provenance.py
What this test is for
Why it exists
THE NEGATIVE HALF OF gh#352, and the case that forced the predicate split. Both directories here hold a real `.git`; only one is a gitlink in the parent's index. The other is a repository somebody CLONED into a directory whose files this repo tracks and owns.
Verifies REQ-DDB-PIPE-014
Given
db_path, root = _indexed( tmp_path, [*_ours(), *_theirs(), ("evidence/checkout/probe.c", 4)], nested=("vendor/theirs",), )make_gitlink_free_clone = root / "evidence" / "checkout"
2 more
git_run(make_gitlink_free_clone, "init", "-q", ".")git_run(root, "add", "-f", "evidence/checkout/probe.c")
When
external_roots(root)stamp_external_provenance(db_path, root)conn = sqlite3.connect(str(db_path))try: rows = dict(conn.execute(f"SELECT name, {EXTERNAL_ROOT_COLUMN} FROM path").fetchall()) finally: conn.close()
Then
- ✓ (make_gitlink_free_clone / ".git").is_dir() holds
- ✓ external_roots(root) equals ["vendor/theirs"]
- ✓ rows["evidence/checkout/probe.c"] is None
- ✓ rows["vendor/theirs/lib_0.c"] equals "vendor/theirs"
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.
thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 6 of 142 steps
… 2 earlier steps
… 126 later steps
4 more
- Build, refresh and check the index · 6 of 153 steps
- clew — `main` (clew/cli.py) · 6 of 400 steps
- Build this wiki from the index · 2 of 400 steps
- `main` (clew/guard/main.py) · 2 of 357 steps
tests/test_external_provenance.py:170 · its file's page
What it checks (4)
assert (make_gitlink_free_clone / ".git").is_dir(), "the fixture must hold a REAL git tree"not attributedassert external_roots(root) == ["vendor/theirs"], ( "a stray clone in a tracked directory is NOT a declared dependency — reporting it " "makes the tag depend on who built the index rather than on what the repo committed" )observesexternal_rootsassert rows["evidence/checkout/probe.c"] is None, "the repo's own tracked file stays ours"not attributedassert rows["vendor/theirs/lib_0.c"] == "vendor/theirs"not attributed
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
test_a_stray_developer_clone_the_parent_tracks_is_first_party→_indexed→_ours→_theirs→git_run→external_roots→stamp_external_provenanceWhat 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.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-PIPE-014 | catalog | unknown |
Also reaches 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-INDEX-005 measured