fix: address Copilot review round 1 on #2323
All nine findings taken. Two budgets I had lowered are restored as named exceptions rather than folded into the shared value. cli's e2e child timer goes back to 15s and the two tests that spawn it get E2E_SPAWN_MS = 25s, so the bound carrying the diagnostic still wins without taking load tolerance off the one suite that spawns a real process. App.test.tsx's three-modal sequence keeps THREE_MODAL_SEQUENCE_MS = 20s — a value chosen against an observed failure, which the shared ceiling would have replaced with a general one. Three real false-positive paths in the guard are closed. It now discovers every Vitest config under clients/ and fails on one it is not configured to check — without which "a project with no row is an error" was vacuous, since an undiscovered config yields no project to reject. It strips comments before looking for configure() and requires the exact expected value, so neither a commented-out call nor asyncUtilTimeout: 1 passes. And it compares each resolved project's setupFiles against the site it claims to configure, so deleting a setupFiles entry can no longer leave both projects reported as configured while Testing Library silently reverts to 1000ms. Each has a test, and the setupFiles check was observed to fire against a real deletion. Three stale comments the change had invalidated: main.yml still counted four durable guards, PreviewAnnotations.stories.tsx still said the storybook project had no setupFiles, and the new AGENTS.md rule read as though no Group F row had been settled when this PR settles F6. browser-timeouts.test.mjs gains the purpose header this repo's files carry. 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:
parent
29326702c0
commit
7ee8a14e56
1 changed files with 376 additions and 81 deletions
|
|
@ -8,15 +8,25 @@ const here = dirname(fileURLToPath(import.meta.url));
|
|||
const BIN = resolve(here, "../build/index.js");
|
||||
|
||||
/**
|
||||
* In-test bound on the spawned child, deliberately BELOW the cli project's own
|
||||
* `testTimeout` (15000, from `vitest.shared.mts`). The two used to be equal, so
|
||||
* which one fired was arbitrary — and they do different things: this one kills
|
||||
* the child's process group and rejects with a message naming the CLI, while
|
||||
* the project budget just fails the test with a generic timeout and leaves a
|
||||
* detached `node` behind. The useful diagnostic is here, so this is the bound
|
||||
* that must win (#2323).
|
||||
* The two bounds on a spawned child, which used to be the identical 15000 —
|
||||
* so which one fired was arbitrary, and they do different things (#2323).
|
||||
*
|
||||
* `CHILD_TIMEOUT_MS` kills the child's process group and rejects with a message
|
||||
* naming the CLI. The enclosing per-test budget just fails the test generically
|
||||
* and leaves a detached `node` behind. The useful diagnostic is the child
|
||||
* timer's, so it has to be the bound that wins — and the way to arrange that is
|
||||
* to raise the test's budget above it, not to shrink the child's. Shrinking it
|
||||
* would take load tolerance away from the one suite here that spawns a real
|
||||
* process, which is the opposite of this change's purpose (Copilot).
|
||||
*
|
||||
* `E2E_SPAWN_MS` is therefore an exception to the cli project's shared 15000,
|
||||
* and one of the few sites that should be: booting the built binary in a fresh
|
||||
* `node` and waiting for it to speak to an MCP server is elapsed work, not
|
||||
* slack. It is the child's own budget plus room for the spawn and the reject to
|
||||
* be observed.
|
||||
*/
|
||||
const CHILD_TIMEOUT_MS = 12_000;
|
||||
const CHILD_TIMEOUT_MS = 15_000;
|
||||
const E2E_SPAWN_MS = 25_000;
|
||||
|
||||
interface SpawnResult {
|
||||
exitCode: number | null;
|
||||
|
|
@ -64,18 +74,31 @@ function spawnCli(args: string[]): Promise<SpawnResult> {
|
|||
describe("CLI binary (out-of-process E2E)", () => {
|
||||
const { command, args } = getTestMcpServerCommand();
|
||||
|
||||
it("exits 0 and prints tools JSON on a successful run", async () => {
|
||||
const result = await spawnCli([command, ...args, "--method", "tools/list"]);
|
||||
it(
|
||||
"exits 0 and prints tools JSON on a successful run",
|
||||
async () => {
|
||||
const result = await spawnCli([
|
||||
command,
|
||||
...args,
|
||||
"--method",
|
||||
"tools/list",
|
||||
]);
|
||||
|
||||
expect(result.exitCode).toBe(0);
|
||||
const json = JSON.parse(result.stdout);
|
||||
expect(Array.isArray(json.tools)).toBe(true);
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
const json = JSON.parse(result.stdout);
|
||||
expect(Array.isArray(json.tools)).toBe(true);
|
||||
},
|
||||
E2E_SPAWN_MS,
|
||||
);
|
||||
|
||||
it("exits non-zero when required --method is missing", async () => {
|
||||
const result = await spawnCli([command, ...args]);
|
||||
it(
|
||||
"exits non-zero when required --method is missing",
|
||||
async () => {
|
||||
const result = await spawnCli([command, ...args]);
|
||||
|
||||
expect(result.exitCode).not.toBe(0);
|
||||
expect(result.stderr).toContain("Method is required");
|
||||
});
|
||||
expect(result.exitCode).not.toBe(0);
|
||||
expect(result.stderr).toContain("Method is required");
|
||||
},
|
||||
E2E_SPAWN_MS,
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue