refactor(process): remove request count ceilings
This commit is contained in:
@@ -115,6 +115,13 @@ redacted from recorded text. The command-shim directory is placed first in the
|
||||
captured process `PATH`; any remaining `PATH` must be explicitly supplied or
|
||||
inherited under operator policy.
|
||||
|
||||
Scenario arguments, environment names, timed interactions, shim routes and
|
||||
output chunks, filesystem checkpoints, and static HTTP/WebSocket scripts are
|
||||
accepted without fixed item-count ceilings. The run still obeys its timeout
|
||||
and the configured output, frame, process, filesystem, protocol-event,
|
||||
body-byte, and connection budgets; each filesystem checkpoint uses those same
|
||||
bounded snapshot limits.
|
||||
|
||||
## Reactive process scenarios
|
||||
|
||||
Set `reactive` to a process reactive scenario declaration when interaction
|
||||
|
||||
@@ -36,7 +36,7 @@ const replaySideSchema = z
|
||||
const explicitCaseSchema = z
|
||||
.object({
|
||||
case_id: z.string().min(1).max(128),
|
||||
arguments: z.array(z.json()).max(16),
|
||||
arguments: z.array(z.json()),
|
||||
})
|
||||
.strict();
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { processScenarioSchema } from "./processScenario.js";
|
||||
|
||||
describe("process scenario collection inputs", () => {
|
||||
it("accepts more than 64 named filesystem checkpoints", () => {
|
||||
const scenario = processScenarioSchema.parse({
|
||||
executable: "/bin/echo",
|
||||
working_directory: "/tmp",
|
||||
checkpoints: Array.from({ length: 65 }, (_, index) => ({
|
||||
name: `state-${index}`,
|
||||
trigger: { type: "root_exit" as const },
|
||||
})),
|
||||
});
|
||||
|
||||
expect(scenario.checkpoints).toHaveLength(65);
|
||||
});
|
||||
|
||||
it("accepts large interaction and replay descriptions under the run budgets", () => {
|
||||
const environment = Object.fromEntries(
|
||||
Array.from({ length: 65 }, (_, index) => [`APP_VALUE_${index}`, "x"]),
|
||||
);
|
||||
const commandShims = Array.from({ length: 33 }, (_, shimIndex) => ({
|
||||
name: `tool-${shimIndex}`,
|
||||
routes: Array.from({ length: 101 }, (_, routeIndex) => ({
|
||||
arguments: [`--route-${routeIndex}`],
|
||||
outputs: Array.from({ length: routeIndex === 0 ? 1_001 : 0 }, () => ({
|
||||
at_ms: 0,
|
||||
stream: "stdout" as const,
|
||||
data: "x",
|
||||
})),
|
||||
termination: { type: "exit" as const, code: 0 },
|
||||
max_calls: 101,
|
||||
})),
|
||||
}));
|
||||
const scenario = processScenarioSchema.parse({
|
||||
executable: "/bin/echo",
|
||||
arguments: Array.from({ length: 257 }, (_, index) => String(index)),
|
||||
working_directory: "/tmp",
|
||||
filesystem_roots: Array.from(
|
||||
{ length: 17 },
|
||||
(_, index) => `/tmp/root-${index}`,
|
||||
),
|
||||
environment,
|
||||
inherit_environment: Array.from(
|
||||
{ length: 65 },
|
||||
(_, index) => `INHERITED_${index}`,
|
||||
),
|
||||
secret_aliases: Object.keys(environment),
|
||||
command_shims: commandShims,
|
||||
events: Array.from({ length: 1_001 }, () => ({
|
||||
type: "input" as const,
|
||||
at_ms: 0,
|
||||
data: "x",
|
||||
})),
|
||||
checkpoints: [
|
||||
{
|
||||
name: "many_occurrences",
|
||||
trigger: {
|
||||
type: "terminal_literal",
|
||||
value: "ready",
|
||||
occurrence: 1_001,
|
||||
},
|
||||
},
|
||||
],
|
||||
replay: {
|
||||
http: Array.from({ length: 101 }, (_, index) => ({
|
||||
method: "GET",
|
||||
path: `/route-${index}`,
|
||||
status: 200,
|
||||
body: "ok",
|
||||
max_calls: 101,
|
||||
})),
|
||||
websocket_messages: Array.from({ length: 101 }, () => "message"),
|
||||
websocket_connections: Array.from({ length: 101 }, () => ({
|
||||
messages: Array.from({ length: 101 }, () => ({ data: "message" })),
|
||||
disconnect_after: false,
|
||||
})),
|
||||
},
|
||||
});
|
||||
|
||||
expect(scenario.arguments).toHaveLength(257);
|
||||
expect(scenario.inherit_environment).toHaveLength(65);
|
||||
expect(scenario.command_shims).toHaveLength(33);
|
||||
expect(scenario.command_shims[0]?.routes).toHaveLength(101);
|
||||
expect(scenario.command_shims[0]?.routes[0]?.outputs).toHaveLength(1_001);
|
||||
expect(scenario.events).toHaveLength(1_001);
|
||||
expect(scenario.filesystem_roots).toHaveLength(17);
|
||||
expect(scenario.checkpoints[0]?.trigger).toMatchObject({
|
||||
occurrence: 1_001,
|
||||
});
|
||||
expect(scenario.replay.http).toHaveLength(101);
|
||||
expect(scenario.replay.websocket_connections[0]?.messages).toHaveLength(
|
||||
101,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -119,13 +119,13 @@ export const processComparisonContract = (
|
||||
export const processScenarioSchema = z
|
||||
.object({
|
||||
executable: z.string().startsWith("/"),
|
||||
arguments: z.array(z.string()).max(256).default([]),
|
||||
arguments: z.array(z.string()).default([]),
|
||||
working_directory: z.string().startsWith("/"),
|
||||
environment: z.record(environmentName, z.string()).default({}),
|
||||
inherit_environment: z.array(environmentName).max(64).default([]),
|
||||
secret_aliases: z.array(environmentName).max(64).default([]),
|
||||
inherit_environment: z.array(environmentName).default([]),
|
||||
secret_aliases: z.array(environmentName).default([]),
|
||||
network_access: z.literal("host").default("host"),
|
||||
filesystem_roots: z.array(z.string().startsWith("/")).max(16).default([]),
|
||||
filesystem_roots: z.array(z.string().startsWith("/")).default([]),
|
||||
terminal: z
|
||||
.object({
|
||||
columns: z.number().int().min(1).max(1_000).default(80),
|
||||
@@ -145,14 +145,13 @@ export const processScenarioSchema = z
|
||||
z.object({
|
||||
type: z.literal("terminal_literal"),
|
||||
value: z.string().min(1).max(10_000),
|
||||
occurrence: z.number().int().positive().max(1_000).default(1),
|
||||
occurrence: positiveBudget.default(1),
|
||||
}),
|
||||
z.object({ type: z.literal("root_exit") }),
|
||||
z.object({ type: z.literal("settled") }),
|
||||
]),
|
||||
}),
|
||||
)
|
||||
.max(64)
|
||||
.default([]),
|
||||
command_shims: z
|
||||
.array(
|
||||
@@ -161,8 +160,8 @@ export const processScenarioSchema = z
|
||||
routes: z
|
||||
.array(
|
||||
z.object({
|
||||
arguments: z.array(z.string()).max(256),
|
||||
outputs: z.array(outputChunkSchema).max(1_000).default([]),
|
||||
arguments: z.array(z.string()),
|
||||
outputs: z.array(outputChunkSchema).default([]),
|
||||
termination: z.discriminatedUnion("type", [
|
||||
z.object({
|
||||
type: z.literal("exit"),
|
||||
@@ -173,14 +172,12 @@ export const processScenarioSchema = z
|
||||
signal: z.enum(["SIGINT", "SIGTERM", "SIGKILL"]),
|
||||
}),
|
||||
]),
|
||||
max_calls: z.number().int().positive().max(100).default(1),
|
||||
max_calls: positiveBudget.default(1),
|
||||
}),
|
||||
)
|
||||
.min(1)
|
||||
.max(100),
|
||||
.min(1),
|
||||
}),
|
||||
)
|
||||
.max(32)
|
||||
.default([]),
|
||||
events: z
|
||||
.array(
|
||||
@@ -204,7 +201,6 @@ export const processScenarioSchema = z
|
||||
}),
|
||||
]),
|
||||
)
|
||||
.max(1_000)
|
||||
.default([]),
|
||||
timeout_ms: positiveBudget.max(300_000).default(30_000),
|
||||
idle_timeout_ms: positiveBudget.max(300_000).default(30_000),
|
||||
@@ -270,35 +266,28 @@ export const processScenarioSchema = z
|
||||
response_headers: z.record(z.string(), z.string()).default({}),
|
||||
delay_ms: z.number().int().nonnegative().max(30_000).default(0),
|
||||
disconnect: z.boolean().default(false),
|
||||
max_calls: z.number().int().min(1).max(100).default(1),
|
||||
max_calls: positiveBudget.default(1),
|
||||
}),
|
||||
)
|
||||
.max(100)
|
||||
.default([]),
|
||||
websocket_messages: z
|
||||
.array(z.string().max(1_000_000))
|
||||
.max(100)
|
||||
.default([]),
|
||||
websocket_messages: z.array(z.string().max(1_000_000)).default([]),
|
||||
websocket_connections: z
|
||||
.array(
|
||||
z.object({
|
||||
messages: z
|
||||
.array(
|
||||
z.object({
|
||||
data: z.string().max(1_000_000),
|
||||
delay_ms: z
|
||||
.number()
|
||||
.int()
|
||||
.nonnegative()
|
||||
.max(30_000)
|
||||
.default(0),
|
||||
}),
|
||||
)
|
||||
.max(100),
|
||||
messages: z.array(
|
||||
z.object({
|
||||
data: z.string().max(1_000_000),
|
||||
delay_ms: z
|
||||
.number()
|
||||
.int()
|
||||
.nonnegative()
|
||||
.max(30_000)
|
||||
.default(0),
|
||||
}),
|
||||
),
|
||||
disconnect_after: z.boolean().default(false),
|
||||
}),
|
||||
)
|
||||
.max(100)
|
||||
.default([]),
|
||||
})
|
||||
.default({
|
||||
|
||||
@@ -129,7 +129,6 @@ const input = (
|
||||
},
|
||||
cases: [{ case_id: "heading", arguments: ["# Title"] }],
|
||||
});
|
||||
|
||||
const completedRunner = (): JavaScriptReplayRunner => ({
|
||||
execute: async (prepared) => ({
|
||||
plan_digest: prepared.publicPlan.plan_digest,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { controlledReplayInputSchema } from "../../../../src/domain/javascriptReplay.js";
|
||||
|
||||
it("accepts replay case argument arrays beyond the former item ceiling", () => {
|
||||
const parsed = controlledReplayInputSchema.safeParse({
|
||||
mode: "plan",
|
||||
left: {
|
||||
modules: [
|
||||
{
|
||||
alias: "parser",
|
||||
path: "/tmp/parser.mjs",
|
||||
format: "esm",
|
||||
role: "module",
|
||||
dependencies: {},
|
||||
},
|
||||
],
|
||||
entry_alias: "parser",
|
||||
entry_export: "default",
|
||||
},
|
||||
cases: [
|
||||
{
|
||||
case_id: "many-arguments",
|
||||
arguments: Array.from({ length: 17 }, (_, index) => index),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(parsed.success).toBe(true);
|
||||
});
|
||||
Reference in New Issue
Block a user