Skip to content

refactor(mcp): project diff family output schema from its owning module - #3042

Merged
thymikee merged 1 commit into
refactor/mcp-output-schemas-2819-management-doctor-schemafrom
refactor/mcp-output-schemas-2819-capture-diff-schema
Sep 29, 2026
Merged

thymikee merged 1 commit into
refactor/mcp-output-schemas-2819-management-doctor-schemafrom
refactor/mcp-output-schemas-2819-capture-diff-schema

Conversation

@thymikee

@thymikee thymikee commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves the single hand-authored MCP outputSchema entry for diff out of command-output-schemas.ts into a frozen DIFF_COMMAND_OUTPUT_SCHEMAS map exported from src/commands/capture/diff.ts, following the #2819 projection seam already used by wait and the other migrated families on this stack. Registers the family in the PROJECTED_FAMILIES disjointness check and adds command-tools-capture-diff-schemas.test.ts with a reference-equality proof against the module object and an owner-file check.

diff does not carry the post-action observation trait (#1652): it reports a snapshot comparison, not an interaction, so no settle-graft copy applies here.

Closes #2819.

4 files touched. Stacked on refactor/mcp-output-schemas-2819-management-doctor-schema.

Validation

Tested commit: 77c002f109b77b2f8c1bbe4aaf87c5da06a02e77

pnpm check:affected --run: 166 test files / 1373 tests passed, no failures.

No device needed — this is a pure MCP schema move. Proved byte-identical output two ways:

  1. Diffed the moved code block against git show c58fe851e2:src/mcp/command-output-schemas.ts (origin/main tip) — the diff: entry (mode/baselineInitialized/summary/lines/warnings, same objectSchema/numberSchema/enumSchema/stringSchema/stringArraySchema calls, same field order) is byte-for-byte identical.
  2. Diffed src/commands/command-input.ts (the schema-primitive helpers) between origin/main and this head — zero differences, confirming the helpers diff.ts now calls are unchanged.

No unresolved risk: the change is a pure move with no schema-shape delta.

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 +28 B
Package (unpacked) 4.88 MB 4.88 MB +28 B
Package (download) 1.46 MB 1.46 MB +92 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.1 ms 27.6 ms +0.5 ms
CLI --help 82.1 ms 83.8 ms +1.7 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.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread src/commands/capture/diff.ts Outdated
@thymikee
thymikee added this pull request to stack #3043 September 28, 2026 13:44
@thymikee

Copy link
Copy Markdown
Member Author

Reviewed at 77c002f. The moved diff output schema matches the hand-authored one it replaces, so this is ready for human review.

Not blocking: the lines item schema at src/commands/capture/diff.ts line 55 only allows kind: 'added' | 'removed', but snapshot-diff.ts also pushes unchanged context lines into that array. An MCP client that validates output could then reject a normal diff response. Adding 'unchanged' to that enum fixes it, here or in a follow-up.

CI: the Coverage and Smoke Tests failures look unrelated to this diff. The eager-closure budget growth comes from the fold-runtime import in system/index.ts, which already exists at the base (ad91cc3). The wait-runtime and iOS onboarding failures run daemon and app-launch paths this PR does not touch. I did not rerun them, so the base branch should confirm whether they are pre-existing or flaky. The base branch needs to clear its Coverage failure before the stack goes green.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 28, 2026
Moves the single hand-authored MCP outputSchema entry for diff out of
command-output-schemas.ts into a frozen DIFF_COMMAND_OUTPUT_SCHEMAS map
exported from src/commands/capture/diff.ts, following the #2819 projection
seam already used by wait and the other migrated families on this stack.
Registers the family in the PROJECTED_FAMILIES disjointness check and adds
command-tools-capture-diff-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. diff does not carry the post-action
observation trait (#1652): it reports a snapshot comparison, not an
interaction, so no settle-graft copy applies here.

The moved code is byte-identical to what command-output-schemas.ts held:
same objectSchema/numberSchema/enumSchema/stringSchema/stringArraySchema
call and field order, and the shared command-input.ts helpers are
unchanged from origin/main, so the published outputSchema for diff stays
byte-identical to origin/main.

Part of #2819.
@thymikee
thymikee force-pushed the refactor/mcp-output-schemas-2819-capture-diff-schema branch from 77c002f to bb0cc29 Compare September 29, 2026 06:35
@thymikee

Copy link
Copy Markdown
Member Author

Rebased onto the updated base (management-doctor-schema); new head is bb0cc29.

  • diff line kinds: added unchanged to the enum, with a test (in bb0cc29). The snapshot diff does emit context lines, so clients that validate output would have rejected them.
  • The private constSchema copy is gone; the diff module now imports the shared one from command-input.ts. The old local DEVICE_KINDS and postActionSurfaceChangeSchema copies in the MCP schema file are removed too, since they now live below (grep shows one declaration of each).
  • Coverage: the eager-closure growth came from the base branch's import, which the base has since fixed. This diff adds no new static edge to the CLI or fold-runtime closure.

pnpm check:affected --run passes locally on this head.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready as of bb0cc29. The earlier review at 77c002f was also clean, and the diff family output schema now comes from its owning module with no remaining code issues. CI is green and there are no conflicts, so nothing else must happen before merge.

Not blocking: the projection in src/commands/capture/diff.ts (https://github.com/callstack/agent-device/blob/bb0cc29/src/commands/capture/diff.ts#L52) widens lines.kind to include 'unchanged', which is more than a pure move, so you could mention that in the PR body or CHANGELOG, or leave it as is.

I did not run the tests locally. I also did not check that the daemon emits 'unchanged' lines on the production route; I relied on the contract type.

@thymikee
thymikee merged commit cb867ba into main Sep 29, 2026
19 checks passed
@thymikee
thymikee deleted the refactor/mcp-output-schemas-2819-capture-diff-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.

Migrate the remaining 28 hand-authored MCP output schemas to their owning command modules

1 participant