Skip to content

fix(mcp): advertise public Apple platform leaves in boot/shutdown/prepare output schemas#1224

Merged
thymikee merged 1 commit into
mainfrom
devin/1783850692-public-apple-platform-schemas
Jul 12, 2026
Merged

fix(mcp): advertise public Apple platform leaves in boot/shutdown/prepare output schemas#1224
thymikee merged 1 commit into
mainfrom
devin/1783850692-public-apple-platform-schemas

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

The boot/shutdown MCP outputSchemas (and the non-exposed prepare schema) enumerated the internal PLATFORMS vocabulary, while the command contracts (BootCommandResult/ShutdownCommandResult/PrepareCommandResult) and the daemon runtime emit PublicPlatform via publicPlatformString(...). So a real ios/macos result was validated against a schema that advertised apple and did not list ios/macos.

- const deviceHeaderProperties = { platform: enumSchema(PLATFORMS), ... }   // apple | android | linux | web
+ const deviceHeaderProperties = { platform: enumSchema(PUBLIC_PLATFORMS), ... } // ios | macos | android | linux | web

Same one-line vocabulary swap for the prepare schema's platform. No additionalProperties: false, no schema generator — the schemas stay hand-authored and additive (cost, appleOs, future fields still validate). Internal apple identity 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 boot schema test asserted only that required keys were present, so an ios fixture 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:

  • valid ios and macos boot/shutdown/prepare results validate (enums + nested required);
  • negative coverage: internal apple is rejected, an unknown enum (windows) is rejected, booted: false fails the const true, and a missing nested shutdown.stderr fails;
  • the boot/shutdown/prepare platform enums are asserted to be ['ios','macos','android','linux','web'] and to exclude apple.

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 build initially failed in tsdown's config loader with Failed to import module "unrun" — a stale/pruned optional peer in the snapshot's node_modules, reproducible on a clean origin/main and unrelated to this change. Running check:affected on 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

…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>
@thymikee thymikee self-assigned this Jul 12, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.7 MB 1.7 MB 0 B
JS gzip 536.7 kB 536.7 kB 0 B
npm tarball 646.3 kB 646.3 kB -3 B
npm unpacked 2.3 MB 2.3 MB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 26.6 ms 27.2 ms +0.7 ms
CLI --help 57.3 ms 56.6 ms -0.6 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/server.js 0 B +1 B

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Jul 12, 2026
@thymikee thymikee merged commit ae21067 into main Jul 12, 2026
22 checks passed
@thymikee thymikee deleted the devin/1783850692-public-apple-platform-schemas branch July 12, 2026 10:40
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-12 10:40 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix public Apple platform parity in MCP output schemas

1 participant