* fix(hopper): report unavailable procedure body coverage * refactor!: simplify runtime tools and remove replay engines Keep direct inspection, capture, and comparison tools. Bind handlers to named contracts and let agents compose experiments with commands and local fixture servers. BREAKING CHANGE: Remove controlled replay, Node characterization, finite replay-machine, managed runtime planning, and redundant string-tracing tools. Retire process replay, shims, reactive scenarios, custom checkpoints, and active browser replay and origin-scope inputs.
76 lines
2.5 KiB
TypeScript
76 lines
2.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { processScenarioSchema } from "./processScenario.js";
|
|
|
|
describe("direct process scenarios", () => {
|
|
it("defaults to one command with inherited environment and no filesystem scan", () => {
|
|
expect(processScenarioSchema.parse({ executable: "node" })).toMatchObject({
|
|
executable: "node",
|
|
arguments: [],
|
|
working_directory: ".",
|
|
environment: {},
|
|
filesystem_observation_paths: [],
|
|
events: [],
|
|
});
|
|
});
|
|
|
|
it("accepts caller-selected environment and explicit filesystem observations", () => {
|
|
const environment = { "app.setting": "value", "1": "numbered" };
|
|
const scenario = processScenarioSchema.parse({
|
|
executable: "node",
|
|
arguments: ["./task.mjs"],
|
|
working_directory: "./project",
|
|
environment,
|
|
filesystem_observation_paths: ["state"],
|
|
});
|
|
expect(scenario.environment).toEqual(environment);
|
|
expect(scenario.filesystem_observation_paths).toEqual(["state"]);
|
|
});
|
|
|
|
it("rejects malformed environment names and adapter-reserved identity", () => {
|
|
for (const name of ["", "KEY=VALUE", "KEY\0VALUE", "REA_PROCESS_RUN_ID"])
|
|
expect(
|
|
processScenarioSchema.safeParse({
|
|
executable: "node",
|
|
environment: { [name]: "value" },
|
|
}).success,
|
|
).toBe(false);
|
|
});
|
|
|
|
it("keeps bounded capture controls and ordered scheduled interaction", () => {
|
|
const scenario = processScenarioSchema.parse({
|
|
executable: "node",
|
|
events: [
|
|
{ type: "input", at_ms: 10, data: "answer", sensitive: true },
|
|
{ type: "resize", at_ms: 20, columns: 100, rows: 30 },
|
|
{ type: "signal", at_ms: 30, signal: "SIGTERM" },
|
|
],
|
|
limits: { output_bytes: 2_000_000, filesystem_depth: 0 },
|
|
});
|
|
expect(scenario.events).toHaveLength(3);
|
|
expect(scenario.events[0]).toMatchObject({ sensitive: true });
|
|
expect(scenario.limits.output_bytes).toBe(2_000_000);
|
|
expect(scenario.limits.filesystem_depth).toBe(0);
|
|
});
|
|
|
|
it("rejects events after timeout and unknown orchestration fields", () => {
|
|
expect(
|
|
processScenarioSchema.safeParse({
|
|
executable: "node",
|
|
timeout_ms: 10,
|
|
events: [{ type: "input", at_ms: 11, data: "late" }],
|
|
}).success,
|
|
).toBe(false);
|
|
for (const [field, value] of [
|
|
["command_shims", []],
|
|
["replay", {}],
|
|
["reactive", {}],
|
|
["checkpoints", []],
|
|
] as const)
|
|
expect(
|
|
processScenarioSchema.safeParse({ executable: "node", [field]: value })
|
|
.success,
|
|
).toBe(false);
|
|
});
|
|
});
|