@acid-cat/cli 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -89,9 +89,9 @@ Each flag has an equivalent option for `conform()` in code. Give one or more sur
89
89
  - [Webhook delivery](../../spec/surfaces/mcp.md#webhook): Through MCP over HTTP, with the three `--webhook-*` options. The checks run an HTTPS receiver on `127.0.0.1` with that certificate. Configure the deployment to trust the certificate, allow deliveries to private addresses, and give the principal `<name>` to a request with `Authorization: Bearer <name>`. The deadline must be longer than the deployment's first retry wait, and the maximum lifetime must be longer than the deadline. Give `--webhook-other-principal` with `--webhook-max-subscriptions`: the limit check then fills a principal that no other check uses. Without the webhook options, a server that does not list `webhook` must answer `Unsupported`.
90
90
  - [Server Card](../../spec/surfaces/mcp.md#server-card): Through MCP over HTTP, when `<mcp>/server-card` gives 200. The card must pass the JSON Schema of the Server Card extension, have one remote with the URL of `--mcp`, the version of `server/discover` and the revisions that the server serves, the CORS and cache headers, 304 for its `ETag`, 204 for `OPTIONS`, public signing keys only, and egress ranges in CIDR text. With the webhook options and signing keys in the card, each webhook request must have one `v1a,` signature for each key, and each must verify. The JSON Schema is `conformance/server-card.schema.json`, from commit `28db12c` of [ext-server-card](https://github.com/modelcontextprotocol/ext-server-card), under the Apache License 2.0 in `conformance/server-card.LICENSE`.
91
91
  - [Hints](../../spec/surfaces/mcp.md#tools): Each MCP tool's annotations match its capability's hints.
92
- - [Heartbeat](../../spec/surfaces/mcp.md#push): Through MCP with each transport, each `notifications/events/active` grants a `heartbeatMs`. A suggestion is clamped between 1000 and 60 000, a heartbeat comes after the grant, and a suggestion that is not valid gets `-32602`.
92
+ - [Heartbeat](../../spec/surfaces/mcp.md#push): Through MCP with each transport, each `notifications/events/active` grants a `heartbeatMs`. A suggestion is clamped between 1000 and 60 000, a heartbeat comes no sooner than the grant after the request and before the deadline ([why](../../spec/conformance.md#the-silence-before-a-heartbeat)), and a suggestion that is not valid gets `-32602`.
93
93
  - [Headers](../../spec/surfaces/mcp.md#headers): Through MCP over HTTP, a missing or wrong `Mcp-Method`, `Mcp-Name` or `Mcp-Param-*` header on `tools/call` and `events/stream` gets 400 and `-32020`, and a value in the base64 form is decoded, with a leading U+FEFF kept. Every request of conform mirrors the annotated arguments of the fixture (`fixture.switch.set` and `fixture.ticks`) into their headers.
94
- - Properties: With fast-check, through MCP and HTTP: concurrent calls each get their own outcome, and a cancellation changes only its own call.
94
+ - Properties: With fast-check, through MCP and HTTP: concurrent calls each get their own outcome, and a cancellation changes only its own call. Each run of a property has the deadline.
95
95
 
96
96
  Each poll check uses a new key, so leases from an earlier run do not change the result.
97
97
 
@@ -105,7 +105,7 @@ A failed check of a SHOULD rule gives a warning, marked `!`, and passes. The exi
105
105
 
106
106
  ### Use it in code
107
107
 
108
- `conform()` and `serve()` come from `@acid-cat/cli`. This `serve()` is for tests only: it listens on `127.0.0.1`, on a free port, with plain HTTP. To serve an application, use its core's server: `serve` from `@acid-cat/core-ts/node`, `NodeServer` from `@acid-cat/core-effect`, or `remote::serve` from the crate `acid-cat-core`.
108
+ `conform()` and `serve()` come from `@acid-cat/cli`. Give `conform()` the signal of the test as `signal`, so that it stops when the test ends: each check that runs stops and kills the processes that it started, no other check and no other surface starts, and the promise rejects with the reason of the signal. This `serve()` is for tests only: it listens on `127.0.0.1`, on a free port, with plain HTTP. Like the servers of the cores, it closes no idle connection, so that a client of a test never sends a request on a connection while the server closes it. Its `close()` ends each idle connection at once, and ends each other connection when both its request and its response are complete, so it cuts no request that the server accepted. It resolves when every connection has ended, so a response that does not end, such as an open event stream, keeps it waiting. To serve an application, use its core's server: `serve` from `@acid-cat/core-ts/node`, `NodeServer` from `@acid-cat/core-effect`, or `remote::serve` from the crate `acid-cat-core`.
109
109
 
110
110
  ## Implementation
111
111
 
@@ -16,6 +16,8 @@ export declare const idsOf: (target: string) => string[];
16
16
  export declare const eventIdsOf: (target: string) => string[];
17
17
  export declare function expectOccurrence(value: unknown, id: string): Occurrence;
18
18
  export declare const DEADLINE = 30000;
19
+ /** A signal that aborts when `signal` aborts, or when `stop`, the signal that stops conform, aborts. */
20
+ export declare const orStop: (signal: AbortSignal, stop: AbortSignal | undefined) => AbortSignal;
19
21
  type Body = (signal: AbortSignal) => Promise<void> | void;
20
22
  export type Define = (name: string, rule: string, body: Body) => void;
21
23
  export declare class Checks {
@@ -23,8 +25,15 @@ export declare class Checks {
23
25
  readonly results: Check[];
24
26
  readonly surface: string;
25
27
  readonly deadline: number;
26
- constructor(surface: string, deadline: number);
28
+ /** When it aborts, each check that runs stops as at its deadline, and no other check starts. */
29
+ readonly signal: AbortSignal | undefined;
30
+ constructor(surface: string, deadline: number, signal?: AbortSignal);
27
31
  run(name: string, rule: string, body: Body): Promise<void>;
32
+ /**
33
+ * Run a check of several runs, such as the runs of a property. Each run has the deadline, so the number of runs that
34
+ * fit in the check does not depend on the speed of the computer.
35
+ */
36
+ runEach(name: string, rule: string, body: (each: (run: Body) => Promise<void>) => Promise<void>): Promise<void>;
28
37
  concurrently(define: (check: Define) => void): Promise<void>;
29
38
  should(name: string, rule: string, body: Body): Promise<void>;
30
39
  }
@@ -41,17 +41,43 @@ function expectOccurrence(value, id) {
41
41
  return value;
42
42
  }
43
43
  const DEADLINE = 3e4;
44
+ /** A signal that aborts when `signal` aborts, or when `stop`, the signal that stops conform, aborts. */
45
+ const orStop = (signal, stop) => stop === void 0 ? signal : AbortSignal.any([signal, stop]);
44
46
  var Checks = class {
45
47
  results = [];
46
48
  surface;
47
49
  deadline;
48
- constructor(surface, deadline) {
50
+ /** When it aborts, each check that runs stops as at its deadline, and no other check starts. */
51
+ signal;
52
+ constructor(surface, deadline, signal) {
49
53
  this.surface = surface;
50
54
  this.deadline = deadline;
55
+ this.signal = signal;
51
56
  }
52
57
  async run(name, rule, body) {
53
58
  this.results.push(this.#result(name, rule, await this.#settle(body)));
54
59
  }
60
+ /**
61
+ * Run a check of several runs, such as the runs of a property. Each run has the deadline, so the number of runs that
62
+ * fit in the check does not depend on the speed of the computer.
63
+ */
64
+ async runEach(name, rule, body) {
65
+ let late = false;
66
+ const each = async (run) => {
67
+ const failure = await this.#settle(run);
68
+ if (failure === void 0) return;
69
+ late ||= failure.startsWith("did not settle");
70
+ throw new Error(failure);
71
+ };
72
+ let failure;
73
+ try {
74
+ await body(each);
75
+ } catch (error) {
76
+ const message = error instanceof Error ? error.message : String(error);
77
+ failure = late && !message.startsWith("did not settle") ? `did not settle within ${this.deadline} ms: ${message}` : message;
78
+ }
79
+ this.results.push(this.#result(name, rule, failure));
80
+ }
55
81
  async concurrently(define) {
56
82
  const defined = [];
57
83
  define((name, rule, body) => defined.push({
@@ -97,17 +123,25 @@ var Checks = class {
97
123
  detail: failure
98
124
  });
99
125
  }
126
+ #stopped() {
127
+ return this.signal?.aborted === true;
128
+ }
100
129
  async #settle(body) {
130
+ if (this.#stopped()) return "conform stopped before the check";
101
131
  const controller = new AbortController();
102
- const timer = setTimeout(() => controller.abort(), this.deadline);
132
+ const stop = () => controller.abort();
133
+ const timer = setTimeout(stop, this.deadline);
134
+ this.signal?.addEventListener("abort", stop, { once: true });
103
135
  try {
104
136
  await body(controller.signal);
105
137
  return;
106
138
  } catch (error) {
107
139
  const message = error instanceof Error ? error.message : String(error);
140
+ if (this.#stopped()) return `conform stopped during the check: ${message}`;
108
141
  return controller.signal.aborted ? `did not settle within ${this.deadline} ms: ${message}` : message;
109
142
  } finally {
110
143
  clearTimeout(timer);
144
+ this.signal?.removeEventListener("abort", stop);
111
145
  controller.abort();
112
146
  }
113
147
  }
@@ -141,4 +175,4 @@ function expectEqual(actual, expected, what) {
141
175
  }
142
176
  const sorted = (values) => [...values].sort();
143
177
  const FORBIDDEN_ORIGIN = "https://not-allowed.acid-cat.invalid";
144
- export { Checks, DEADLINE, FORBIDDEN_ORIGIN, abortable, eventIdsOf, expect, expectEqual, expectOccurrence, fixture, idsOf, isOutcome, sorted, until };
178
+ export { Checks, DEADLINE, FORBIDDEN_ORIGIN, abortable, eventIdsOf, expect, expectEqual, expectOccurrence, fixture, idsOf, isOutcome, orStop, sorted, until };
@@ -1,4 +1,5 @@
1
1
  import { Checks } from "./check.js";
2
2
  export declare function checkCli(command: readonly string[], options: {
3
3
  readonly deadline: number;
4
+ readonly signal?: AbortSignal | undefined;
4
5
  }): Promise<Checks>;
@@ -1,5 +1,5 @@
1
1
  import { isArrayOf, isObject, memberOf, parseJson } from "../json.js";
2
- import { Checks, abortable, eventIdsOf, expect, expectEqual, expectOccurrence, idsOf, sorted, until } from "./check.js";
2
+ import { Checks, abortable, eventIdsOf, expect, expectEqual, expectOccurrence, idsOf, orStop, sorted, until } from "./check.js";
3
3
  import { tmpdir } from "node:os";
4
4
  import { spawn } from "node:child_process";
5
5
  import { existsSync } from "node:fs";
@@ -100,9 +100,9 @@ function occurrencesIn(stdout, id) {
100
100
  return stdout.split("\n").filter((line) => line !== "").map((line) => expectOccurrence(parseJson(line), id));
101
101
  }
102
102
  async function checkCli(command, options) {
103
- const checks = new Checks("cli", options.deadline);
103
+ const checks = new Checks("cli", options.deadline, options.signal);
104
104
  const run = (signal, ...args) => start(command, args, signal).run;
105
- const listing = start(command, ["list"], AbortSignal.timeout(options.deadline)).run.then((result) => entriesOf(result.stdout));
105
+ const listing = start(command, ["list"], orStop(AbortSignal.timeout(options.deadline), options.signal)).run.then((result) => entriesOf(result.stdout));
106
106
  listing.catch(() => void 0);
107
107
  const listed = (signal) => abortable(listing, signal);
108
108
  await checks.concurrently((check) => {
@@ -2,4 +2,5 @@ import { Checks } from "./check.js";
2
2
  export declare function checkHttp(base: string, options: {
3
3
  readonly maximumBytes: number;
4
4
  readonly deadline: number;
5
+ readonly signal?: AbortSignal | undefined;
5
6
  }): Promise<Checks>;
@@ -11,7 +11,7 @@ async function entriesOf(response) {
11
11
  return list;
12
12
  }
13
13
  async function checkHttp(base, options) {
14
- const checks = new Checks("http", options.deadline);
14
+ const checks = new Checks("http", options.deadline, options.signal);
15
15
  const post = (signal, id, body, headers = {}) => fetch(`${base}/capabilities/${id}`, {
16
16
  method: "POST",
17
17
  headers: {
@@ -58,6 +58,12 @@ export interface ConformOptions {
58
58
  * default is `DEADLINE`, 30 seconds.
59
59
  */
60
60
  readonly deadline?: number | undefined;
61
+ /**
62
+ * When it aborts, conform stops: each check that runs stops as at its deadline and cleans up, no other check and no
63
+ * other surface starts, and the promise rejects with the reason of the signal. A test gives its own signal, so that
64
+ * conform ends with the test.
65
+ */
66
+ readonly signal?: AbortSignal | undefined;
61
67
  }
62
68
  /** Run all checks for the surfaces that the options give. */
63
69
  export declare function conform(options: ConformOptions): Promise<readonly Check[]>;
@@ -1,4 +1,4 @@
1
- import { Checks, DEADLINE, fixture } from "./check.js";
1
+ import { Checks, DEADLINE, fixture, orStop } from "./check.js";
2
2
  import { checkCli } from "./cli.js";
3
3
  import { checkHttp } from "./http.js";
4
4
  import { checkMcp, httpChannel } from "./mcp.js";
@@ -13,45 +13,67 @@ async function conform(options) {
13
13
  const maximumBytes = options.maximumBytes ?? 1048576;
14
14
  const deadline = options.deadline ?? 3e4;
15
15
  const poll = options.poll ?? {};
16
+ const { signal } = options;
16
17
  const results = [];
18
+ signal?.throwIfAborted();
17
19
  if (options.mcp !== void 0) {
18
20
  results.push(...(await checkMcp(options.mcp, {
19
21
  maximumBytes,
20
22
  deadline,
23
+ signal,
21
24
  handshake: options.mcpHandshake === true,
22
25
  poll,
23
26
  webhook: options.webhook
24
27
  })).results);
25
- const mcp = await mcpInvoke(options.mcp, AbortSignal.timeout(deadline)).catch(() => void 0);
28
+ signal?.throwIfAborted();
29
+ const mcp = await mcpInvoke(options.mcp, orStop(AbortSignal.timeout(deadline), signal)).catch(() => void 0);
26
30
  if (mcp !== void 0) {
27
- results.push(...(await checkProperties("mcp", mcp.invoke, deadline)).results);
31
+ results.push(...(await checkProperties("mcp", mcp.invoke, deadline, signal)).results);
28
32
  await mcp.close();
29
33
  }
34
+ signal?.throwIfAborted();
30
35
  }
31
36
  if (options.pollLease !== void 0) {
32
- const checks = new Checks("mcp", deadline);
37
+ const checks = new Checks("mcp", deadline, signal);
33
38
  await checkPollLease(checks, httpChannel(options.pollLease.mcp), options.pollLease.leaseMs);
34
39
  results.push(...checks.results);
40
+ signal?.throwIfAborted();
41
+ }
42
+ if (options.mcpStdio !== void 0) {
43
+ for (const checks of await checkMcpStdio(options.mcpStdio, {
44
+ deadline,
45
+ signal,
46
+ poll
47
+ })) results.push(...checks.results);
48
+ signal?.throwIfAborted();
35
49
  }
36
- if (options.mcpStdio !== void 0) for (const checks of await checkMcpStdio(options.mcpStdio, {
37
- deadline,
38
- poll
39
- })) results.push(...checks.results);
40
50
  if (options.http !== void 0) {
41
51
  results.push(...(await checkHttp(options.http, {
42
52
  maximumBytes,
43
- deadline
53
+ deadline,
54
+ signal
55
+ })).results);
56
+ results.push(...(await checkProperties("http", httpInvoke(options.http), deadline, signal)).results);
57
+ signal?.throwIfAborted();
58
+ }
59
+ if (options.cli !== void 0) {
60
+ results.push(...(await checkCli(options.cli, {
61
+ deadline,
62
+ signal
44
63
  })).results);
45
- results.push(...(await checkProperties("http", httpInvoke(options.http), deadline)).results);
64
+ signal?.throwIfAborted();
46
65
  }
47
- if (options.cli !== void 0) results.push(...(await checkCli(options.cli, { deadline })).results);
48
66
  if (options.webmcp !== void 0) {
49
67
  const driver = typeof options.webmcp === "string" ? await browserDriver(options.webmcp) : await processDriver(options.webmcp);
50
68
  try {
51
- results.push(...(await checkWebMcp(driver, { deadline })).results);
69
+ results.push(...(await checkWebMcp(driver, {
70
+ deadline,
71
+ signal
72
+ })).results);
52
73
  } finally {
53
74
  await driver.close();
54
75
  }
76
+ signal?.throwIfAborted();
55
77
  }
56
78
  return results;
57
79
  }
@@ -2,5 +2,6 @@ import { Checks } from "./check.js";
2
2
  import type { PollSettings } from "./poll.js";
3
3
  export declare function checkMcpStdio(command: readonly string[], options: {
4
4
  readonly deadline: number;
5
+ readonly signal?: AbortSignal | undefined;
5
6
  readonly poll: PollSettings;
6
7
  }): Promise<readonly Checks[]>;
@@ -1,5 +1,5 @@
1
1
  import { isObject, memberOf } from "../json.js";
2
- import { Checks, abortable, expect, expectEqual, until } from "./check.js";
2
+ import { Checks, abortable, expect, expectEqual, orStop, until } from "./check.js";
3
3
  import { META, checkEvents, checkTools, subscriptionOf } from "./mcp.js";
4
4
  import { checkProperties, clientInvoke } from "./properties.js";
5
5
  import { spawn } from "node:child_process";
@@ -46,7 +46,7 @@ async function connect(command, options, changes, signal) {
46
46
  async function checkMcpStdio(command, options) {
47
47
  const all = [];
48
48
  for (const era of ERAS) {
49
- const checks = new Checks(`mcp-stdio ${era.revision}`, options.deadline);
49
+ const checks = new Checks(`mcp-stdio ${era.revision}`, options.deadline, options.signal);
50
50
  all.push(checks);
51
51
  const changes = { count: 0 };
52
52
  let client;
@@ -59,7 +59,7 @@ async function checkMcpStdio(command, options) {
59
59
  try {
60
60
  await checkTools(checks, mcp);
61
61
  await checkChanges(checks, mcp, changes);
62
- all.push(await checkProperties(`mcp-stdio ${era.revision} properties`, clientInvoke(mcp), options.deadline));
62
+ all.push(await checkProperties(`mcp-stdio ${era.revision} properties`, clientInvoke(mcp), options.deadline, options.signal));
63
63
  } finally {
64
64
  await mcp.close();
65
65
  }
@@ -69,9 +69,9 @@ async function checkMcpStdio(command, options) {
69
69
  return all;
70
70
  }
71
71
  async function checkStdioEvents(command, options) {
72
- const checks = new Checks("mcp-stdio events", options.deadline);
72
+ const checks = new Checks("mcp-stdio events", options.deadline, options.signal);
73
73
  const controller = new AbortController();
74
- const server = startRaw(command, controller.signal);
74
+ const server = startRaw(command, orStop(controller.signal, options.signal));
75
75
  try {
76
76
  await checkEvents(checks, stdioChannel(server), {
77
77
  transport: "stdio",
@@ -222,7 +222,7 @@ async function handshake(server, revision = "2025-11-25") {
222
222
  return response;
223
223
  }
224
224
  async function checkLines(command, options) {
225
- const checks = new Checks("mcp-stdio", options.deadline);
225
+ const checks = new Checks("mcp-stdio", options.deadline, options.signal);
226
226
  const withServer = (body) => async (signal) => {
227
227
  const controller = new AbortController();
228
228
  const server = startRaw(command, AbortSignal.any([controller.signal, signal]));
@@ -7,6 +7,7 @@ export declare function mcpClient(url: string, signal?: AbortSignal, handshake?:
7
7
  export interface McpCheckOptions {
8
8
  readonly maximumBytes: number;
9
9
  readonly deadline: number;
10
+ readonly signal?: AbortSignal | undefined;
10
11
  readonly handshake: boolean;
11
12
  readonly poll: PollSettings;
12
13
  readonly webhook: WebhookSettings | undefined;
@@ -9,6 +9,8 @@ import { randomUUID } from "node:crypto";
9
9
  import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
10
10
  // src/conform/mcp.ts
11
11
  const RULE = "spec/surfaces/mcp.md";
12
+ /** Runtimes measure the idle time of a stream with timers of 1 ms resolution, so a heartbeat can come 1 ms early. */
13
+ const TIMER_RESOLUTION_MS = 1;
12
14
  async function mcpClient(url, signal, handshake = false) {
13
15
  const client = new Client({
14
16
  name: "acid-cat-conform",
@@ -22,7 +24,7 @@ const textOf = (result) => {
22
24
  return parseJson(first?.type === "text" ? first.text : "null");
23
25
  };
24
26
  async function checkMcp(url, options) {
25
- const checks = new Checks("mcp", options.deadline);
27
+ const checks = new Checks("mcp", options.deadline, options.signal);
26
28
  let client;
27
29
  await checks.run("an MCP client connects with revision 2026-07-28", `${RULE}#http`, async (signal) => {
28
30
  client = await mcpClient(url, signal);
@@ -224,7 +226,7 @@ async function checkHeaders(checks, url) {
224
226
  }
225
227
  const ANCHOR = `${RULE}#earlier-revisions-through-http`;
226
228
  async function checkHandshake(checks, url, deadline) {
227
- const handshakeChecks = new Checks("mcp 2025-11-25", deadline);
229
+ const handshakeChecks = new Checks("mcp 2025-11-25", deadline, checks.signal);
228
230
  let client;
229
231
  await handshakeChecks.run("an MCP client connects with the initialize handshake of revision 2025-11-25", ANCHOR, async (signal) => {
230
232
  client = await mcpClient(url, signal, true);
@@ -622,6 +624,7 @@ async function checkEvents(checks, channel, options) {
622
624
  const name = `events/stream with heartbeatMs: ${suggested} grants heartbeatMs: ${granted} on notifications/events/active${granted === MCP_HEARTBEAT_MIN_MS ? ", then sends heartbeats at that interval" : ""}`;
623
625
  await checks.run(name, `${RULE}#push`, async (signal) => {
624
626
  const id = streamId();
627
+ const requested = performance.now();
625
628
  const stream = await channel.stream(id, {
626
629
  name: "fixture.watch",
627
630
  arguments: { key: randomUUID() },
@@ -630,10 +633,9 @@ async function checkEvents(checks, channel, options) {
630
633
  try {
631
634
  await active(stream, id, granted);
632
635
  if (granted !== MCP_HEARTBEAT_MIN_MS) return;
633
- const started = Date.now();
634
636
  expectEqual(paramsOf(await notification(stream, id, "notifications/events/heartbeat")), { cursor: null }, "the params of notifications/events/heartbeat");
635
- const waited = Date.now() - started;
636
- expect(waited >= granted / 2 && waited < granted * 3, `the heartbeat must come about ${granted} ms after notifications/events/active, came after ${waited} ms`);
637
+ const waited = Math.round(performance.now() - requested);
638
+ expect(waited >= granted - TIMER_RESOLUTION_MS, `the heartbeat must come when the stream was idle for ${granted} ms, but it came ${waited} ms after the request`);
637
639
  } finally {
638
640
  await stream.cancel();
639
641
  }
@@ -9,4 +9,4 @@ export declare function mcpInvoke(url: string, signal: AbortSignal): Promise<{
9
9
  close(): Promise<void>;
10
10
  }>;
11
11
  export declare function clientInvoke(client: Client): Invoke;
12
- export declare function checkProperties(surface: string, invoke: Invoke, deadline: number): Promise<Checks>;
12
+ export declare function checkProperties(surface: string, invoke: Invoke, deadline: number, signal?: AbortSignal): Promise<Checks>;
@@ -124,28 +124,24 @@ const cancellations = fc.array(fc.boolean(), {
124
124
  minLength: 2,
125
125
  maxLength: 5
126
126
  }).filter((flags) => flags.includes(true) && flags.includes(false));
127
- async function checkProperties(surface, invoke, deadline) {
128
- const checks = new Checks(`${surface} properties`, deadline);
129
- await checks.run("concurrent calls each get exactly their own outcome", RULE, async (signal) => {
127
+ async function checkProperties(surface, invoke, deadline, signal) {
128
+ const checks = new Checks(`${surface} properties`, deadline, signal);
129
+ await checks.runEach("concurrent calls each get exactly their own outcome", RULE, async (each) => {
130
130
  await fc.assert(fc.asyncProperty(fc.array(operation, {
131
131
  minLength: 1,
132
132
  maxLength: 12
133
- }), async (operations) => {
134
- fc.pre(!signal.aborted);
133
+ }), (operations) => each(async (signal) => {
135
134
  (await Promise.all(operations.map(async (op) => ({
136
135
  op,
137
136
  outcome: await callFor(invoke, op, signal)
138
137
  })))).forEach(({ op, outcome }) => expect(agrees(op, outcome), `${op.kind} gave ${JSON.stringify(outcome)}`));
139
- }), {
138
+ })), {
140
139
  numRuns: 25,
141
140
  includeErrorInReport: true
142
141
  });
143
142
  });
144
- await checks.run("cancelling a call affects only that call", RULE, async (signal) => {
145
- await fc.assert(fc.asyncProperty(cancellations, (flags) => {
146
- fc.pre(!signal.aborted);
147
- return cancelSome(invoke, flags, signal, deadline);
148
- }), {
143
+ await checks.runEach("cancelling a call affects only that call", RULE, async (each) => {
144
+ await fc.assert(fc.asyncProperty(cancellations, (flags) => each((signal) => cancelSome(invoke, flags, signal, deadline))), {
149
145
  numRuns: 5,
150
146
  includeErrorInReport: true
151
147
  });
@@ -4,7 +4,10 @@ import { createServer } from "node:http";
4
4
  function serve(handler) {
5
5
  const routes = typeof handler === "function" ? { "/": handler } : handler;
6
6
  const prefixes = Object.keys(routes).sort((a, b) => b.length - a.length);
7
- const server = createServer((incoming, outgoing) => {
7
+ const server = createServer({ keepAliveTimeout: 0 }, (incoming, outgoing) => {
8
+ const closeIfIdle = () => server.listening || server.closeIdleConnections();
9
+ incoming.on("end", closeIfIdle);
10
+ outgoing.on("finish", closeIfIdle);
8
11
  answer(incoming, outgoing, prefixes, routes);
9
12
  });
10
13
  return new Promise((resolve) => {
@@ -49,4 +49,5 @@ export declare function processDriver(install: WebMcpInstall): Promise<WebMcpDri
49
49
  export declare function browserDriver(url: string): Promise<WebMcpDriver>;
50
50
  export declare function checkWebMcp(driver: WebMcpDriver, options: {
51
51
  readonly deadline: number;
52
+ readonly signal?: AbortSignal | undefined;
52
53
  }): Promise<Checks>;
@@ -155,7 +155,7 @@ async function heldKeys(driver, signal) {
155
155
  return keys;
156
156
  }
157
157
  async function checkWebMcp(driver, options) {
158
- const checks = new Checks("webmcp", options.deadline);
158
+ const checks = new Checks("webmcp", options.deadline, options.signal);
159
159
  const capabilities = fixture.capabilities;
160
160
  const expected = idsOf(TARGET);
161
161
  await checks.run("each available capability of the target is a tool", `${RULE}#tools`, async (signal) => {
@@ -1,3 +1,3 @@
1
1
  // package.json
2
- var version = "0.18.0";
2
+ var version = "0.19.0";
3
3
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acid-cat/cli",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "The AcidCat command line: check and format catalogs, print the catalog of a target, and test implementations.",
5
5
  "keywords": [
6
6
  "acidcat",
@@ -39,8 +39,8 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@acid-cat/catalog": "0.18.0",
43
- "@acid-cat/spec-ts": "0.18.0",
42
+ "@acid-cat/catalog": "0.19.0",
43
+ "@acid-cat/spec-ts": "0.19.0",
44
44
  "@effect/platform-node": "^4.1.3",
45
45
  "@effect/platform-node-shared": "^4.1.3",
46
46
  "@modelcontextprotocol/client": "2.4.0",