test(perf): trim timer-heavy suites and guardrail scanning

This commit is contained in:
Peter Steinberger
2026-03-02 10:28:39 +00:00
parent f5a265a51a
commit 8a1465c314
7 changed files with 124 additions and 157 deletions

View File

@@ -79,10 +79,10 @@ describe("runCommandWithTimeout", () => {
it("kills command when no output timeout elapses", async () => {
const result = await runCommandWithTimeout(
[process.execPath, "-e", "setTimeout(() => {}, 80)"],
[process.execPath, "-e", "setTimeout(() => {}, 60)"],
{
timeoutMs: 500,
noOutputTimeoutMs: 25,
noOutputTimeoutMs: 20,
},
);
@@ -105,13 +105,13 @@ describe("runCommandWithTimeout", () => {
"clearInterval(ticker);",
"process.exit(0);",
"}",
"}, 15);",
"}, 10);",
].join(" "),
],
{
timeoutMs: 3_000,
timeoutMs: 2_000,
// Keep a healthy margin above the emit interval while avoiding long idle waits.
noOutputTimeoutMs: 120,
noOutputTimeoutMs: 70,
},
);

View File

@@ -4,7 +4,7 @@ import { createProcessSupervisor } from "./supervisor.js";
type ProcessSupervisor = ReturnType<typeof createProcessSupervisor>;
type SpawnOptions = Parameters<ProcessSupervisor["spawn"]>[0];
type ChildSpawnOptions = Omit<Extract<SpawnOptions, { mode: "child" }>, "backendId" | "mode">;
const OUTPUT_DELAY_MS = 15;
const OUTPUT_DELAY_MS = 8;
async function spawnChild(supervisor: ProcessSupervisor, options: ChildSpawnOptions) {
return supervisor.spawn({
@@ -38,9 +38,9 @@ describe("process supervisor", () => {
const supervisor = createProcessSupervisor();
const run = await spawnChild(supervisor, {
sessionId: "s1",
argv: [process.execPath, "-e", "setTimeout(() => {}, 30)"],
argv: [process.execPath, "-e", "setTimeout(() => {}, 24)"],
timeoutMs: 500,
noOutputTimeoutMs: 12,
noOutputTimeoutMs: 8,
stdinMode: "pipe-closed",
});
const exit = await run.wait();
@@ -54,7 +54,7 @@ describe("process supervisor", () => {
const first = await spawnChild(supervisor, {
sessionId: "s1",
scopeKey: "scope:a",
argv: [process.execPath, "-e", "setTimeout(() => {}, 1_000)"],
argv: [process.execPath, "-e", "setTimeout(() => {}, 500)"],
timeoutMs: 2_000,
stdinMode: "pipe-open",
});