test_a_sub_index_name_that_matches_nothing_is_refused

Tests › tests/test_sub_index_refusal.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE REFUSAL NAMES THE ALTERNATIVES, because a caller who mistyped a name cannot discover the right one from anywhere else — gh#38 is the same gap seen from `targets`. A bare "unknown sub_index" would cost the round trip that the fifteen-minute build cost.

Given

  1. repo = _split_repo(tmp_path / "repo")
→

When

  1. bogus = target_for(repo, tmp_path / "state", name="no-such-tree")
  2. rejection = _sub_index_rejection(bogus, repo)
  3. for buildable in (FIRST_PARTY_INDEX, "deps-tinyfsm", "deps-libIoT"): assert buildable in rejection, f"the refusal must name {buildable!r} as an alternative"
→

Then

  1. ✓ rejection is not None
  2. ✓ rejection contains "no-such-tree"

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) · 45 of 142 steps

thread startthread startthread startthread startthread startthread startclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyother filesother filesother filesother filesother filesother filestry (line 1664)trytry (line 1003)tryopt (line 847)optloop (line 746)loopopt (line 1666)optopt (line 352)optloop (line 205)looploop (line 286)loopopt (line 3215)opt_first_build_worker1. _first_build_worker → first_party_sub_index1first_party_sub_index2. first_party_sub_index → whole_repo_scope2whole_repo_scope3. whole_repo_scope → _gitignored_paths3_gitignored_paths4. _gitignored_paths → git_argv4git_argv5–6. git_argv → _no_ext_diff5_no_ext_diff +1 more7. list → link7link8. _gitignored_paths → git_env8git_env9. whole_repo_scope → list9list10–14. whole_repo_scope → nested_repo_roots10nested_repo_roots +4 more15. nested_repo_roots → _nested_repos_under15_nested_repos_under16–26. whole_repo_scope → _gitignored_paths16_gitignored_paths +10 more27–29. first_party_sub_index → _under_any27_under_any +2 more30–31. _first_party → _own_ignores30_own_ignores +1 more32. first_party_sub_index → _gitignored_paths32_gitignored_paths33. _first_build_worker → target_for33target_for34. target_for → _safe_index_name34_safe_index_name▶ test enters35. target_for → state_home35state_home36. _first_build_worker → _run_build36_run_build37. _run_build → nested_tree_cache37nested_tree_cache38–39. _run_build → _run_build_walked38_run_build_walked +1 more40. _sub_index_rejection → first_party_sub_index40first_party_sub_index▶ test enters41. _sub_index_rejection → _buildable_sub_indexes41_buildable_sub_indexes42. _buildable_sub_indexes → derive_sub_indexes42derive_sub_indexes43–46. derive_sub_indexes → whole_repo_scope43whole_repo_scope +3 more47. _nested_trees_recursive → list47list48–49. _nested_trees_recursive → _gitignored_paths48_gitignored_paths +1 more50–55. derive_sub_indexes → _direct_parent50_direct_parent +5 more56. _sub_index_rejection → _offered_sub_indexes56_offered_sub_indexes57. _offered_sub_indexes → derive_sub_indexes57derive_sub_indexes58. _offered_sub_indexes → list58list59. _run_build_walked → _buildable_sub_indexes59_buildable_sub_indexes60. _run_build_walked → discover_doxyfile60discover_doxyfile

… 82 later steps

6 more

tests/test_sub_index_refusal.py:62 · its file's page

What it checks (3)

  1. assert rejection is not None, "a name matching no nested tree must be refused" observes _sub_index_rejection via rejection
  2. assert "no-such-tree" in rejection, "the refusal must quote the name that failed" observes _sub_index_rejection via rejection
  3. assert buildable in rejection, f"the refusal must name {buildable!r} as an alternative" observes _sub_index_rejection via rejection

Where the product reaches it

  • index → _index_action → build_or_refresh → _build_subject → _sub_index_rejection (flow)
  • main → query_main → _locate → target_for (flow)

Call flow

test_a_sub_index_name_that_matches_nothing_is_refused→_split_repo→target_for→_sub_index_rejection

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_a_sub_index_name_that_matches_nothing_is_refused · 3 checks_sub_index_rejectionfirst_party_sub_indexnested_repo_rootsREQ-DDB-CONFIG-001 · measured_sub_index_rejectionfirst_party_sub_indexREQ-DDB-INDEX-002 · measuredtarget_forREQ-DDB-MCP-001 · measured
Also reaches 3 requirements

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