test_the_whole_listing_is_bounded

Tests › tests/test_derived_target_listing.py

passed Passed in the packaged run.

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

  1. reg = st.TargetRegistry(tmp_path / "state")
  2. 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

  1. _mcp, server = build_server(reg)
  2. rows = server.list_targets()
  3. rendered = json.dumps(rows)
→

Then

  1. ✓ len(rows) is at most TARGETS_CAP + 1
  2. ✓ len(rendered) is less than 100_000
  3. ✓ 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

callercallercallercallercallerclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyother filesother filesother filesother filesother filesopt (line 352)optopt (line 169)optloop (line 169)loopopt (line 171)optopt (line 172)optopt (line 2070)optloop (line 662)loopcatch (line 562)catchindex18. repo_indexes → target_for18target_for19. target_for → _safe_index_name19_safe_index_name20. target_for → state_home20state_home▶ test enters21. repo_indexes → target_for21target_for22. adopt → target_for22target_for23. adopt → _sync_tier123_sync_tier124. _sync_tier1 → register_query_tools24register_query_tools▶ test enters25–29. register_query_tools → _add_tool25_add_tool +4 more30. _answering_with_refresh → refused30refused31. _answering_with_refresh → _take_context31_take_context32. _take_context → list32list33. register_query_tools → list33list34. adopt → db_status34db_status35–36. db_status → _options_meta35_options_meta +1 more37. _meta_section → meta_section37meta_section38. db_status → stated_options38stated_options39. db_status → read_build_signature39read_build_signature40–48. db_status → _source_drift40_source_drift +8 more49. db_status → list49list50–53. db_status → _diagnostics_meta50_diagnostics_meta +3 more54. db_status → code_identity54code_identity55–57. code_identity → source_fingerprint55source_fingerprint +2 more58. db_status → notices58notices59–60. notices → code_identity59code_identity +1 more61–63. _data_notice → _cost_clause61_cost_clause +2 more64–67. notices → _schema_notice64_schema_notice +3 more68–69. _build_subject → resolve_target68resolve_target +1 more

… 76 steps between

callercallercallercallerclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyloop (line 2805)looploop (line 2807)loopindex146. read_comments → resolve_target146resolve_target147. _index_action → list_targets147list_targets148. list_targets → _listing_row148_listing_row▶ test enters149. list_targets → db_status149db_status150. list_targets → _top_level_names150_top_level_names151–152. list_targets → _buildable_row151_buildable_row +1 more153. list_targets → _capped_listing153_capped_listing
5 more

tests/test_derived_target_listing.py:218 · its file's page

What it checks (3)

  1. assert len(rows) <= TARGETS_CAP + 1, f"{len(rows)} rows is not a bound" not attributed
  2. assert len(rendered) < 100_000, f"{len(rendered)} characters still overflows a client" not attributed
  3. assert any("more" in str(row) for row in rows), "the omission must be disclosed" not attributed

Where the product reaches it

Call flow

test_the_whole_listing_is_bounded→build_server

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_the_whole_listing_is_bounded · 3 checksbuild_serverREQ-DDB-MCP-001 · measuredbuild_server_refusal_as_tool_errorREQ-DDB-MCP-004 · measuredbuild_server_register_promptsREQ-DDB-WIKI-034 · measured
Also reaches 10 requirements

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