test_the_lock_is_reentrant_within_a_process¶
Tests › tests/test_build_shared_state.py
What this test is for
Why it exists
The MCP server holds it, then builds in-process: the inner take is held at once.
Given
db = tmp_path / "clew.db"
When
with build_lock(db) as outer: started = time.monotonic() with build_lock(db, wait_seconds=2.0) as inner: elapsed = time.monotonic() - started
Then
- ✓ (outer, inner) equals (True, True)
- ✓ elapsed is less than 1.0
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) · 2 of 142 steps
… 60 earlier steps
… 76 later steps
tests/test_build_shared_state.py:42 · its file's page
What it checks (2)
assert (outer, inner) == (True, True)not attributedassert elapsed < 1.0, f"the process waited {elapsed:.1f}s on a lock it already held"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.
Also reaches 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-002 measured