Skip to content

fix(mcp): avoid top-level api_impact schema combinators#2489

Merged
magyargergo merged 2 commits into
abhigyanpatwari:mainfrom
koriyoshi2041:rios/bedrock-api-impact-schema
Jul 16, 2026
Merged

fix(mcp): avoid top-level api_impact schema combinators#2489
magyargergo merged 2 commits into
abhigyanpatwari:mainfrom
koriyoshi2041:rios/bedrock-api-impact-schema

Conversation

@koriyoshi2041

Copy link
Copy Markdown
Contributor

Summary

  • remove the top-level anyOf from the api_impact MCP input schema
  • keep route and file optional at the transport layer so stricter provider validators can load the tool list
  • add a regression test that rejects top-level anyOf / oneOf / allOf on this schema while relying on the existing runtime guard for missing lookup keys

Fixes #2487.

Verification

  • npx vitest run test/unit/tools.test.ts
  • npx vitest run test/unit/calltool-dispatch.test.ts
  • npx tsc --noEmit

Risk

Low. The transport schema is looser, but callTool('api_impact', {}) still returns the existing structured error when neither route nor file is provided.

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

@koriyoshi2041 is attempting to deploy a commit to the NexusCore Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

CI Report

All checks passed

Pipeline Status

Stage Status Details
✅ Typecheck success tsc --noEmit
✅ Tests success unit tests, 3 platforms
✅ E2E success gitnexus-web changes only

Test Results

Tests Passed Failed Skipped Duration
14708 14646 0 62 18s

✅ All 14646 tests passed

62 test(s) skipped — expand for details

Code Coverage

Tests

Metric Coverage Covered Base Delta Status
Statements 80.94% 54609/67464 80.71% 📈 +0.2 🟢 ████████████████░░░░
Branches 68.06% 33505/49223 67.75% 📈 +0.3 🟢 █████████████░░░░░░░
Functions 87.07% 6339/7280 86.75% 📈 +0.3 🟢 █████████████████░░░
Lines 84.46% 48707/57666 84.24% 📈 +0.2 🟢 ████████████████░░░░

📋 View full run · Generated by CI

@100yenadmin

Copy link
Copy Markdown
Contributor

Downstream validation from the Electric maintenance fork is now complete: electricsheephq#123

The fork generalized the compatibility contract across every advertised MCP tool: no top-level anyOf, oneOf, or allOf; existing property names remain stable; and the api_impact route/file plus impact target/name/symbol requirements are enforced during runtime normalization before repository resolution. The focused matrix covers canonical, agreeing, conflicting, missing, grouped, read-only, allowlisted, stdio, and HTTP paths. All 317 focused cases and the complete cross-platform PR matrix passed at exact head 3d0daebd9738a7f53b71dae3a458b72550e9f766.

This is provider-neutral implementation evidence; the tests use deterministic temporary data and contain no credentials or private repository policy.

@koriyoshi2041

Copy link
Copy Markdown
Contributor Author

CI readback after the rebase: all quality/typecheck/build/CodeQL jobs passed. The only non-Vercel failure is tests / windows-latest (platform-sensitive) 1/3, where test/integration/lbug-multiwriter-deadlock.test.ts hit the 15-minute Vitest timeout after the real checkpoint-vs-reader race test retried once.

That test looks unrelated to this PR's api_impact schema diff; the same run has Windows shards 2/3 and 3/3 green. I tried to rerun failed jobs, but GitHub requires repo admin rights for that action on this repo.

@magyargergo magyargergo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: PR #2489 (rios/bedrock-api-impact-schema @ 470384b vs merge-base a05b501)

Findings

  • [MEDIUM] gitnexus/test/unit/tools.test.ts — the branch is CONFLICTING with main and cannot be merged as-is (inline comment with resolution guidance). This is the only blocking item.

No defects found in the change itself.

