feat(process): run finite-state replay during capture

This commit is contained in:
morluto
2026-07-22 14:06:50 +00:00
parent e4ee4c9635
commit 34c583a170
186 changed files with 1702 additions and 666 deletions
+15
View File
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
import { resolve } from "node:path";
import canonicalize from "canonicalize";
import { z } from "zod";
import { replayMachineSchema } from "./replayMachine.js";
const positiveBudget = z.number().int().positive();
const timedEventBase = { at_ms: z.number().int().nonnegative() };
@@ -241,6 +242,7 @@ export const processScenarioSchema = z
}),
replay: z
.object({
machine: replayMachineSchema.nullable().default(null),
http: z
.array(
z.object({
@@ -285,6 +287,7 @@ export const processScenarioSchema = z
.default([]),
})
.default({
machine: null,
http: [],
websocket_messages: [],
websocket_connections: [],
@@ -361,6 +364,18 @@ export const processScenarioSchema = z
message: "command shim names must be unique",
path: ["command_shims"],
});
if (
scenario.replay.machine !== null &&
(scenario.replay.http.length > 0 ||
scenario.replay.websocket_messages.length > 0 ||
scenario.replay.websocket_connections.length > 0)
)
context.addIssue({
code: "custom",
message:
"a replay machine cannot be combined with static HTTP or WebSocket scripts",
path: ["replay"],
});
});
/** Parsed instructions and resource bounds for one process experiment. */