fix(electron): refuse a wait longer than Node can schedule (#11606)

An Electron scenario wait accepted any non-negative duration_ms, and
Playwright's waitForTimeout schedules a delay above 2147483647 ms as 1 ms,
so a very long wait returned at once. Bound it at admission with the shared
Node timer maximum, as the browser scenario wait already does.

Refs #11601
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 08:48:38 +08:00
1 parent a80a47f143
commit 2910fc0b13
4 files changed
+44 -6

No files matched your search

@@ -1,4 +1,5 @@
import { z } from "zod";
import { MAX_NODE_TIMER_DELAY_MS } from "../analysisResourceLimits.js";
import { absoluteLocalPathStringSchema } from "../localPath.js";
const absolutePathSchema = z
@@ -37,7 +38,13 @@ const actionSchema = z.discriminatedUnion("kind", [
z.strictObject({
step_id: z.string().min(1),
kind: z.literal("wait"),
duration_ms: z.int().min(0),
duration_ms: z
.int()
.min(0)
.max(MAX_NODE_TIMER_DELAY_MS)
.describe(
`Wait this many milliseconds, from 0 to ${String(MAX_NODE_TIMER_DELAY_MS)}; the wait ends early on cancellation.`,
),
window_index: windowIndexSchema.optional(),
}),
z.strictObject({