Change and blast-radius summary

  • The fix is real and verified end-to-end: server.ts:157 forwards inputSchema verbatim in ListTools, so the top-level anyOf did reach Bedrock's validator; removing it addresses TOOL_SCHEMA_INVALID (#2487).
  • The runtime guard the PR relies on exists and is structured: local-backend.ts apiImpact() returns { error: 'Either "route" or "file" parameter is required.' } when both are missing — no behavioral hole opens up from loosening the transport schema.
  • The tool description already documents the constraint (tools.ts:744Requires at least "route" or "file" parameter), and the new test pins it.
  • Removing the anyOf field from the ToolDefinition interface is safe: after merging with current main there are no remaining writers or readers of inputSchema.anyOf anywhere in gitnexus/ or gitnexus-web/ (only negative toHaveProperty assertions in tests, which don't depend on the TS type).
  • This matches the repo's established direction — main's 3f3494f ("fix(mcp): validate aliases without schema combinators") applied the same no-top-level-combinators pattern to the impact tool.
  • GitNexus detect_changes (compare vs merge-base): LOW risk, 0 affected execution flows. Graph impact on GITNEXUS_TOOLS returned 0 upstream hits, so consumers were verified by source instead: server.ts (ListTools) and the schema self-check loop at tools.ts:896.
  • No competing fix landed on main; #2487 is still open and this PR is the only candidate.

Coverage and residual risk

  • The regression test locks out anyOf/oneOf/allOf at the top level of the api_impact schema and asserts the description carries the requirement; calltool-dispatch.test.ts already covers the runtime rejection path.
  • The failing tests / windows-latest 1/3 shard is test/integration/lbug-multiwriter-deadlock.test.ts — an LadybugDB multi-writer integration test unrelated to this 2-file MCP schema change (known Windows flake family). CI Gate is red only transitively; the rebase this review requires will trigger fresh CI anyway.
  • Out of scope but worth tracking from the #2487 discussion: the client-side swallowing of Bedrock's 400 into a generic streaming error is a separate diagnosability issue this PR doesn't (and needn't) address.

Verdict

REQUEST CHANGES — solely for mergeability. Rebase onto main and resolve the tools.test.ts conflict; the change itself is correct and I'll approve once the branch is mergeable with green (or flake-explained) CI.


Reviewed with the gitnexus-review skill (PR #2431) — GitNexus detect_changes/impact + source verification in a detached worktree at head.

});

it('api_impact tool expresses the route-or-file requirement via anyOf (#2308)', () => {
it('api_impact tool avoids top-level schema combinators for Bedrock compatibility (#2487)', () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM — the one blocking item] This file conflicts with current main: since your branch point (a05b501), main added adjacent tests in this exact region — context tool advertises file as a compatibility alias right above, and impact tool requires direction … without combinators right below (from 3f3494f/a75844b6) — while this PR rewrites the api_impact test in between, so the merge is positional-conflicted.

Resolution is mechanical: rebase onto main, keep both of main's neighboring tests unchanged, and take this PR's rewritten api_impact test in place of the old anyOf one. Your interface-field removal in tools.ts auto-merges cleanly (verified with git merge-tree), and post-merge nothing else reads or writes inputSchema.anyOf.

For the record, the red tests / windows-latest 1/3 shard is lbug-multiwriter-deadlock.test.ts — unrelated to this change; the rebase push will re-run CI.

@koriyoshi2041
koriyoshi2041 force-pushed the rios/bedrock-api-impact-schema branch from 470384b to cb33f6b Compare July 16, 2026 12:56
@koriyoshi2041

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and resolved the tools.test.ts conflict while preserving the newer context-alias and impact-schema coverage. Focused MCP tests pass (258/258); new head is cb33f6ba and fresh CI is running.

@magyargergo
magyargergo merged commit b85f1ac into abhigyanpatwari:main Jul 16, 2026
37 of 38 checks passed
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.

api_impact tool uses anyOf at top level of inputSchema → breaks Claude via AWS Bedrock (TOOL_SCHEMA_INVALID)

3 participants