-
-
Notifications
You must be signed in to change notification settings - Fork 315
refactor(mcp): project interaction family output schemas from their owning module #3025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thymikee
merged 2 commits into
refactor/mcp-output-schemas-2819-system-index-schemas
from
refactor/mcp-output-schemas-2819-interaction-index-schemas
Sep 29, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
58 changes: 58 additions & 0 deletions
58
src/mcp/__tests__/command-tools-interaction-schemas.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import assert from 'node:assert/strict'; | ||
| import { test } from 'vitest'; | ||
| import { ownerFilesForCommand } from '@agent-device/command-registry/owner-files'; | ||
| import { INTERACTION_COMMAND_OUTPUT_SCHEMAS } from '../../commands/interaction/index.ts'; | ||
| import { COMMAND_OUTPUT_SCHEMAS } from '../command-output-schemas.ts'; | ||
|
|
||
| const INTERACTION_COMMANDS = Object.keys(INTERACTION_COMMAND_OUTPUT_SCHEMAS) as Array< | ||
| keyof typeof INTERACTION_COMMAND_OUTPUT_SCHEMAS | ||
| >; | ||
|
|
||
| // press, click, fill, longpress, and hover carry the post-action observation trait (#1652): the | ||
| // composed map grafts a `settle` property onto a COPY, so they are not reference-equal to the | ||
| // module's own object. find carries no such trait. | ||
| const SETTLE_DERIVED_COMMANDS = new Set(['press', 'click', 'fill', 'longpress', 'hover']); | ||
|
|
||
| test('MCP interaction family output schemas are the family module entries, not copies', () => { | ||
| for (const command of INTERACTION_COMMANDS) { | ||
| if (SETTLE_DERIVED_COMMANDS.has(command)) continue; | ||
| assert.equal( | ||
| COMMAND_OUTPUT_SCHEMAS[command], | ||
| INTERACTION_COMMAND_OUTPUT_SCHEMAS[command], | ||
| `${command} is not reference-equal to the interaction module's own schema object`, | ||
| ); | ||
| } | ||
| }); | ||
|
|
||
| test('a settle-derived interaction entry still grafts onto the module object, not a foreign copy', () => { | ||
| const modulePress = INTERACTION_COMMAND_OUTPUT_SCHEMAS.press; | ||
| const derivedPress = COMMAND_OUTPUT_SCHEMAS.press; | ||
| assert.notEqual( | ||
| derivedPress, | ||
| modulePress, | ||
| 'the derivation pass must copy, never mutate in place', | ||
| ); | ||
| assert.equal(derivedPress.required, modulePress.required, 'required list is not re-derived'); | ||
| assert.equal( | ||
| derivedPress.properties?.targetKind, | ||
| modulePress.properties?.targetKind, | ||
| 'a field object nested under the derived copy must still be the module property, not a rebuild', | ||
| ); | ||
| assert.ok( | ||
| derivedPress.properties?.settle, | ||
| 'the settle-capable command must carry the grafted observation property', | ||
| ); | ||
| }); | ||
|
|
||
| test('press and click share the same tap response schema object', () => { | ||
| assert.equal(INTERACTION_COMMAND_OUTPUT_SCHEMAS.press, INTERACTION_COMMAND_OUTPUT_SCHEMAS.click); | ||
| }); | ||
|
|
||
| test('the projected family map declares exactly the commands its module owns', () => { | ||
| for (const command of INTERACTION_COMMANDS) { | ||
| assert.ok( | ||
| ownerFilesForCommand(command).includes('src/commands/interaction/index.ts'), | ||
| `${command} projects its output schema from this module but does not name it as its owner`, | ||
| ); | ||
| } | ||
| }); |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3:
INTERACTION_COMMAND_OUTPUT_SCHEMASis exported as a mutable object, despite the promised frozen projection map. Wrap the map inObject.freezeso consumers cannot replace its command entries or mutate the canonical projection through the exported map.Prompt for AI agents