Skip to content

Commit 21083ca

Browse files
committed
test: own the registry launch-argument invariant; add changelog entry
- scripts/__tests__/mcp-metadata.test.ts asserts the checked-in server.json's agent-device npm package entry declares the exact fixed positional mcp argument (and stays stdio-only), so a missing or wrong argument fails the unit lane in both directions. Wired into the unit-core project include list. - Changelog: user-visible release fix under Unreleased.
1 parent 87fadfd commit 21083ca

3 files changed

Lines changed: 57 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
writing `airplane_mode_on` and broadcasting `ACTION_AIRPLANE_MODE_CHANGED` — a broadcast Android
1919
refuses for non-system callers, so the old path failed *after* writing the setting and left the
2020
device reporting airplane mode with the network still up (#2223). The response now reports the
21-
`airplaneMode` the connectivity service holds after the change, and an Android build that does not
22-
expose that command is refused with `UNSUPPORTED_OPERATION` before anything is written.
21+
`airplaneMode` the connectivity service holds after the change, and an Android build that does not
22+
expose that command is refused with `UNSUPPORTED_OPERATION` before anything is written.
23+
- Fixed: the MCP registry entry (`server.json`) now declares the fixed `mcp` subcommand via
24+
`packageArguments`, so a registry-format launcher — the MCP Registry or the website's
25+
`/.well-known/mcp.json` discovery manifest — starts the stdio MCP server. Previously it ran
26+
`agent-device` with no subcommand, i.e. the bare CLI (#2275).
2327
- Breaking (0.21): iOS Appium/WebDriver snapshots now expose engine-owned acquisition facts and
2428
typed fidelity warnings. The SDK snapshot `truncated` field is optional when Appium cannot report
2529
hierarchy completeness; regular snapshots fail closed without valid viewport evidence, while
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Guard for the registry-format launch argument.
3+
*
4+
* The MCP registry entry (and the website's `/.well-known/mcp.json` discovery manifest) tell a
5+
* launcher how to start the server: the npm package, the stdio transport, and
6+
* `packageArguments`. Without the fixed `mcp` positional argument, a client that honors the
7+
* manifest runs `agent-device` with no subcommand — the bare CLI — instead of the stdio MCP
8+
* server (`src/bin.ts` only starts the server for the `mcp` subcommand).
9+
*
10+
* `check:mcp-metadata` compares the file against a regeneration, which proves the corrected file
11+
* is self-consistent; this test owns the invariant directly against the checked-in file and fails
12+
* in both directions — a missing argument and a wrong one.
13+
*/
14+
import assert from 'node:assert/strict';
15+
import { readFile } from 'node:fs/promises';
16+
import { join } from 'node:path';
17+
import { test } from 'vitest';
18+
19+
const ROOT = join(import.meta.dirname, '..', '..');
20+
21+
const EXPECTED_MCP_PACKAGE_ARGUMENTS = [{ type: 'positional', value: 'mcp' }];
22+
23+
type ServerPackage = {
24+
registryType?: string;
25+
identifier?: string;
26+
transport?: { type?: string };
27+
packageArguments?: unknown;
28+
};
29+
30+
test('the published registry entry starts the MCP server, not the bare CLI', async () => {
31+
const pkg = JSON.parse(await readFile(join(ROOT, 'package.json'), 'utf8')) as {
32+
name: string;
33+
};
34+
const server = JSON.parse(await readFile(join(ROOT, 'server.json'), 'utf8')) as {
35+
packages?: ServerPackage[];
36+
};
37+
38+
const entry = (server.packages ?? []).find((candidate) => candidate.identifier === pkg.name);
39+
assert.ok(entry, `server.json must describe the ${pkg.name} npm package`);
40+
assert.equal(entry.registryType, 'npm');
41+
assert.deepEqual(entry.transport, { type: 'stdio' });
42+
43+
assert.deepEqual(
44+
entry.packageArguments,
45+
EXPECTED_MCP_PACKAGE_ARGUMENTS,
46+
'registry-format launchers must start the stdio MCP server; without the fixed mcp subcommand they run the bare CLI',
47+
);
48+
});

‎vitest.config.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ export default defineConfig({
147147
// Publish preparation spawns only fixture-owned scripts and proves both Android
148148
// helper families are rebuilt through the shared release/size-report owner.
149149
'scripts/__tests__/prepare-publish-assets.test.ts',
150+
// Parse-only guard on the checked-in registry entry: the npm package must declare
151+
// the fixed mcp subcommand, or registry-format launchers run the bare CLI.
152+
'scripts/__tests__/mcp-metadata.test.ts',
150153
'scripts/ios-snapshot-benchmark/*.test.ts',
151154
// Parses CI configuration only, so this action guard needs no device or subprocess lane.
152155
'test/ci/upload-agent-device-artifacts.test.ts',

0 commit comments

Comments
 (0)