fix(mcp): advertise public Apple platform leaves in boot/shutdown/prepare output schemas#1224
Merged
Merged
Conversation
…pare output schemas The boot and shutdown MCP outputSchemas (and the non-exposed prepare schema) enumerated the internal PLATFORMS vocabulary (apple | android | linux | web), while the command contracts and runtime emit PublicPlatform (ios | macos | android | linux | web). Point the schemas at PUBLIC_PLATFORMS so a valid ios/macos result validates and the internal apple identity is never advertised on these public result fields. Add a focused, non-strict JSON Schema validator and use it to validate representative ios/macos structured content against the complete advertised schema (enums/consts + nested required), with negative coverage for the internal apple value, unknown enum values, the booted const, and a missing nested field. Closes #1219 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
boot/shutdownMCPoutputSchemas (and the non-exposedprepareschema) enumerated the internalPLATFORMSvocabulary, while the command contracts (BootCommandResult/ShutdownCommandResult/PrepareCommandResult) and the daemon runtime emitPublicPlatformviapublicPlatformString(...). So a realios/macosresult was validated against a schema that advertisedappleand did not listios/macos.Same one-line vocabulary swap for the
prepareschema'splatform. NoadditionalProperties: false, no schema generator — the schemas stay hand-authored and additive (cost,appleOs, future fields still validate). Internalappleidentity and runtime wire values are unchanged; only the advertised enum on the public result fields moves to the leaves the runtime already emits.The prior
bootschema test asserted only that required keys were present, so aniosfixture passed without ever checking enum membership. This PR adds a small non-strict JSON Schema validator (src/mcp/__tests__/output-schema-validator.ts) covering the dialect these schemas actually use (type/enum/const/required/properties/items/oneOf, unknown props allowed) and uses it to validate representative structured content against the complete advertised schema:iosandmacosboot/shutdown/prepareresults validate (enums + nested required);appleis rejected, an unknown enum (windows) is rejected,booted: falsefails theconst true, and a missing nestedshutdown.stderrfails;boot/shutdown/prepareplatformenums are asserted to be['ios','macos','android','linux','web']and to excludeapple.Closes #1219
Checks
pnpm check:affected --base origin/main --run— all runnable checks pass (format:check,lint,typecheck,check:layering,fallow,build,vitest related: 76 tests). Focused:pnpm vitest run src/mcp/__tests__/command-tools.test.ts(44 tests).Caveat: on this session's snapshot (Node 22.14)
pnpm buildinitially failed intsdown's config loader withFailed to import module "unrun"— a stale/pruned optional peer in the snapshot'snode_modules, reproducible on a cleanorigin/mainand unrelated to this change. Runningcheck:affectedon Node 24 built cleanly, and CI builds fine (the "Packaged CLI Node 22.12" job is green).Link to Devin session: https://app.devin.ai/sessions/e94f0554e5e548d39ae82c024c2be982
Requested by: @thymikee