Repository navigation
fix(mcp): refuse unreadable navigation selections before success - #2836
yasshmittal wants to merge 1 commit into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
|
The failing |
bbf972d to
c57b107
Compare
get_navigation_context forwarded a non-string current document or current address into a successful result, which its own output contract rejects; MCP clients then received a generic SDK output-validation error instead of a typed diagnostic. Return an AnalysisOutputError naming the unreadable observation, matching document resolution, and drop the branches that carried non-string selections into success. Fixes morluto#2516 Co-Authored-By: Claude Opus 5.5 <[email protected]>
c57b107 to
08b6344
Compare
Use one named input-schema projection for clients and catalog identity, preserve dialect declarations, and bound compact schema depth. Keep canonical SDK output validation when output advertisements are disabled. Release request-owned state on cancellation and carry upstream limitations through composed workflows. Preserve doctor full-output envelopes and validate navigation facts at their owner. Reviewed fixes: #2088, #2108, #2513, #2684, #2693, #2695, #2836, #2864, #2868, #2877, #2933, #2998, #3002, #3015. Validation: focused schema, SDK output-validation, context, and workflow tests passed; no schema dialect or canonical output validation was relaxed.
|
Heads up: main already has this change in 80de314. The code is in 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
Superseded by the delivered behavior on main: 80de3145e. Navigation selection rejects malformed document/address inputs through typed shared validation; both application and MCP tests cover the invalid selections. Closing this earlier proposal; the linked report is already resolved. Current main qualification passed: https://github.com/morluto/rea/actions/runs/38690953281. |
|
Thanks @yasshmittal for covering invalid navigation documents and addresses. Main returns typed navigation errors for those inputs. |
Summary
Fixes #2516.
When a provider reported a
nullcurrent document or current address,get_navigation_contextreturned success with thatnull, although its output contract requires both fields to be strings. Through MCP, the SDK then rejected the result and clients received a genericOutput validation errorwith no structured diagnostic.Problem and expected behavior
getNavigationContext(src/application/AnalysisContextQueries.ts) forwarded non-string observations into a successful result, and carried them through an explicit branch for a non-string address. An unreadable provider observation should become a typed provider-output failure before success delivery, consistent withresolveAnalysisDocument.Change and scope
AnalysisOutputError("current_document", …).AnalysisOutputError("current_address", …).resolve_containing_procedureis called.documentargument still skipscurrent_document, and a cursor outside a procedure still returnsprocedure: null.Contribution scope: an ordinary fix within existing boundaries; no maintainer scope decision applies.
Contract and boundary impact
Semantic owner and earliest changed stage: navigation composition in
src/application/AnalysisContextQueries.ts.Contribution scope fit and linked maintainer decision: not applicable (bug fix).
CLI and MCP/tool-catalog contract: output schema unchanged; unreadable selections now return a typed
unreadable_outputerror instead of an SDK validation message.Provider, bridge, target-format, or platform compatibility: providers that return string selections are unaffected.
Evidence, artifact, provenance, or reconstruction contract: unchanged.
Target selection, authority, upstream behavior, and cleanup details: unchanged.
Generated metadata, package, or installation impact: none.
Read existing files or captured data.
Evidence and regression coverage
Tests added or updated:
src/application/AnalysisContextQueries.test.ts: both null variants returnAnalysisOutputErrornaming the unreadable operation, without callingresolve_containing_procedure.tests/boundary/mcp/navigationContextMcp.test.ts(new): the production server and tool registration with a simulated provider and the in-memory MCP client. Both variants deliver a typed error (code: "unreadable_output",details.operation) and notOutput validation error.Base reproduction or other evidence: on the base revision all four tests fail. The MCP variants return
Output validation error: … expected string, received null, as in the issue.User-visible CLI/MCP output:
{"error":{"code":"unreadable_output","details":{"operation":"current_address", …}}}Remaining proof gaps: no live provider returning
nullwas observed; the provider is simulated, as in the issue.Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
Host: Windows 11, Node.js 24.21.0.
npx vitest run src/application/AnalysisContextQueries.test.ts: 7 passed.npx vitest run tests/boundary/mcp/navigationContextMcp.test.ts: 2 passed.npx vitest run src/server src/application/CapabilityInventory.test.ts: 30 passed.npm run check,npm run verify:test-discovery: passed.Compatibility, safety, and release
Before merge
type(scope): outcome.🤖 Generated with Claude Code