test_extract_threads_std_thread_multicall_lambda_fail_closed¶
Tests › tests/test_r1_richness.py
What this test is for
Why it exists
A lambda body with MORE THAN ONE call is ambiguous (which is the loop?) and must fail closed — no thread attributed to an arbitrary helper.
Verifies REQ-DDB-SCHEMA-002 REQ-DDB-SCHEMA-003 REQ-DDB-SCHEMA-004
Given
src = tmp_path / "src"src.mkdir()
2 more
(src / "foo.cpp").write_text( "void setup() {}\n" "void serve() {}\n" "void start() {\n" " t_ = std::thread([this] { setup(); serve(); });\n" "}\n", )db = _make_db( tmp_path, [(1, "setup", 1, 1), (2, "serve", 2, 2), (3, "start", 3, 5)], rel_path="src/foo.cpp", call_edges=[], )
When
extract_threads(db, tmp_path, None)conn = sqlite3.connect(str(db))rows = conn.execute("SELECT name, entry_memberdef_rowid FROM threads").fetchall()
2 more
conn.close()name, entry = rows[0]
Then
- ✓ len(rows) equals 1
- ✓ entry is None
- ✓ ("setup", "serve") does not contain name
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) · 7 of 400 steps
… 70 earlier steps
… 313 later steps
tests/test_r1_richness.py:311 · its file's page
What it checks (3)
assert len(rows) == 1, f"the thread exists and must be recorded: {rows}"not attributedassert entry is None, ( f"an ambiguous lambda body attributed an entry ({entry}) — that is the arbitrary-helper " f"attribution this test exists to refuse" )not attributedassert name not in ("setup", "serve"), ( f"the row borrowed a helper's name ({name!r}) instead of the assignment target" )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
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.
Requirements it verifies (3)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-SCHEMA-002 | catalog | unknown |
| REQ-DDB-SCHEMA-003 | catalog | unknown |
| REQ-DDB-SCHEMA-004 | catalog | unknown |
Also reaches 10 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-002 inferred
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-004 inferred
- REQ-DDB-PIPE-011 measured
- REQ-DDB-PIPE-012 inferred
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-011 measured
- REQ-DDB-SCHEMA-001 measured
- REQ-DDB-SCHEMA-007 measured
- REQ-DDB-SCHEMA-012 measured