[PR #3806] [MERGED] fix(mcp): normalize compact schemas for strict gateways #5912

Closed
opened 2026-10-31 01:10:23 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3806
Author: @Hahaa909
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @morluto

Base: main ← Head: jianghh/rea-3800-gateway-schema-compat


📝 Commits (6)

  • 199eca5 fix(mcp): make compact schemas gateway compatible
  • 65dfa6b fix(mcp): normalize compact schemas at the advertised boundary
  • 6fafce1 chore: incorporate the verified evaluation fixture correction
  • b23bca2 fix(mcp): distinguish compact advertisement from canonical ADB validation
  • 1e09888 test(mcp): bind input precision assertions to the advertised profile
  • 112a381 test(mcp): own schema assertions and validator lifetimes

📊 Changes

21 files changed (+615 additions, -157 deletions)

View changed files

📝 docs/mcp-contracts.md (+21 -0)
📝 docs/testing.md (+13 -0)
📝 src/contracts/compactInputSchema.test.ts (+137 -0)
📝 src/contracts/compactInputSchema.ts (+108 -2)
📝 tests/boundary/mcp/absoluteLocalPathSchema.test.ts (+50 -4)
📝 tests/boundary/mcp/adbStartMcp.test.ts (+9 -16)
📝 tests/boundary/mcp/apktoolMcp.test.ts (+4 -1)
📝 tests/boundary/mcp/binaryDiagnosticsMcp.test.ts (+14 -13)
📝 tests/boundary/mcp/bundleComparisonMcp.test.ts (+8 -43)
📝 tests/boundary/mcp/compactInputSchemaMcp.test.ts (+116 -0)
📝 tests/boundary/mcp/flutterMcp.test.ts (+4 -1)
📝 tests/boundary/mcp/goBinaryMcp.test.ts (+10 -5)
📝 tests/boundary/mcp/goBinaryViews.test.ts (+30 -23)
📝 tests/boundary/mcp/managedMcp.test.ts (+3 -4)
📝 tests/boundary/mcp/recordedCrashMcp.test.ts (+7 -10)
📝 tests/boundary/mcp/retainedApplicationEvidenceMcp.test.ts (+23 -6)
📝 tests/boundary/mcp/wasmArtifactMcp.test.ts (+23 -20)
📝 tests/boundary/mcp/webNetworkCaptureMcp.test.ts (+9 -3)
📝 tests/boundary/mcp/webRuntimeMcp.test.ts (+4 -1)
📝 tests/fixtures/mcpSchemaValidation.ts (+3 -1)

...and 1 more files

📄 Description

Summary

Fixes #3800 and addresses the untyped array-item union shape reported in #5201. Compact MCP schemas give homogeneous array-item unions an explicit shared type and use the existing shallow projection for incompatible enums, required-property combinators, and mixed or unknown item unions. Canonical server validation remains authoritative.

Schema tests now select the profile their claims require. Full-SDK conformance owns exact path, selector, timeout, and extra-value restrictions; compact workflows assert typed canonical rejection and preserve provider-call controls. The audit covers assertions and helpers in 91 schema-related test files. It removes duplicate validators and derived test oracles without requiring compact advertisements to stay permissive.

The Go-view suite now reuses the existing immutable, content-keyed schema preparation within the file. Each case keeps fresh sessions and connections, SDK output validation, and declared dialect/format checks. The suite completes under the existing 512 MiB heap limit.

Validation

  • Includes main 4c680d099 and its portable-pattern/autofix guard; the branch is conflict-free.
  • 167 focused tests passed across 21 test files, serially in bounded processes, with no skips. This includes the previously failing workflows, full SDK path/schema conformance, canonical input admission, schema-cache mutation/dialect controls, and MCP fixture lifecycle regressions.
  • The restored empty-path regression and all malformed WASM timeout types also passed their focused reruns.
  • Runtime build, check:fast, generated docs verification, and 9 README consistency tests passed. The production implementation is unchanged by the assertion/heap cleanup.
  • Provider outputs and artifacts are simulated, authored, or recorded as identified by their tests. No live strict gateway or Gemini service was exercised; the generic JSON fallback does not establish complete provider acceptance or close the newer live report in #5201.
  • Current-head GitHub CI is a separate gate.

Author readiness

Human owner: @morluto

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Human ownership

  • I have reviewed the diff and verification evidence.
  • I have confirmed this PR is ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/3806 **Author:** [@Hahaa909](https://github.com/Hahaa909) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `jianghh/rea-3800-gateway-schema-compat` --- ### 📝 Commits (6) - [`199eca5`](https://github.com/morluto/rea/commit/199eca5dfdd2b3b173cfcc0b8afe8ffe163d1826) fix(mcp): make compact schemas gateway compatible - [`65dfa6b`](https://github.com/morluto/rea/commit/65dfa6b0f00631f12969dd446a45895549fcf662) fix(mcp): normalize compact schemas at the advertised boundary - [`6fafce1`](https://github.com/morluto/rea/commit/6fafce18517710b74e9a0b75cb90feb5ae490672) chore: incorporate the verified evaluation fixture correction - [`b23bca2`](https://github.com/morluto/rea/commit/b23bca2e52a677f991713face64dd8a530d0aaa2) fix(mcp): distinguish compact advertisement from canonical ADB validation - [`1e09888`](https://github.com/morluto/rea/commit/1e098882a630d5a31702befabfe4410eb45a3843) test(mcp): bind input precision assertions to the advertised profile - [`112a381`](https://github.com/morluto/rea/commit/112a3815dab224cc772044774a55c9f826cc73cd) test(mcp): own schema assertions and validator lifetimes ### 📊 Changes **21 files changed** (+615 additions, -157 deletions) <details> <summary>View changed files</summary> 📝 `docs/mcp-contracts.md` (+21 -0) 📝 `docs/testing.md` (+13 -0) 📝 `src/contracts/compactInputSchema.test.ts` (+137 -0) 📝 `src/contracts/compactInputSchema.ts` (+108 -2) 📝 `tests/boundary/mcp/absoluteLocalPathSchema.test.ts` (+50 -4) 📝 `tests/boundary/mcp/adbStartMcp.test.ts` (+9 -16) 📝 `tests/boundary/mcp/apktoolMcp.test.ts` (+4 -1) 📝 `tests/boundary/mcp/binaryDiagnosticsMcp.test.ts` (+14 -13) 📝 `tests/boundary/mcp/bundleComparisonMcp.test.ts` (+8 -43) 📝 `tests/boundary/mcp/compactInputSchemaMcp.test.ts` (+116 -0) 📝 `tests/boundary/mcp/flutterMcp.test.ts` (+4 -1) 📝 `tests/boundary/mcp/goBinaryMcp.test.ts` (+10 -5) 📝 `tests/boundary/mcp/goBinaryViews.test.ts` (+30 -23) 📝 `tests/boundary/mcp/managedMcp.test.ts` (+3 -4) 📝 `tests/boundary/mcp/recordedCrashMcp.test.ts` (+7 -10) 📝 `tests/boundary/mcp/retainedApplicationEvidenceMcp.test.ts` (+23 -6) 📝 `tests/boundary/mcp/wasmArtifactMcp.test.ts` (+23 -20) 📝 `tests/boundary/mcp/webNetworkCaptureMcp.test.ts` (+9 -3) 📝 `tests/boundary/mcp/webRuntimeMcp.test.ts` (+4 -1) 📝 `tests/fixtures/mcpSchemaValidation.ts` (+3 -1) _...and 1 more files_ </details> ### 📄 Description ## Summary Fixes #3800 and addresses the untyped array-item union shape reported in #5201. Compact MCP schemas give homogeneous array-item unions an explicit shared type and use the existing shallow projection for incompatible enums, required-property combinators, and mixed or unknown item unions. Canonical server validation remains authoritative. Schema tests now select the profile their claims require. Full-SDK conformance owns exact path, selector, timeout, and extra-value restrictions; compact workflows assert typed canonical rejection and preserve provider-call controls. The audit covers assertions and helpers in 91 schema-related test files. It removes duplicate validators and derived test oracles without requiring compact advertisements to stay permissive. The Go-view suite now reuses the existing immutable, content-keyed schema preparation within the file. Each case keeps fresh sessions and connections, SDK output validation, and declared dialect/format checks. The suite completes under the existing 512 MiB heap limit. ## Validation - Includes main `4c680d099` and its portable-pattern/autofix guard; the branch is conflict-free. - 167 focused tests passed across 21 test files, serially in bounded processes, with no skips. This includes the previously failing workflows, full SDK path/schema conformance, canonical input admission, schema-cache mutation/dialect controls, and MCP fixture lifecycle regressions. - The restored empty-path regression and all malformed WASM timeout types also passed their focused reruns. - Runtime build, `check:fast`, generated docs verification, and 9 README consistency tests passed. The production implementation is unchanged by the assertion/heap cleanup. - Provider outputs and artifacts are simulated, authored, or recorded as identified by their tests. No live strict gateway or Gemini service was exercised; the generic JSON fallback does not establish complete provider acceptance or close the newer live report in #5201. - Current-head GitHub CI is a separate gate. ## Author readiness Human owner: @morluto - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Human ownership - [x] I have reviewed the diff and verification evidence. - [x] I have confirmed this PR is ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:10:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5912
No description provided.