Skip to content

refactor(mcp): project prepare family output schema from its owning module - #3038

Merged
thymikee merged 2 commits into
refactor/mcp-output-schemas-2819-capture-wait-schemafrom
refactor/mcp-output-schemas-2819-management-prepare-schema
Sep 29, 2026
Merged

thymikee merged 2 commits into
refactor/mcp-output-schemas-2819-capture-wait-schemafrom
refactor/mcp-output-schemas-2819-management-prepare-schema

Conversation

@thymikee

@thymikee thymikee commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves the single hand-authored MCP outputSchema entry for prepare out of src/mcp/command-output-schemas.ts into a frozen PREPARE_COMMAND_OUTPUT_SCHEMAS map exported from its owning module, src/commands/management/prepare.ts. This follows the #2810 projection seam already used on this stack by the replay, system, interaction, device-management, push-management, viewport, recording, and capture-wait families: command-output-schemas.ts now imports and spreads the family map instead of hand-authoring the entry, and PROJECTED_FAMILIES in command-tools-replay-schemas.test.ts gains the management-prepare entry so the disjointness check covers it. prepare's descriptor declares no post-action observation trait (#1652), so no settle-graft copy applies.

Part of #2819. 4 files touched. Stacked on refactor/mcp-output-schemas-2819-capture-wait-schema.

Validation

Tested at 02064bb5ee.

pnpm check:affected --run: all 164 affected test files / 1369 tests passed, including the new command-tools-management-prepare-schemas.test.ts (reference-equality + owner-file checks) and the updated disjointness test.

No device-facing behavior changed (pure MCP-schema-projection move; prepare is not even MCP-exposed). Proved it with a before/after JSON byte-diff of COMMAND_OUTPUT_SCHEMAS.prepare instead of a live device run:

{"type":"object","properties":{"action":{"type":"string","const":"ios-runner"},"platform":{"type":"string","enum":["ios","macos","android","harmonyos","vega","linux","web"]},"deviceId":{"type":"string"},"deviceName":{"type":"string"},"kind":{"type":"string","enum":["simulator","emulator","device"]},"durationMs":{"type":"number"},"runner":{"type":"object","properties":{}},"cache":{"type":"string","enum":["exact","miss","external"]},"artifact":{"type":"string","enum":["valid","rebuilt"]},"buildMs":{"type":"number"},"connectMs":{"type":"number"},"healthCheckMs":{"type":"number"},"xctestrunPath":{"type":"string"},"recoveryReason":{"type":"string"},"failureReason":{"type":"string"},"timing":{"type":"object","properties":{"totalMs":{"type":"number"},"additiveParts":{"type":"object","properties":{"buildMs":{"type":"number"},"connectAfterBuildMs":{"type":"number"},"healthCheckMs":{"type":"number"}},"required":["connectAfterBuildMs","healthCheckMs"]},"containment":{"type":"object","properties":{"connectMs":{"type":"array","items":{"type":"string","const":"buildMs"}},"healthCheckMs":{"type":"array","items":{"type":"string"}}},"required":["healthCheckMs"]},"note":{"type":"string"}},"required":["totalMs","additiveParts","containment","note"]},"message":{"type":"string"}},"required":["action","platform","deviceId","deviceName","kind","durationMs","runner","connectMs","healthCheckMs","timing","message"]}

This dump is byte-identical on the head commit and on origin/main (the entry on this stack was still byte-identical to origin/main before this move). No unresolved risk.

Review in cubic

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.88 MB 4.88 MB +35 B
Package (unpacked) 4.88 MB 4.88 MB +35 B
Package (download) 1.46 MB 1.46 MB +17 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 23.4 ms 24.1 ms +0.7 ms
CLI --help 66.1 ms 67.1 ms +1.0 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 4 files

Re-trigger cubic

@thymikee
thymikee added this pull request to stack #3043 September 28, 2026 13:44
@thymikee

Copy link
Copy Markdown
Member Author

Reviewed at 02064bb. This looks good: the prepare output schema and its tests move to the owning module unchanged. The new PUBLIC_PLATFORMS import in prepare.ts adds no eager edge, because @agent-device/kernel/device is already in the CLI import closure.

The Coverage failure is the same eager-closure budget check as on the rest of this stack, through src/commands/system/index.ts and src/commands/recording/index.ts, which this diff does not touch. The Smoke Tests failure does not overlap this diff.

Not blocking: DEVICE_KINDS and constSchema() in prepare.ts are copies of the ones in device.ts and command-output-schemas.ts. This is fine mid-migration, and one export can replace them when #2819 is done.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 28, 2026
…odule

Moves the single hand-authored MCP outputSchema entry for prepare out of
command-output-schemas.ts into a frozen PREPARE_COMMAND_OUTPUT_SCHEMAS map
exported from src/commands/management/prepare.ts, following the #2810
projection seam already used by the replay, system, interaction,
device-management, push-management, viewport, recording, and capture-wait
families on this stack. Registers the family in the PROJECTED_FAMILIES
disjointness check and adds command-tools-management-prepare-schemas.test.ts
with a reference-equality proof against the module object and an owner-file
check, matching the pattern from the other projected families. prepare's
descriptor declares no post-action observation trait (#1652), so no
settle-graft copy applies here.

The moved code is byte-identical to what command-output-schemas.ts held:
same objectSchema/numberSchema/stringSchema/enumSchema/constSchema calls
and field order. Verified the published outputSchema for prepare is
byte-identical to origin/main by dumping COMMAND_OUTPUT_SCHEMAS.prepare as
JSON on both refs.

Part of #2819.
@thymikee
thymikee force-pushed the refactor/mcp-output-schemas-2819-management-prepare-schema branch from 02064bb to 0aeb0ad Compare September 29, 2026 06:25
@thymikee

Copy link
Copy Markdown
Member Author

Rebased onto the updated capture-wait branch; the head is now 0aeb0ad.

  • Duplicate helpers (non-blocking note): prepare.ts no longer has its own copies of DEVICE_KINDS and constSchema(). It imports the shared constSchema from command-input.ts and DEVICE_KINDS from @agent-device/kernel/device, both already in the CLI import closure, so no new eager edge (commit 0aeb0ad). grep shows one constSchema declaration left in src/ and packages/.
  • Coverage and Smoke Tests: the earlier failures were the eager-closure budget check through files this diff does not touch, and the iOS smoke flake. Please re-check them on the new head.
  • Locally pnpm check:affected --run passes.

@thymikee

Copy link
Copy Markdown
Member Author

The changes in 0aeb0ad look good. The earlier review at 02064bb was also clean, and this update only swaps two bindings in prepare.ts. The imported modules were already in that file's closure at 02064bb, so I read this as not adding a new import edge.

I did not run the eager-closure budget test or the MCP schema tests, so that reading comes from the imports only. Seven CI jobs are still running: Smoke (three), Repo Guards, Typecheck & Package, Coverage and Integration. The change touches no device or runner path, so I expect those jobs to pass. Please wait for them to finish green before merging.

@thymikee
thymikee merged commit 7d198b7 into main Sep 29, 2026
19 checks passed
@thymikee
thymikee deleted the refactor/mcp-output-schemas-2819-management-prepare-schema branch September 29, 2026 09:52
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.

1 participant