test_the_whole_listing_is_bounded¶
Tests › tests/test_derived_target_listing.py
What this test is for
Why it exists
THE ONE REPLY WITH NO BOUND, which `list_targets`' own docstring already called out when it trimmed the per-target payload: "this multiplied an unbounded per-target payload by an unbounded target count". The payload got its bound then and the COUNT did not, so gh#38's extra rows walked straight through the gap.
Given
reg = st.TargetRegistry(tmp_path / "state")for i in range(TARGETS_CAP + 20): repo = tmp_path / f"repo{i}" repo.mkdir() target = reg.register(repo.resolve()) Path(target.db_path).write_bytes(rich_db.read_bytes())
When
_mcp, server = build_server(reg)rows = server.list_targets()rendered = json.dumps(rows)
Then
- ✓ len(rows) is at most TARGETS_CAP + 1
- ✓ len(rendered) is less than 100_000
- ✓ any("more" in str(row) for row in rows) holds
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.
Build, refresh and check the index · 44 of 153 steps
… 17 earlier steps
… 76 steps between
5 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 31 of 142 steps
- `main` (scripts/stage_probe.py) · 30 of 37 steps
- clew-mcp — `main` (clew/mcp_server/server.py) · 9 of 17 steps
- clew — `main` (clew/cli.py) · 1 of 400 steps
- `main` (scripts/incremental_probe.py) · 1 of 3 steps
tests/test_derived_target_listing.py:218 · its file's page
What it checks (3)
assert len(rows) <= TARGETS_CAP + 1, f"{len(rows)} rows is not a bound"not attributedassert len(rendered) < 100_000, f"{len(rendered)} characters still overflows a client"not attributedassert any("more" in str(row) for row in rows), "the omission must be disclosed"not attributed
Where the product reaches it
main→build_server(flow)
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 10 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-006 measured
- REQ-DDB-CONFIG-007 measured
- REQ-DDB-INDEX-003 measured
- REQ-DDB-MCP-001 measured
- REQ-DDB-MCP-002 measured
- REQ-DDB-MCP-003 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-PIPE-005 measured
- REQ-DDB-WIKI-034 measured
- REQ-DDB-WIKI-054 measured