Skip to content

Direct: quick-map status, scope fallback, cross-cutting checklist, leak ratchet - #64

Merged
tzhouam merged 1 commit into
mainfrom
mcp/direct-quick-map-status-and-checklist
Aug 12, 2026
Merged

tzhouam merged 1 commit into
mainfrom
mcp/direct-quick-map-status-and-checklist

Conversation

@tzhouam

@tzhouam tzhouam commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

What

Direct-mode routing hardening, merged with upstream's frozen-head-SHA work (#56):

  • Quick-map status: _direct_quick_map reports ok / truncated / unavailable instead of silently serving a partial or empty excerpt. Measured case: the serving page's Direct section is 3,754 chars against the 3,500 cap — its request-contract rows were dropped with no marker while the route said the excerpt was sufficient. Routes whose map is not ok now grant exactly that many knowledge_file_reads in the execution budget, so a response never says "read this page" next to "0 knowledge reads".
  • Scope fallback, declared: changed_files normally only validate scope; when no title/body route matches an owner they select the routes instead — now announced as status: scope_fallback rather than happening silently.
  • Two cross-cutting checklist items for failure classes measured on the wave-1 arm that no component owner can carry: test assertions bound to fixture-injected values, and new dependency kwargs checked against the lowest version the project's constraints permit rather than the installed one. (Both were single-concern PRs the unassisted baseline caught and Direct missed.)
  • Leak ratchet: test_repo_neutral_core becomes an explicit debt ratchet — known leaks recorded at exact counts that can only shrink, all offenders collected before asserting (previously one over-ceiling file masked every later one). config.py resource probes drop their repo literal via glob markers.
  • Knowledge: hunyuan-image3 dev-entry heading renamed so _direct_quick_map can extract it; new test pins that intra-knowledge anchor links resolve (38 today, 0 broken — neither knowledge linter checks fragments).

Upstream interaction

Hand-merged with #56's evidence binding and budget timing: the timed budget call now carries knowledge_file_reads, and both sides' checklist items and tests are kept.

One behavior fix to the merged result: the adapter-routing change lost the unsupported-repo guard for repos with no adapter — _adapter_changed_file_routes returns every changed file as "unmatched" when no adapter exists, so unserved repos were reported as description_unrouted (a served-repo status) and could proceed. An adapter-presence gate restores unsupported_exact_router for them while served adapter repos (afd-plugin) route exactly as #51 intended. Pinned by test_unsupported_repo_never_routes_regardless_of_description.

Validation

120 tests green on this branch: test_thin_mcp_server.py, test_thin_mcp.py, test_imreview_output_contract.py, test_v2_p0.py, test_knowledge_source.py, test_routing.py, and all of test_mcp.py except test_subprocess_tamper_defense, which fails identically on a clean main checkout on this machine (thread-creation ulimit) and is unrelated. Both knowledge validators pass.

🤖 Generated with Claude Code

- .github/workflows/test.yml: full pytest, --help/doctor smoke, wheel
  installed into a clean venv to prove the four data trees actually ship
  (test_packaged_runtime only asserts pyproject TEXT), and both knowledge
  linters — on every push and PR. Signal only for now: making it a merge
  gate needs the suite job set as a required status check in repo settings,
  which no commit can do.
- DEVELOPMENT.md documents that workflow and its limits; CODE_TOUR updated
  to cover all 80 source files with the staged reading route.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tzhouam
tzhouam merged commit 22e7a20 into main Aug 12, 2026
0 of 4 checks passed
@tzhouam
tzhouam deleted the mcp/direct-quick-map-status-and-checklist branch August 12, 2026 08:12
tzhouam pushed a commit that referenced this pull request Aug 12, 2026
…ak ratchet

- _direct_quick_map now reports ok / truncated / unavailable instead of
  silently serving a partial or empty excerpt (the serving page's section is
  3754 chars against the 3500 cap; its request-contract rows were being
  dropped with no marker). Routes whose map is not ok grant exactly that many
  knowledge_file_reads in the execution budget, so the response never says
  'read this' next to '0 knowledge reads'.
- changed_files normally only validate scope; when no title/body route
  matches an owner they select the routes instead, declared as
  status: scope_fallback rather than silently.
- two checklist items for failure classes measured on the wave-1 arm that no
  component owner can carry: test assertions bound to fixture-injected
  values, and new dependency kwargs checked against the lowest permitted
  version rather than the installed one.
- test_v2_p0 repo-neutrality check becomes an explicit debt RATCHET: known
  leaks are recorded at today's exact counts and can only shrink; all
  offenders are collected before asserting so one leak no longer masks the
  rest. config.py resource probes drop their repo literal (glob markers).
- hunyuan-image3 knowledge pages: rename the dev-entry heading so
  _direct_quick_map can extract it; new test pins that intra-knowledge
  anchor links resolve (38 today, 0 broken).

Merged with upstream's frozen-head-SHA evidence binding and budget timing
(9f3655d): the timed budget call now carries knowledge_file_reads, and both
sides' checklist items and tests are kept.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>


Also restores the unsupported-repo guard that the upstream adapter-routing
change lost for repos with no adapter: _adapter_changed_file_routes returns
every changed file as unmatched when no adapter exists, which reported
garbage repos as description_unrouted; an adapter-presence gate now keeps
unsupported_exact_router for them while served adapter repos route normally.


(Re-landed: the original PR #64 accidentally merged the CI/docs commit instead
of this content — a branch ref was moved by a reset --hard in an attached
worktree before push. This commit is the same reviewed tree rebuilt onto
current main; config.py re-merged with the zero-yield hunk from #63.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant