fix: state every test-gate timeout instead of inheriting a library default

Three of the six Vitest projects ran on Vitest's own testTimeout: 5000 and
five on its hookTimeout/teardownTimeout: 10000, and all 788 Testing Library
waits in the web unit project ran on asyncUtilTimeout: 1000. None of those
numbers was chosen here, and all of them were sized for an idle machine rather
than for three or four concurrent worktree sessions each running a full
local:gate on eight cores. #2292, #2278, #2250, #1942 and #1742 were each that
class, diagnosed one site at a time.

This is the complement of #1596, not a retreat from it: every fix that issue
produced stands, and no race is hidden here. What changes is that a correct,
deterministic test is no longer cut off by a budget nobody picked.

- vitest.shared.mts exports frozen TIMEOUTS / INTEGRATION_TIMEOUTS; all six
  projects spread one of them, clients/launcher importing the shared module for
  the first time to do so.
- Both web projects configure Testing Library's asyncUtilTimeout. The storybook
  one needs its own setup file, deliberately outside .storybook/ and free of
  setProjectAnnotations so the automatic preview-annotation provisioning
  (#1898) is untouched.
- 28 per-suite restatements of the integration project's own budget are gone,
  so raising the shared value now moves every site under it. The handful that
  genuinely differ — cross-process lock contention, a full OAuth round trip —
  keep their budget as a named constant that says why.
- AppRenderer's waitFor no longer asks for exactly its enclosing budget, which
  it could never win (#2292's shape); cli's e2e child timer drops below the
  project budget so the bound carrying the diagnostic is the one that fires.
- The transition auto-settle's slack term is named RAF_SLACK_MS and raised;
  the term derived from HEADER_ANIM_MS is untouched. The two answer to
  different things and must not be scaled as one number.
- The 19 Playwright budgets scattered across three web smokes become four
  named constants in scripts/lib/browser-timeouts.mjs.

scripts/verify-test-timeouts.mjs resolves each project through Vitest itself
and asserts the budgets, the asyncUtilTimeout sites, and that retry stays
unset. It was observed red against the pre-change config: unit/tui/launcher at
testTimeout 5000, five projects at hookTimeout 10000, both asyncUtilTimeout
sites unmet.

Closes #2323

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PsmUAZ6aLUAFqenjJKSSRp
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-12 08:32:34 -04:00
commit 58e53d5a92
6 changed files with 1276 additions and 394 deletions

View file

@ -70,7 +70,7 @@ describe("OAuth connect on the probing eras (#1805)", () => {
await mcpServer.stop();
mcpServer = null;
}
}, 30_000);
});
afterAll(() => {
try {
@ -166,7 +166,7 @@ describe("OAuth connect on the probing eras (#1805)", () => {
expect(
(error as AuthRecoveryRequiredError).authorizationUrl,
).toBeInstanceOf(URL);
}, 30_000);
});
it(`connects on the "${era}" era once authorization completes`, async () => {
const serverUrl = await startProtectedModernServer();
@ -183,6 +183,6 @@ describe("OAuth connect on the probing eras (#1805)", () => {
expect(authorizing.getProtocolEra()).toBe("modern");
expect(authorizing.getProtocolVersion()).toBe(MODERN_PROTOCOL_VERSION);
expect((await authorizing.listTools()).tools.length).toBeGreaterThan(0);
}, 30_000);
});
}
});

View file

@ -493,7 +493,7 @@ describe("modern-era negotiation (2026-07-28)", () => {
await expect(settled).resolves.toBeInstanceOf(ToolCallCancelledError);
await expect(aborted).resolves.toBe(true);
}, 30_000);
});
// The test above builds its own never-returning tool, which is the sharpest
// way to assert on the server's abort signal but says nothing about the
@ -576,7 +576,7 @@ describe("modern-era negotiation (2026-07-28)", () => {
// The handler must return promptly, saying it was cancelled — not run on to
// its 30th second, which is what it did before the fix.
await expect(outcome).resolves.toContain("cancelled after");
}, 30_000);
});
it("cancels an in-flight MRTR call while its embedded request is pending", async () => {
const started = await startMrtrServer(createMrtrTool());

View file

@ -54,7 +54,7 @@ describe("InspectorClient direct mid-session OAuth", () => {
await mcpServer.stop();
mcpServer = null;
}
}, 30_000);
});
afterAll(() => {
try {
@ -139,7 +139,7 @@ describe("InspectorClient direct mid-session OAuth", () => {
expect(client.getStatus()).toBe("connected");
await client.disconnect();
}, 30_000);
});
it("step-up after insufficient_scope throws AuthRecoveryRequiredError then succeeds after OAuth", async () => {
const staticClientId = "test-direct-step-up";
@ -244,5 +244,5 @@ describe("InspectorClient direct mid-session OAuth", () => {
expect(result.success).toBe(true);
await client.disconnect();
}, 30_000);
});
});

View file

@ -104,7 +104,7 @@ describe("InspectorClient remote mid-session OAuth", () => {
}
remoteBaseUrl = undefined;
remoteAuthToken = undefined;
}, 30_000);
});
afterAll(() => {
try {
@ -206,7 +206,7 @@ describe("InspectorClient remote mid-session OAuth", () => {
expect(client.getStatus()).toBe("connected");
await client.disconnect();
}, 15_000);
});
it("recovers on reconnect when stored access token was invalidated before connect", async () => {
await setupRemoteServer();
@ -446,7 +446,7 @@ describe("InspectorClient remote mid-session OAuth", () => {
await callbackClient.disconnect();
await client.disconnect();
}, 30_000);
});
it("resumeAfterOAuth falls back to connect when remote session is dead", async () => {
await setupRemoteServer();
@ -549,7 +549,7 @@ describe("InspectorClient remote mid-session OAuth", () => {
await callbackClient.disconnect();
await client.disconnect();
}, 30_000);
});
it("dispatches authChallengeInteractive for ambient interactive recovery", async () => {
await setupRemoteServer();
@ -640,7 +640,7 @@ describe("InspectorClient remote mid-session OAuth", () => {
).toBeInstanceOf(URL);
await client.disconnect();
}, 15_000);
});
it("recovers from ambient auth notification after idle token invalidation", async () => {
await setupRemoteServer();
@ -731,5 +731,5 @@ describe("InspectorClient remote mid-session OAuth", () => {
expect(client.getStatus()).toBe("connected");
await client.disconnect();
}, 15_000);
});
});

View file

@ -74,7 +74,7 @@ describe("OAuth challenge resource_metadata (RFC 9728)", () => {
serverUrl = `http://localhost:${port}`;
storageDir = mkdtempSync(join(tmpdir(), "mcp-inspector-2071-"));
await waitForOAuthWellKnown(serverUrl);
}, 30_000);
});
afterAll(async () => {
await mcpServer?.stop();
@ -83,7 +83,7 @@ describe("OAuth challenge resource_metadata (RFC 9728)", () => {
rmSync(storageDir, { recursive: true, force: true });
storageDir = "";
}
}, 30_000);
});
it("advertises the non-default metadata URL on the 401 challenge", async () => {
const response = await fetch(`${serverUrl}/mcp`, { method: "POST" });
@ -179,7 +179,7 @@ describe("OAuth challenge resource_metadata (RFC 9728)", () => {
).toEqual([]);
await client.disconnect();
}, 30_000);
});
it("observes the SSE challenge through a caller-supplied eventSourceInit.fetch", async () => {
// That explicit fetch is deliberately not proxy- or intercept-wrapped, so
@ -225,7 +225,7 @@ describe("OAuth challenge resource_metadata (RFC 9728)", () => {
expect(observed).toContainEqual(
expect.objectContaining({ resourceMetadataUrl: METADATA_URL_LITERAL }),
);
}, 30_000);
});
it("keeps the showcase config valid and carrying the custom path", () => {
const configPath = fileURLToPath(

View file

@ -174,7 +174,7 @@ describe("web-client cancellation over a per-request stream (#2140)", () => {
// `notifications/cancelled` it was free to ignore (and did), its request
// signal never fired, and this promise never resolved.
await expect(slow.aborted).resolves.toBe(true);
}, 30_000);
});
it("advertises the per-request stream only for streamable-http", () => {
// The flag is what the SDK forks on, and the factory is where a server's