Compare commits

...
Author SHA1 Message Date
808acf6dec test: keep child deadlines that rule out fallback exits
These fixtures' descendants exit on their own after 20 or 30 seconds. The
shorter explicit deadline is what proves cleanup stopped them first.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 04:12:00 +00:00
2064e6a66e test: bound every test process registry by the running test
Registries created directly with createTestProcessRegistry did not get the
processTest default, so a hung child there had no deadline once its explicit
value was removed; Vitest's test timeout does not settle the awaited run, so
shutdown was never reached. Derive the default in the registry from the
running test instead, using the real clock.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 04:12:00 +00:00
aeb30599af test: remove fixed child-process deadlines from tests
239 literal timeoutMs values on cli.run and processes.run only restated
a guess at host speed. On hosted runners with four workers, cliOutput's
3-second value failed while the command still produced correct output.
Deadlines that are the behavior under test, derived from an operation
budget, or that bound a regression's wait remain.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 04:12:00 +00:00
db0748389f test: bound fixture child processes by the remaining test deadline
A processTest child run without its own timeoutMs now gets the test's
remaining deadline less a reporting reserve (at least 5 seconds, or a
tenth of the deadline). A hung child still fails with its captured output,
without a fixed per-call value that assumes a host's speed.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 04:11:59 +00:00
gensokyo-devandClaude Opus 5.5 e8c838e8bd test(mcp): keep the surrogate path handler check within its deadline
The handler regression added in #10390 listed tools under the full input
profile and matched every advertised schema before calling each tool. It
took about 14 s locally and passed the 30 s deadline on loaded CI runners.
advertisedPatternsVMode.test.ts already proves that no input or output
profile advertises the surrogate escape, so this case now checks only the
runtime refusal through the default-profile handlers, as the
relative-path case does.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 05:06:09 +01:00
gensokyo-devandClaude Opus 5.5 809f0d69db fix(mcp): report HTTP listener recovery from its parsed failure
rea mcp --http printed "Choose another --port or stop the process using
it" for every listener failure except a missing host allowlist, so a host
lookup failure, an unassigned address or a permission denial got port
advice. StreamableHttpListenError already classifies the native failure
and owns a recovery for each kind.

Startup now always prints that owned recovery behind one shared lead-in,
and the fixed message is removed. The native cause text stays out of
stderr as before.

Fixes #7346

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 04:57:03 +01:00
122 changed files with 336 additions and 450 deletions

No files matched your search

+4 -1
View File
@@ -307,7 +307,10 @@ assertion. `vitest.config.ts` applies the deadlines in
and 120 seconds for built projects, with hooks sharing their project's
deadline. Coverage doubles every deadline, and so does hosted CI, where
CPU-bound cases share every core with other workers and their subprocesses.
Do not pass a per-test timeout to fit a slow host. Tag a bounded workload that needs longer with
Do not pass a per-test timeout to fit a slow host. A child run through a
test process registry (`processTest`, `cli.run`, or `createTestProcessRegistry`)
gets the running test's remaining deadline less a reporting reserve, so a hung
child fails with its captured output. Pass `timeoutMs` only when the child's deadline is itself under test. Tag a bounded workload that needs longer with
`{ tags: ["long-running"] }`, or a whole file with
`// @module-tag long-running`. Assert elapsed time explicitly when speed is the
behavior under test. Derive an explicit deadline only when a test must outlive
@@ -296,7 +296,6 @@ it(
process.execPath,
["--import", "tsx", "--input-type=module", "--eval", CATALOG_PROGRAM],
{
timeoutMs: 50_000,
env: {
PATH: process.env.PATH,
SystemRoot: process.env.SystemRoot,
@@ -102,7 +102,6 @@ it("repairs equal-launcher Copilot JSONC syntax while strict JSON and standard J
process.execPath,
["--import", "tsx", entrypoint],
{
timeoutMs: 20_000,
env: {
PATH: process.env.PATH,
SystemRoot: process.env.SystemRoot,
+9 -13
View File
@@ -21,19 +21,15 @@ it("retains escape-heavy strings within a heap near their decoded size", async (
if (!Array.isArray(parsed) || parsed.length !== 463 || parsed.some((value) => value !== body)) process.exit(3);
`;
const child = await processes.run(
process.execPath,
[
"--max-old-space-size=48",
"--max-semi-space-size=8",
"--import",
"tsx",
"--input-type=module",
"--eval",
program,
],
{ timeoutMs: 30_000 },
);
const child = await processes.run(process.execPath, [
"--max-old-space-size=48",
"--max-semi-space-size=8",
"--import",
"tsx",
"--input-type=module",
"--eval",
program,
]);
expect(child.exitCode, child.stderr).toBe(0);
});
+3 -2
View File
@@ -10,5 +10,6 @@ export const MCP_SHUTDOWN_FAILED =
"REA could not close cleanly. End the REA process before starting it again.";
export const SERVER_START_FAILED =
"Do not repeat this startup. Tell the user REA could not start and ask them to restart the MCP client, then run `rea doctor`.";
export const MCP_HTTP_LISTEN_FAILED =
"REA could not listen for MCP HTTP connections on the selected host and port. Choose another --port or stop the process using it.";
/** The listener error owns recovery for its parsed failure; never its native cause text. */
export const mcpHttpListenFailed = (remediation: string): string =>
`REA could not listen for MCP HTTP connections. ${remediation}`;
+2 -5
View File
@@ -12,7 +12,7 @@ import type { OptionalProviderLoadResult } from "../application/OptionalObservat
import { OwnedMcpServers } from "./OwnedMcpServers.js";
import {
MCP_CONNECTION_START_FAILED,
MCP_HTTP_LISTEN_FAILED,
mcpHttpListenFailed,
} from "./messages.js";
import { reportMcpTransportError } from "./reportMcpTransportError.js";
@@ -181,10 +181,7 @@ export const startMcpTransport = async (
if (!cancelled) {
const startFailure =
cause instanceof StreamableHttpListenError
? cause.classification.ok &&
cause.classification.value.kind === "host_allowlist"
? cause.remediationAction
: MCP_HTTP_LISTEN_FAILED
? mcpHttpListenFailed(cause.remediationAction)
: MCP_CONNECTION_START_FAILED;
serverLogger.error(
{
-1
View File
@@ -29,7 +29,6 @@ cliTest(
"--json",
],
environment: { NODE_OPTIONS: "--max-old-space-size=256" },
timeoutMs: 30000,
});
expect(result.exitCode, result.stderr).toBe(0);
const evidence = toolContract("inspect_apple_ips").outputSchema.parse(
@@ -16,7 +16,6 @@ cliTest.for(["", " \t "])(
"--json",
],
environment: { REA_LOG_LEVEL: "silent" },
timeoutMs: 15000,
});
expect(response.exitCode).toBe(1);
expect(response.json).toMatchObject({
@@ -30,7 +30,6 @@ cliTest(
bundlePath,
"--json",
],
timeoutMs: 60_000,
});
expect(response.exitCode).toBe(0);
const bundle = evidenceBundleSchema.parse(
@@ -9,16 +9,12 @@ processTest(
"returns a nonzero exit for a streamed JSON analysis failure",
async ({ processes }) => {
const root = await createTestTempDirectory("rea-cli-js-missing-");
const result = await processes.run(
process.execPath,
[
"scripts/rea.mjs",
"analyze-javascript-application",
join(root, "missing"),
"--json",
],
{ timeoutMs: 20_000 },
);
const result = await processes.run(process.execPath, [
"scripts/rea.mjs",
"analyze-javascript-application",
join(root, "missing"),
"--json",
]);
expect(result.exitCode).toBe(1);
expect(JSON.parse(result.stdout)).toMatchObject({
code: "invalid_request",
@@ -84,7 +84,6 @@ cliTest.skipIf(process.versions.bun !== undefined).for([
environment: {
NODE_OPTIONS: `--max-old-space-size=${String(heapMb)} --max-semi-space-size=8`,
},
timeoutMs: 60_000,
});
expect(response.exitCode).toBe(0);
const result = javascriptApplicationAnalysisResultSchema.parse(
@@ -201,7 +200,6 @@ cliTest.skipIf(process.versions.bun !== undefined)(
environment: {
NODE_OPTIONS: "--max-old-space-size=640 --max-semi-space-size=8",
},
timeoutMs: 75_000,
});
expect(response.stderr).not.toMatch(/FATAL ERROR:.*heap/iu);
expect(
@@ -32,11 +32,10 @@ cliTest.for(["CLI", "stdio MCP"] as const)(
["a", "b"],
[],
]) {
const control = await processes.run(
process.execPath,
[join(root, "child.cjs"), ...values],
{ timeoutMs: 5_000 },
);
const control = await processes.run(process.execPath, [
join(root, "child.cjs"),
...values,
]);
expect(control.exitCode, control.stderr).toBe(0);
counts.push(Number(control.stdout));
}
@@ -27,7 +27,7 @@ cliTest.for(["CLI", "stdio MCP"] as const)(
const control = await processes.run(
process.execPath,
[join(root, "entry.mjs"), "abc", " mode "],
{ env: { REA_ENDPOINT: "endpoint" }, timeoutMs: 15_000 },
{ env: { REA_ENDPOINT: "endpoint" } },
);
expect(control.exitCode, control.stderr).toBe(0);
expect(JSON.parse(control.stdout)).toEqual([
@@ -46,7 +46,6 @@ cliTest(
"directory",
"--json",
],
timeoutMs: 60_000,
});
expect(cliResponse.exitCode).toBe(0);
const cliEvidence = toolContract(
@@ -35,7 +35,6 @@ cliTest(
"directory",
"--json",
],
timeoutMs: 60_000,
});
expect(cliResponse.exitCode).toBe(0);
const cliEvidence = toolContract(
@@ -160,7 +159,6 @@ cliTest(
"directory",
"--json",
],
timeoutMs: 60_000,
});
expect(analyzed.exitCode, analyzed.stderr).toBe(0);
const application = toolContract(
@@ -193,7 +191,6 @@ cliTest(
);
const traced = await cli.run({
arguments: ["trace-javascript-semantics", request, "--json"],
timeoutMs: 60_000,
});
expect(traced.exitCode, traced.stdout).toBe(0);
const trace = javaScriptSemanticTraceResultSchema.parse(
@@ -19,7 +19,6 @@ cliTest(
const cliResult = await driver.run({
arguments: ["analyze-javascript-application", root, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(cliResult.exitCode, cliResult.stderr).toBe(0);
const result = javascriptApplicationAnalysisResultSchema.parse(
@@ -591,7 +591,7 @@ cliTest(
const result = await analyzeJavaScriptDirectory(
"CLI",
{ run: (invocation) => cli.run({ ...invocation, timeoutMs: 20_000 }) },
{ run: (invocation) => cli.run({ ...invocation }) },
root,
);
expect(result.statistics.parse_failures).toBe(0);
@@ -39,11 +39,9 @@ cliTest.for(["CLI", "stdio MCP"] as const)(
"console.log(JSON.stringify([a, b, c, d, first.length, rest.length, mixed.length]));",
].join("\n"),
});
const control = await processes.run(
process.execPath,
[join(root, "entry.mts")],
{ timeoutMs: 15_000 },
);
const control = await processes.run(process.execPath, [
join(root, "entry.mts"),
]);
expect(control.exitCode, control.stderr).toBe(0);
expect(JSON.parse(control.stdout)).toEqual([
7,
@@ -25,7 +25,6 @@ cliTest(
const cliResult = await driver.run({
arguments: ["inspect-artifact", leftPath, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(cliResult.exitCode, cliResult.stderr).toBe(0);
const cliEvidence = parseEvidence(JSON.parse(cliResult.stdout));
@@ -23,7 +23,6 @@ cliTest(
const result = await driver.run({
arguments: ["inspect-artifact", path, "--detail", "complete", "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode, result.stderr).toBe(0);
const inspection = artifactInspectionResultSchema.parse(
@@ -39,7 +39,6 @@ cliTest.skipIf(process.platform === "win32")(
"--json",
],
environment: { BROWSER_FIXTURE_SECRET: secret },
timeoutMs: 20_000,
});
expect(response.exitCode, response.stdout + response.stderr).toBe(1);
expect(response.stdout).not.toContain(secret);
@@ -47,7 +47,6 @@ cliTest(
"--total-analysis-timeout-ms",
"1",
],
timeoutMs: 30_000,
});
expect(
interrupted.exitCode,
@@ -74,7 +73,6 @@ cliTest(
const recovered = await cli.run({
arguments: baseArguments,
timeoutMs: 30_000,
});
expect(recovered.exitCode, recovered.stdout + recovered.stderr).toBe(0);
expect(recovered.json).toMatchObject({
@@ -46,7 +46,6 @@ cliTest.for([
const result = await cli.run({
arguments: ["capture-browser-scenario", path, "--json"],
environment: { HOME: home, REA_LOG_LEVEL: "silent" },
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject(expected);
@@ -30,7 +30,6 @@ cliTest(
"30000",
"--json",
],
timeoutMs: 55_000,
});
// Analysis retains the interrupted file rather than failing the command.
expect(response.exitCode, `${response.stdout}\n${response.stderr}`).toBe(0);
@@ -29,7 +29,6 @@ cliTest(
}),
"--json",
],
timeoutMs: 60_000,
});
expect(unpublished.exitCode, unpublished.stderr).toBe(1);
expect(unpublished.json).toMatchObject({
@@ -60,7 +59,6 @@ cliTest(
bundle,
"--json",
],
timeoutMs: 60_000,
});
expect(analyzed.exitCode, analyzed.stderr).toBe(0);
const request = (fields?: readonly string[]) =>
@@ -66,7 +66,6 @@ for (const { jarConfigured, setting } of [
const cliResult = await cli.run({
arguments: ["inspect-android-package", apk, "--json"],
environment,
timeoutMs: 10_000,
});
expect(cliResult.exitCode).toBe(1);
expect(cliResult.json).toMatchObject({ code: "capability_unavailable" });
@@ -91,7 +90,6 @@ cliTest.skipIf(process.platform === "win32")(
const cliResult = await cli.run({
arguments: ["inspect-android-package", apk, "--json"],
environment: { REA_LOG_LEVEL: "silent", ...environment },
timeoutMs: 10_000,
});
expect(cliResult.exitCode).toBe(1);
const client = await connect({ REA_LOG_LEVEL: "silent", ...environment });
@@ -146,7 +144,6 @@ cliTest.skipIf(process.platform !== "linux")(
const cliResult = await cli.run({
arguments: ["inspect-firmware-regions", path, "--json"],
environment,
timeoutMs: 10_000,
});
expect(cliResult.exitCode).toBe(1);
expect(cliResult.json).toMatchObject({ code: "capability_unavailable" });
@@ -172,7 +169,6 @@ cliTest.skipIf(process.platform !== "linux")(
arguments: ["inspect-firmware-regions", "input.bin", "--json"],
cwd: root,
environment: { REA_LOG_LEVEL: "silent" },
timeoutMs: 10_000,
});
// A relative path must pass input validation and reach the provider,
// which reports the missing firmware engine — not a validation error.
@@ -199,7 +195,6 @@ cliTest(
"--json",
],
environment,
timeoutMs: 10000,
});
expect(cliResult.exitCode).toBe(1);
expect(cliResult.json).toMatchObject({ code: "capability_unavailable" });
@@ -239,7 +234,6 @@ cliTest(
"--json",
],
environment,
timeoutMs: 10_000,
});
const response = await client.callTool({
name: "recover_javascript_sources",
@@ -60,7 +60,6 @@ cliTest.skipIf(missingNative)(
const success = await cli.run({
arguments: ["inspect-pcap-capture", single, "--json"],
environment: environmentFor(root),
timeoutMs: 60_000,
});
expect(success.exitCode, success.stderr).toBe(0);
expect(success.stdout.includes(credential)).toBe(false);
@@ -78,7 +77,6 @@ cliTest.skipIf(missingNative)(
const failed = await cli.run({
arguments: ["inspect-pcap-capture", many, "--json"],
environment: environmentFor(root),
timeoutMs: 60_000,
});
expect(failed.exitCode, failed.stderr).toBe(1);
expect(failed.stdout.includes(credential)).toBe(false);
@@ -132,7 +132,6 @@ test.for(["target", "loader"] as const)(
const result = await cli.run({
arguments: ["analyze", target, "--provider", "hopper", "--json"],
environment,
timeoutMs: 15_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -223,7 +222,6 @@ test("recovers a denied Hopper launch through the same stdio MCP session and CLI
const deniedCli = await cli.run({
arguments: ["analyze", target, "--provider", "hopper", "--json"],
environment,
timeoutMs: 15_000,
});
expect(deniedCli.exitCode).toBe(1);
expect(deniedCli.json).toMatchObject({
@@ -160,7 +160,6 @@ cliTest(
const result = await driver.run({
arguments: ["inspect-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode, result.stderr).toBe(0);
const inspection = artifactInspectionResultSchema.parse(
@@ -328,7 +327,6 @@ cliTest(
const result = await driver.run({
arguments: ["extract-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode, result.stderr).toBe(0);
const extraction = artifactExtractionResultSchema.parse(
@@ -392,7 +390,6 @@ cliTest(
const result = await driver.run({
arguments: ["inspect-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode, result.stderr).toBe(0);
const inspection = artifactInspectionResultSchema.parse(
@@ -445,7 +442,6 @@ cliTest(
const result = await driver.run({
arguments: ["inspect-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode, result.stderr).toBe(0);
const inspection = artifactInspectionResultSchema.parse(
@@ -473,7 +469,6 @@ cliTest(
const result = await driver.run({
arguments: ["extract-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode, result.stderr).toBe(0);
const extracted = artifactExtractionResultSchema.parse(
@@ -536,7 +531,6 @@ cliTest(
const inspectResult = await driver.run({
arguments: ["inspect-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(inspectResult.exitCode, inspectResult.stderr).toBe(0);
const inspection = artifactInspectionResultSchema.parse(
@@ -610,7 +604,6 @@ cliTest(
const extractResult = await driver.run({
arguments: ["extract-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(extractResult.exitCode, extractResult.stderr).toBe(0);
const extracted = artifactExtractionResultSchema.parse(
@@ -645,7 +638,6 @@ cliTest(
const result = await driver.run({
arguments: ["inspect-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode, result.stderr).toBe(0);
const inspection = artifactInspectionResultSchema.parse(
@@ -688,7 +680,6 @@ cliTest.for([
const result = await driver.run({
arguments: ["inspect-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode, result.stderr).toBe(0);
const inspection = artifactInspectionResultSchema.parse(
@@ -752,7 +743,6 @@ cliTest.for([
const result = await driver.run({
arguments: ["inspect-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode, result.stderr).toBe(0);
const inspection = artifactInspectionResultSchema.parse(
@@ -800,7 +790,6 @@ cliTest(
const result = await driver.run({
arguments: ["inspect-artifact", path, "--json"],
environment: process.env,
timeoutMs: 15_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -200,7 +200,6 @@ cliTest(
arguments: [...args, "--json"],
cwd: home,
environment,
timeoutMs: 20_000,
});
const plan = await run(["setup", "--client", "dsh", "--dry-run"]);
expect(plan.exitCode).toBe(0);
@@ -50,7 +50,6 @@ for (const version of ["1.1", "1.2"] as const) {
HERMES_HOME: profile,
HOPPER_LAUNCHER_PATH: process.execPath,
},
timeoutMs: 20_000,
});
expect(removed.exitCode).toBe(0);
expect(await readFile(config, "utf8")).toBe(original);
@@ -84,7 +83,6 @@ for (const version of ["1.1", "1.2"] as const) {
GHIDRA_INSTALL_DIR: ghidra,
JAVA_HOME: java,
},
timeoutMs: 20_000,
});
const setup = [
"setup",
@@ -166,7 +164,6 @@ cliTest("Hermes still registers into an explicit table", async ({ cli }) => {
HERMES_HOME: profile,
HOPPER_LAUNCHER_PATH: process.execPath,
},
timeoutMs: 20_000,
});
expect(applied.exitCode).toBe(0);
expect(applied.json).toMatchObject({ status: "ready" });
@@ -209,7 +206,6 @@ for (const version of ["1.1", "1.2"] as const) {
HERMES_HOME: profile,
HOPPER_LAUNCHER_PATH: process.execPath,
},
timeoutMs: 20_000,
});
expect(applied.exitCode).toBe(0);
const configured = parse(await readFile(config, "utf8"), { version });
@@ -237,7 +233,6 @@ cliTest(
HERMES_HOME: profile,
HOPPER_LAUNCHER_PATH: process.execPath,
},
timeoutMs: 20_000,
});
const [command, ...args] = currentClientRegistrationCommand({
entrypointPath: resolve("scripts/rea.mjs"),
@@ -316,7 +311,6 @@ for (const original of [
HERMES_HOME: profile,
HOPPER_LAUNCHER_PATH: process.execPath,
},
timeoutMs: 20_000,
});
expect(rejected.exitCode).not.toBe(0);
expect(rejected.json).toMatchObject({
@@ -23,7 +23,6 @@ const cliLifecycle = (cli: TestCli, home: string, profile: string) => {
arguments: arguments_,
cwd: home,
environment: { HOME: home, USERPROFILE: home, HERMES_HOME: profile },
timeoutMs: 20_000,
});
const setup = [
"setup",
@@ -61,7 +61,6 @@ for (const [version, keyStyle] of [
arguments: arguments_,
cwd: home,
environment: { USERPROFILE: home, HERMES_HOME: profile },
timeoutMs: 20_000,
});
const setup = [
"setup",
@@ -141,7 +140,6 @@ cliTest(
arguments: arguments_,
cwd: home,
environment: { USERPROFILE: home, HERMES_HOME: profile },
timeoutMs: 20_000,
});
const setup = ["setup", "--client", "hermes", "--skill=false", "--json"];
const preview = await run([...setup, "--dry-run"]);
@@ -223,7 +221,6 @@ cliTest(
REA_CLIENT_PROFILE_HOME: home,
HERMES_HOME: " ${REA_CLIENT_PROFILE_HOME}/profile ",
},
timeoutMs: 20_000,
});
const planned = await run([
"setup",
@@ -333,7 +330,6 @@ for (const selection of ["default", "custom", "suffix", "explicit"] as const) {
? root
: undefined,
},
timeoutMs: 20_000,
});
const plan = await run([
"setup",
@@ -468,7 +464,6 @@ for (const selection of [
LOCALAPPDATA: join(home, "AppData", "Local"),
HERMES_HOME: root,
},
timeoutMs: 20_000,
});
if (selection === "missing") {
expect(plan.exitCode).toBe(1);
@@ -573,7 +568,6 @@ for (const layout of ["symlinked-default", "escaping-prefix"] as const) {
LOCALAPPDATA: join(home, "AppData", "Local"),
HERMES_HOME: root,
},
timeoutMs: 20_000,
});
expect(plan.exitCode, plan.stdout).toBe(0);
expect(plan.json).toMatchObject({
@@ -650,7 +644,6 @@ for (const name of ["missing", "deleted", "ghost", "../escape", "root"]) {
arguments: args,
cwd: home,
environment: { USERPROFILE: home, HERMES_HOME: root },
timeoutMs: 20_000,
});
const rejected = await run([
"setup",
@@ -720,7 +713,6 @@ cliTest.skipIf(process.platform === "win32")(
HERMES_HOME: "$REA_HERMES_PROFILE",
REA_HERMES_PROFILE: override,
},
timeoutMs: 20_000,
});
const planned = await run([
"setup",
@@ -783,7 +775,6 @@ cliTest(
arguments: arguments_,
cwd: home,
environment: { USERPROFILE: home, HERMES_HOME: override },
timeoutMs: 20_000,
});
const setup = await run(["setup", "--client", "hermes", "--yes", "--json"]);
expect(setup.exitCode).not.toBe(0);
@@ -161,7 +161,6 @@ cliTest.skipIf(process.platform === "win32").for([
XDG_CONFIG_HOME: join(home, ".config"),
PATH: process.env.PATH ?? "",
},
timeoutMs: 30_000,
});
const setup = await run(registered, [
@@ -296,7 +295,6 @@ cliTest.skipIf(process.platform === "win32")(
XDG_CONFIG_HOME: join(home, ".config"),
PATH: process.env.PATH ?? "",
},
timeoutMs: 30_000,
});
const uninstall = await run(["uninstall", "--json"]);
expect(uninstall.exitCode, uninstall.stderr).toBe(0);
@@ -34,7 +34,6 @@ for (const [variable, profile] of [
PI_CODING_AGENT_DIR: agent,
[variable]: profile,
},
timeoutMs: 20_000,
});
for (const option of ["--dry-run", "--yes"]) {
const rejected = await run(
@@ -101,7 +100,6 @@ cliTest(
OMP_PROFILE: " ",
PI_PROFILE: "Bad Name",
},
timeoutMs: 20_000,
});
expect(result.exitCode).toBe(0);
expect(result.json).toMatchObject({ status: "ready" });
@@ -138,7 +138,6 @@ cliTest(
arguments: arguments_,
cwd: home,
environment,
timeoutMs: 20_000,
});
expect(applied.exitCode).toBe(0);
expect(applied.json).toMatchObject({
@@ -193,7 +192,6 @@ cliTest(
arguments: arguments_,
cwd: home,
environment,
timeoutMs: 20_000,
});
expect(repeated.exitCode).toBe(0);
expect(repeated.json).toMatchObject({
@@ -232,7 +230,6 @@ cliTest(
PI_PROFILE: "legacy",
PI_CONFIG_DIR: ".omp-other",
},
timeoutMs: 20_000,
});
const planned = await run([
@@ -345,7 +342,6 @@ cliTest(
HOPPER_LAUNCHER_PATH: join(home, "unconfigured-hopper"),
PI_CODING_AGENT_DIR: "custom-agent",
},
timeoutMs: 20_000,
});
const run = runIn(created);
const setup = await run(["setup", "--client", "pi", "--yes", "--json"]);
@@ -456,7 +452,6 @@ cliTest(
PI_CODING_AGENT_DIR: "file:///agent%2fdir",
REA_DARWIN_MODULE_CACHE_PATH: moduleCache,
},
timeoutMs: 20_000,
});
const plan = await run([
"setup",
@@ -46,7 +46,6 @@ cliTest(
cli.run({
arguments: arguments_,
cwd: home,
timeoutMs: 20_000,
environment: {
USERPROFILE: home,
PATH: [
@@ -36,7 +36,6 @@ cliTest(
"--json",
],
environment,
timeoutMs: 30_000,
});
expect(result.exitCode, result.stdout + result.stderr).toBe(1);
expect(result.json).toMatchObject({
-1
View File
@@ -43,7 +43,6 @@ cliTest(
// This single CLI invocation cannot reuse a newly written cache.
NODE_DISABLE_COMPILE_CACHE: "1",
},
timeoutMs: 15000,
});
expect(cliResponse.exitCode, cliResponse.stdout + cliResponse.stderr).toBe(
0,
@@ -72,7 +72,6 @@ const expectCliSourceLocationSummary = async (
const { bundlePath, evidenceId, sha256 } = expected;
const missingSink = await cli.run({
arguments: [...arguments_, "--detail", "summary"],
timeoutMs: 45000,
});
expect(missingSink.exitCode).toBe(1);
expect(missingSink.json).toMatchObject({
@@ -87,7 +86,6 @@ const expectCliSourceLocationSummary = async (
"--evidence_output",
bundlePath,
],
timeoutMs: 45000,
});
expect(summary.exitCode, summary.stderr).toBe(0);
expect(summary.stdout.length).toBeLessThan(30000);
@@ -217,7 +215,6 @@ cliTest(
REA_BROWSER_EXECUTABLE: "relative-unconfigured-browser",
CLANG_MODULE_CACHE_PATH: map,
},
timeoutMs: 45000,
});
expect(response.exitCode, response.stdout + response.stderr).toBe(0);
expect(response.json).toMatchObject({
@@ -315,7 +312,6 @@ cliTest(
"--json",
],
environment: { REA_LOG_LEVEL: "silent" },
timeoutMs: 45000,
});
expect(invalid.exitCode).toBe(1);
expectInvalidSourceLocation(
@@ -372,7 +368,6 @@ cliTest(
REA_LOG_LEVEL: "silent",
REA_BROWSER_EXECUTABLE: "relative-unconfigured-browser",
},
timeoutMs: 45_000,
});
const response = await call("trace_web_source_location", {
manifest_path: manifest,
@@ -491,7 +486,6 @@ cliTest(
"--json",
],
environment: { REA_LOG_LEVEL: "silent" },
timeoutMs: 45_000,
});
const response = await call("trace_web_source_location", {
manifest_path: manifest,
@@ -578,7 +572,6 @@ cliTest(
REA_LOG_LEVEL: "silent",
REA_BROWSER_EXECUTABLE: "relative-unconfigured-browser",
},
timeoutMs: 45_000,
});
expect(result.exitCode, result.stdout + result.stderr).toBe(0);
expect(result.json).toMatchObject({
@@ -649,7 +642,6 @@ cliTest(
];
const refused = await cli.run({
arguments: [...args, "--source-map-bytes", "128"],
timeoutMs: 45000,
});
expect(refused.exitCode).toBe(1);
expect((refused.json as { code?: unknown }).code).toBe("truncated");
@@ -665,7 +657,6 @@ cliTest(
"--source-map-bytes",
String(Buffer.byteLength(fixture.sourceMap.text)),
],
timeoutMs: 45000,
});
expect(recovered.exitCode, recovered.stderr).toBe(0);
expect(recovered.json).toMatchObject({
@@ -721,7 +712,6 @@ cliTest(
];
const refused = await cli.run({
arguments: [...arguments_, "--source-map-bytes", "4194304"],
timeoutMs: 45000,
});
expect(refused.exitCode).toBe(1);
expect(JSON.stringify(refused.json)).toContain(
@@ -729,7 +719,6 @@ cliTest(
);
const completed = await cli.run({
arguments: arguments_,
timeoutMs: 45000,
});
expect(completed.exitCode, completed.stderr).toBe(0);
const evidence = completed.json as {
@@ -7,19 +7,15 @@ for (const kind of ["proxy", "workers", "storage"] as const) {
processTest(
`${kind} HTTP fixture preserves targets and survives invalid requests`,
async ({ processes }) => {
const result = await processes.run(
process.execPath,
[
fileURLToPath(
new URL(
"../../fixtures/browserFixtureHttpTargets.mjs",
import.meta.url,
),
const result = await processes.run(process.execPath, [
fileURLToPath(
new URL(
"../../fixtures/browserFixtureHttpTargets.mjs",
import.meta.url,
),
kind,
],
{ timeoutMs: 15_000 },
);
),
kind,
]);
expect(result.signal, result.stderr).toBeNull();
expect(result.exitCode, result.stderr).toBe(0);
expect(result.stderr).toBe("");
@@ -11,20 +11,16 @@ const hasNonLoopbackIpv4 = Object.values(networkInterfaces())
processTest.skipIf(!hasNonLoopbackIpv4)(
"storage fixture serves localhost and refuses this host's non-loopback interface",
async ({ processes }) => {
const result = await processes.run(
process.execPath,
[
fileURLToPath(
new URL(
"../../fixtures/browserFixtureHttpTargets.mjs",
import.meta.url,
),
const result = await processes.run(process.execPath, [
fileURLToPath(
new URL(
"../../fixtures/browserFixtureHttpTargets.mjs",
import.meta.url,
),
"storage",
"listener-scope",
],
{ timeoutMs: 15_000 },
);
),
"storage",
"listener-scope",
]);
expect(result.signal, result.stderr).toBeNull();
expect(result.exitCode, result.stderr).toBe(0);
expect(result.stderr).toBe("");
@@ -73,7 +73,6 @@ processTest(
["--input-type=module", "--eval", source],
{
env: { ...process.env, REA_BROWSER_EXECUTABLE: "fixture-chrome" },
timeoutMs: 15_000,
},
);
expect(result.exitCode, result.stderr).toBe(0);
@@ -3774,7 +3774,7 @@ const runNode = async (
const result = await processes.run(
process.execPath,
[...nodeArguments, ...(preloadHook ? ["-r", hook] : []), script],
{ cwd: root, env: process.env, timeoutMs: 10_000 },
{ cwd: root, env: process.env },
);
return {
code: result.exitCode,
@@ -90,7 +90,6 @@ cliTest(
const fromCli = await cli.run({
arguments: ["inspect-web-network-capture", path, "har", "--json"],
timeoutMs: 120_000,
});
expect(fromCli.exitCode).toBe(0);
const cliSummary = summarize(fromCli.json);
@@ -29,7 +29,6 @@ cliTest(
arguments: ["mcp", "add", "--agent=amp", ...options, "--json"],
cwd: root,
environment,
timeoutMs: 20_000,
});
const settingsPath = ampSettings(home);
const original = JSON.stringify(
@@ -133,7 +132,6 @@ cliTest(
arguments: ["mcp", "add", "--agent", "amp", "--json"],
cwd: root,
environment,
timeoutMs: 20_000,
});
expect(rejected.exitCode, rejected.stderr).toBe(1);
expect(mcpRegistrationReportSchema.parse(rejected.json)).toMatchObject({
-4
View File
@@ -293,7 +293,6 @@ describe("CLI output flag value forms", () => {
]) {
const result = await cli.run({
arguments: [...filter, "providers", "--json"],
timeoutMs: 10_000,
});
expect(result.exitCode).toBe(0);
expect(JSON.parse(result.stdout)).toEqual({});
@@ -393,7 +392,6 @@ describe("unclosed CLI output filter slices", () => {
"--filter-output",
"result[0,1].name[",
],
timeoutMs: 3000,
});
expect(result.exitCode).toBe(1);
expect(result.stdout).toContain("INVALID_OUTPUT_FILTER");
@@ -402,7 +400,6 @@ describe("unclosed CLI output filter slices", () => {
}
const splitPath = await cli.run({
arguments: ["providers", "--json", "--filter-output", "][,]"],
timeoutMs: 3000,
});
expect(splitPath.exitCode).toBe(1);
expect(splitPath.json).toMatchObject({
@@ -422,7 +419,6 @@ describe("unclosed CLI output filter slices", () => {
"--filter-output",
"capabilities[0,1].provider.id,open",
],
timeoutMs: 3000,
});
expect(result.exitCode).toBe(0);
expect(result.json).toEqual({
-1
View File
@@ -365,7 +365,6 @@ cliTest.skipIf(process.platform === "win32")(
XDG_DATA_HOME: join(home, ".local", "share"),
XDG_CACHE_HOME: join(home, ".cache"),
},
timeoutMs: 20_000,
});
const planned = await setup("--dry-run");
@@ -306,7 +306,6 @@ cliTest(
XDG_CONFIG_HOME: join(root, "xdg-config"),
XDG_CACHE_HOME: join(root, "xdg-cache"),
},
timeoutMs: 20_000,
});
expect(result.exitCode, result.stderr).toBe(0);
@@ -352,7 +351,6 @@ for (const group of groups) {
arguments: arguments_,
cwd: home,
environment,
timeoutMs: 20_000,
});
const planned = await run([
"setup",
@@ -470,7 +468,6 @@ cliTest("uninstall names each retained skill directory", async ({ cli }) => {
USERPROFILE: home,
CLAUDE_CONFIG_DIR: join(home, ".claude"),
},
timeoutMs: 20_000,
});
expect(result.exitCode, result.stderr).toBe(0);
@@ -33,7 +33,6 @@ cliTest(
USERPROFILE: home,
CLAUDE_CONFIG_DIR: "",
},
timeoutMs: 20_000,
});
const setup = (flags: readonly string[] = []) =>
run(["setup", "--client", "claude_code", ...flags, "--json"]);
@@ -151,7 +150,6 @@ for (const policy of [{ excluded: ["rea"] }, { allowed: ["other"] }]) {
arguments: arguments_,
cwd: home,
environment: { HOME: home, USERPROFILE: home },
timeoutMs: 20_000,
});
const setup = await run([
"setup",
@@ -221,7 +219,6 @@ cliTest(
arguments: arguments_,
cwd: home,
environment: { HOME: home, USERPROFILE: home },
timeoutMs: 20_000,
});
const before = await run(["doctor", "--client", "opencode", "--json"]);
expect(before.exitCode).toBe(1);
@@ -49,7 +49,6 @@ cliTest(
],
cwd: f.home,
environment: f.environment,
timeoutMs: 20_000,
});
const first = await run();
expect(first.exitCode, first.stderr).toBe(0);
@@ -107,7 +106,6 @@ cliTest(
arguments: ["mcp", "add", ...(json ? ["--json"] : [])],
cwd: f.home,
environment: f.environment,
timeoutMs: 20_000,
});
expect(result.exitCode).toBe(1);
const document = report(result.stdout, json);
@@ -142,7 +140,6 @@ cliTest(
arguments: arguments_,
cwd: f.home,
environment: f.environment,
timeoutMs: 20_000,
});
expect(result.exitCode, result.stdout).toBe(0);
expect(await readFile(f.settings, "utf8")).toBe("broken JSON\n");
@@ -167,7 +164,6 @@ cliTest(
arguments: arguments_,
cwd: f.home,
environment: f.environment,
timeoutMs: 20_000,
});
const registered = await run();
expect(registered.exitCode, registered.stdout).toBe(0);
@@ -235,7 +231,6 @@ cliTest(
],
cwd: f.home,
environment: f.environment,
timeoutMs: 20_000,
});
expect(result.exitCode, result.stdout).toBe(0);
expect(report(result.stdout, true)).toMatchObject({
@@ -265,7 +260,6 @@ cliTest(
arguments: ["mcp", "add", ...options, "--json"],
cwd: f.home,
environment: f.environment,
timeoutMs: 20_000,
});
expect(result.exitCode, result.stderr).toBe(1);
expect(result.json).toMatchObject({
@@ -91,7 +91,6 @@ cliTest.skipIf(!["darwin", "linux"].includes(process.platform))(
"--json",
],
environment,
timeoutMs: 45_000,
});
const report = z
.object({ scope_checks: z.array(checkSchema) })
@@ -152,7 +151,6 @@ cliTest.skipIf(!["darwin", "linux"].includes(process.platform))(
"--json",
],
environment,
timeoutMs: 45_000,
});
const report = z
.object({ scope_checks: z.array(checkSchema) })
@@ -183,7 +181,6 @@ cliTest.skipIf(!["darwin", "linux"].includes(process.platform))(
...environment,
REA_DOCKER_COMMAND: join(environment.HOME, "..", "bin", "docker"),
},
timeoutMs: 45_000,
});
expect(result.exitCode, result.stderr).toBe(1);
@@ -242,7 +239,6 @@ cliTest.skipIf(!["darwin", "linux"].includes(process.platform))(
"--json",
],
environment,
timeoutMs: 45_000,
});
const plan = z
@@ -178,7 +178,6 @@ cliTest.skipIf(!["darwin", "linux"].includes(process.platform))(
REA_HOPPER_TEST_MARKER: launchMarker,
GHIDRA_INSTALL_DIR: join(home, "missing-ghidra"),
},
timeoutMs: 20_000,
});
const hopperReady = process.platform === "darwin";
@@ -75,7 +75,6 @@ const run = async (
const result = await cli.run({
arguments: [...arguments_, "--json"],
environment,
timeoutMs: 30_000,
});
return { result, report: reportSchema.safeParse(result.json) };
};
@@ -44,7 +44,6 @@ cliTest.for([
REA_FUSE_PROBE_TRACE: tracePath,
REA_FUSE_PROBE_ALLOW: join(root, "allow"),
},
timeoutMs: 30_000,
},
);
const trace = (await readFile(tracePath, "utf8"))
@@ -59,7 +59,6 @@ cliTest(
"--json",
],
cwd: root,
timeoutMs: 60_000,
});
expect(built.exitCode, built.stderr).toBe(0);
expect(built.json).toMatchObject({
@@ -111,7 +110,6 @@ cliTest(
join(root, "three-step"),
"--json",
],
timeoutMs: 60_000,
});
expect(exported.exitCode, exported.stderr).toBe(0);
@@ -178,7 +176,6 @@ cliTest(
"--capture-timeout-ms=030000",
"--json",
],
timeoutMs: 60_000,
});
expect(planned.exitCode, planned.stderr).toBe(0);
expect(planned.json).toMatchObject({
@@ -231,7 +228,6 @@ cliTest(
const noDirectory = await cli.run({
arguments: ["environment-build", har, "--json"],
timeoutMs: 60_000,
});
expect(noDirectory.exitCode).toBe(1);
expect(noDirectory.json).toMatchObject({
@@ -265,7 +261,6 @@ cliTest.for(["--dry-run=abc", "--dry-run="] as const)(
await writeFile(har, JSON.stringify(environmentManifestHar()));
const result = await cli.run({
arguments: ["environment-build", har, output, dryRun, "--json"],
timeoutMs: 60_000,
});
expect(result.exitCode).not.toBe(0);
expect(`${result.stdout}\n${result.stderr}`).toContain("--dry-run");
@@ -284,7 +279,6 @@ cliTest.for(["--dry-run=true", "--dry-run=false"] as const)(
await writeFile(har, JSON.stringify(environmentManifestHar()));
const result = await cli.run({
arguments: ["environment-build", har, output, dryRun, "--json"],
timeoutMs: 60_000,
});
expect(result.exitCode, result.stderr).toBe(0);
expect(result.json).toMatchObject({
@@ -709,7 +709,6 @@ describe("rea environment-compare replay and chronology", () => {
files.probe,
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(0);
expect(result.json).toMatchObject({
@@ -737,7 +736,6 @@ describe("rea environment-compare replay and chronology", () => {
files.manifest,
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -46,7 +46,6 @@ cliTest(
NODE_OPTIONS: `--import=${preload} --max-old-space-size=768`,
NODE_DISABLE_COMPILE_CACHE: "1",
},
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -93,7 +92,6 @@ cliTest(
name,
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -123,7 +121,6 @@ cliTest(
directory,
"--json",
],
timeoutMs: 30_000,
});
expect(result.stderr).toBe("");
expect(result.exitCode).toBe(0);
@@ -211,7 +208,6 @@ cliTest(
directory,
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -253,7 +249,6 @@ cliTest(
directory,
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -290,7 +285,6 @@ cliTest.skipIf(process.platform === "win32")(
NODE_OPTIONS: `--import=${preload} --max-old-space-size=768`,
NODE_DISABLE_COMPILE_CACHE: "1",
},
timeoutMs: 30_000,
});
expect(result.exitCode, result.stderr).toBe(0);
for (const relative of BUNDLE_FILES) {
@@ -332,7 +326,6 @@ cliTest.skipIf(process.platform === "win32")(
packagePath,
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode, result.stderr).toBe(0);
expect(result.json).toMatchObject({
@@ -387,7 +380,6 @@ cliTest.skipIf(HOST_PATH_MAX[process.platform] === undefined)(
directory,
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -46,7 +46,6 @@ for (const role of ["manifest", "evidence"] as const) {
REA_TEST_EXPORT_READ_MARKER: marker,
REA_TEST_EXPORT_READ_ACTION: "append",
},
timeoutMs: 30_000,
});
expect(await readFile(marker, "utf8")).toBe("read");
expect(
@@ -122,7 +121,6 @@ cliTest(
REA_TEST_EXPORT_READ_MARKER: marker,
REA_TEST_EXPORT_READ_ACTION: "record",
},
timeoutMs: 30_000,
});
expect(result.exitCode, result.stderr).toBe(1);
const limits = heapRefusalSchema.parse(result.json).details
@@ -178,7 +176,6 @@ cliTest(
REA_TEST_EXPORT_READ_MARKER: marker,
REA_TEST_EXPORT_READ_ACTION: "fail-copy",
},
timeoutMs: 30_000,
});
expect(await readFile(marker, "utf8")).toBe("copy");
expect(await readFile(tarball, "utf8")).toBe("admitted package");
@@ -41,7 +41,6 @@ describe("rea environment-serve refusals", () => {
"0",
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -66,7 +65,6 @@ describe("rea environment-serve refusals", () => {
const files = await writeEnvironmentServeFiles(root);
const result = await cli.run({
arguments: ["environment-serve", files.manifestPath, "--json"],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -97,7 +95,6 @@ describe("rea environment-serve refusals", () => {
flag,
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -121,7 +118,6 @@ describe("rea environment-serve refusals", () => {
files.capturePath,
"--json",
],
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -195,7 +191,6 @@ cliTest(
"0",
"--json",
],
timeoutMs: 30000,
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
@@ -37,7 +37,6 @@ const serve = async (
String(port),
"--json",
],
timeoutMs: 30_000,
});
return {
exitCode: result.exitCode,
@@ -23,24 +23,22 @@ cliTest.skipIf(process.platform !== "darwin")(
const directory = await createTestTempDirectory("rea-foreign-fat-cli-");
const thin = join(directory, "thin");
const universal = join(directory, "universal");
const compiled = await processes.run(
"/usr/bin/xcrun",
[
"clang",
"-arch",
foreign.name,
resolve("tests/conformance/c/fixture.c"),
"-o",
thin,
],
{ timeoutMs: 30_000 },
);
const compiled = await processes.run("/usr/bin/xcrun", [
"clang",
"-arch",
foreign.name,
resolve("tests/conformance/c/fixture.c"),
"-o",
thin,
]);
expect(compiled.exitCode, compiled.stderr).toBe(0);
const created = await processes.run(
"/usr/bin/xcrun",
["lipo", "-create", thin, "-output", universal],
{ timeoutMs: 30_000 },
);
const created = await processes.run("/usr/bin/xcrun", [
"lipo",
"-create",
thin,
"-output",
universal,
]);
expect(created.exitCode, created.stderr).toBe(0);
const result = await cli.run({
@@ -31,7 +31,6 @@ cliTest.for(["pipe", "capacity"] as const)(
JAVA_HOME: join(root, "missing-jdk"),
REA_LOG_LEVEL: "silent",
},
timeoutMs: 5000,
});
expect(result.exitCode, `${result.stdout}\n${result.stderr}`).toBe(1);
expect(result.signal).toBeNull();
@@ -156,7 +156,6 @@ setTimeout(() => process.exit(92), 12000);
GHIDRA_INSTALL_DIR: install,
REA_LOG_LEVEL: "silent",
},
timeoutMs: 15000,
});
// Capture the actual group while the selected process is alive; the PID
// alone is never used as cleanup authority. Release is a private protocol.
@@ -147,7 +147,6 @@ describe.skipIf(process.platform === "win32")(
{
cwd: workspace,
env,
timeoutMs: 30_000,
},
);
const checkoutReports = join(workspace, "reports", "rea");
@@ -79,7 +79,6 @@ cliTest(
});
const built = await cli.run({
arguments: ["environment-build", har, "--dry-run", "--json"],
timeoutMs: 60_000,
});
expect(built.exitCode, built.stdout + built.stderr).toBe(0);
expect(built.json).toMatchObject({
@@ -54,7 +54,6 @@ describe("Hopper launcher failure through the one-shot CLI", () => {
HOPPER_LOADER_ARGS_JSON: JSON.stringify(loaderArgs),
REA_LOG_LEVEL: "silent",
},
timeoutMs: 45_000,
});
const retained = RetainedRuntime.safeParse(result.json);
if (retained.success)
@@ -15,7 +15,6 @@ cliTest.skipIf(process.platform === "win32")(
const result = await cli.run({
arguments: ["doctor", "--provider", "ida", "--json"],
environment: { HOME: root, REA_IDA_MCP_CONFIG: registration },
timeoutMs: 10_000,
});
expect(result.exitCode, result.stderr).toBe(1);
expect(result.json).toMatchObject({
@@ -64,7 +63,6 @@ cliTest.skipIf(process.platform !== "darwin").for([true, false])(
const result = await cli.run({
arguments: ["doctor", "--provider", "ida", "--json"],
environment: { HOME: root, REA_IDA_MCP_CONFIG: registration },
timeoutMs: 10_000,
});
expect(result.exitCode, result.stderr).toBe(usable ? 0 : 1);
expect(result.json).toMatchObject({
@@ -144,7 +142,6 @@ cliTest.for([
const result = await cli.run({
arguments: ["doctor", "--provider", "ida", "--json"],
environment: { HOME: root, REA_IDA_MCP_CONFIG: path },
timeoutMs: 10_000,
});
expect(result.exitCode, result.stderr).toBe(
constraint === undefined ? 0 : 1,
@@ -171,7 +168,6 @@ cliTest.for([
const providers = await cli.run({
arguments: ["providers", "--json"],
environment: { HOME: root, REA_IDA_MCP_CONFIG: path },
timeoutMs: 10_000,
});
expect(providers.exitCode, providers.stderr).toBe(0);
expect(providers.json).toMatchObject({
@@ -58,7 +58,6 @@ describe("headless IDA timeout through the one-shot CLI", () => {
REA_IDA_MCP_CONFIG: registration,
REA_LOG_LEVEL: "silent",
},
timeoutMs: 30_000,
});
expect(result.exitCode).toBe(1);
@@ -227,7 +227,6 @@ workspaceCliTest.for([
REA_IDA_MCP_CONFIG: registration,
REA_LOG_LEVEL: "silent",
},
timeoutMs: 15000,
});
expect(result.stderr).toBe("");
expect(supervisor.database).toBeUndefined();
@@ -112,7 +112,7 @@ processTest.for([1_000, 16_000])(
path,
"--json",
],
{ cwd: root, timeoutMs: 30_000 },
{ cwd: root },
);
expect(
response.exitCode,
-1
View File
@@ -124,7 +124,6 @@ it.each(
const result = await cli.run({
arguments: argv,
environment: { HOME: home, REA_JEB_MCP_URL: fixture.endpoint },
timeoutMs: 10_000,
});
const output = JSON.parse(result.stdout);
if (stage === "success") {
@@ -41,7 +41,6 @@ ${mutation}
REA_KUNA_CACHE_DIR: join(root, "cache"),
REA_LOG_LEVEL: "silent",
},
timeoutMs: 20_000,
});
const after = await readFile(executable);
const afterHash = createHash("sha256").update(after).digest("hex");
@@ -212,7 +212,6 @@ cliTest(
"md",
"--full-output",
],
timeoutMs: 20_000,
});
expect(markdown.exitCode, markdown.stderr).toBe(0);
const renderer = await createMarkdownRenderer(root, { linkify: false });
@@ -19,7 +19,6 @@ cliTest(
arguments: arguments_,
cwd: home,
environment,
timeoutMs: 30_000,
});
const schema = await run([
"mcp",
@@ -110,7 +109,6 @@ cliTest(
arguments: arguments_,
cwd: home,
environment,
timeoutMs: 30_000,
});
const filtered = await run([
"mcp",
@@ -23,7 +23,6 @@ cliTest("mcp add rejects valued options without a value", async ({ cli }) => {
arguments: [...arguments_, "--json"],
cwd: root,
environment: await registrationEnvironment(selectedHome),
timeoutMs: 20_000,
});
for (const [flag, field] of [
@@ -106,7 +105,6 @@ cliTest(
arguments: [...arguments_, "--json"],
cwd: root,
environment,
timeoutMs: 20_000,
});
// Incur skips a stray word, so the registration used to succeed for a request
@@ -178,7 +176,6 @@ cliTest(
arguments: [...arguments_, "--json"],
cwd: root,
environment,
timeoutMs: 20_000,
});
// A stray word alongside a missing value: the message describes the missing
@@ -223,7 +220,6 @@ cliTest(
],
cwd: project,
environment,
timeoutMs: 20_000,
});
expect(result.exitCode, result.stderr).toBe(1);
expect(result.json).toMatchObject({
@@ -58,7 +58,6 @@ describe("Swift demangling CLI with line-terminator characters", () => {
"--json",
],
environment,
timeoutMs: 20_000,
});
expect(result.signal).toBeNull();
expect(result.exitCode).toBe(1);
@@ -76,7 +75,6 @@ describe("Swift demangling CLI with line-terminator characters", () => {
const result = await cli.run({
arguments: ["demangle-swift", "--json"],
environment,
timeoutMs: 20_000,
});
expect(result.signal).toBeNull();
expect(result.exitCode).toBe(1);
@@ -31,11 +31,15 @@ describe.skipIf(process.platform !== "darwin")(
const source = join(directory, "watch.c");
await writeFile(source, "int rea_watch_value(void) { return 42; }\n");
const object = join(directory, "watch.o");
const compiled = await processes.run(
"/usr/bin/xcrun",
["clang", "-arch", "arm64_32", "-c", source, "-o", object],
{ timeoutMs: 30_000 },
);
const compiled = await processes.run("/usr/bin/xcrun", [
"clang",
"-arch",
"arm64_32",
"-c",
source,
"-o",
object,
]);
expect(compiled.exitCode, compiled.stderr).toBe(0);
for (const command of [
"list-architectures",
@@ -20,18 +20,14 @@ describe.skipIf(process.platform !== "darwin")(
const source = join(directory, "library.c");
const library = join(directory, "libprobe.dylib");
await writeFile(source, "int exported_value(void) { return 42; }\n");
const compiled = await processes.run(
"/usr/bin/xcrun",
[
"clang",
"-dynamiclib",
source,
"-Wl,-install_name,@rpath/libprobe.dylib",
"-o",
library,
],
{ timeoutMs: 30_000 },
);
const compiled = await processes.run("/usr/bin/xcrun", [
"clang",
"-dynamiclib",
source,
"-Wl,-install_name,@rpath/libprobe.dylib",
"-o",
library,
]);
expect(compiled.exitCode, compiled.stderr).toBe(0);
const result = await cli.run({
arguments: ["inspect-macho", library, "--json"],
@@ -54,11 +50,12 @@ describe.skipIf(process.platform !== "darwin")(
// One architecture can still have a FAT container header.
const universal = join(directory, "libprobe-universal.dylib");
const combined = await processes.run(
"/usr/bin/lipo",
["-create", library, "-output", universal],
{ timeoutMs: 30_000 },
);
const combined = await processes.run("/usr/bin/lipo", [
"-create",
library,
"-output",
universal,
]);
expect(combined.exitCode, combined.stderr).toBe(0);
const fatResult = await cli.run({
arguments: ["inspect-macho", universal, "--json"],
@@ -52,20 +52,16 @@ describe.skipIf(process.platform !== "darwin")(
"rea-native-cli-echo-",
);
const fixture = join(directory, "fat-fixture");
const compiled = await processes.run(
"/usr/bin/xcrun",
[
"clang",
"-arch",
"arm64",
"-arch",
"x86_64",
resolve("tests/conformance/c/fixture.c"),
"-o",
fixture,
],
{ timeoutMs: 30_000 },
);
const compiled = await processes.run("/usr/bin/xcrun", [
"clang",
"-arch",
"arm64",
"-arch",
"x86_64",
resolve("tests/conformance/c/fixture.c"),
"-o",
fixture,
]);
expect(compiled.exitCode, compiled.stderr).toBe(0);
const inspect = async (name: string) => {
const path = join(directory, name);
@@ -37,9 +37,7 @@ describe.skipIf(process.platform !== "darwin")(
const fat = join(directory, "fat_enc");
await writeFile(source, "int main(void) { return 0; }\n");
const run = async (command: string, arguments_: string[]) => {
const result = await processes.run(command, arguments_, {
timeoutMs: 30_000,
});
const result = await processes.run(command, arguments_);
expect(result.exitCode, result.stderr).toBe(0);
return result.stdout;
};
@@ -28,11 +28,13 @@ describe.skipIf(process.platform !== "darwin")(
"",
].join("\n"),
);
const compiled = await processes.run(
"/usr/bin/xcrun",
["clang", "-c", source, "-o", object],
{ timeoutMs: 30_000 },
);
const compiled = await processes.run("/usr/bin/xcrun", [
"clang",
"-c",
source,
"-o",
object,
]);
expect(compiled.exitCode, compiled.stderr).toBe(0);
const result = await cli.run({
arguments: ["inspect-macho", object, "--json"],
@@ -58,9 +58,7 @@ describe.skipIf(process.platform !== "darwin")(
["clang", "-o", control, source],
["clang", "-c", source, "-o", object],
]) {
const compiled = await processes.run("/usr/bin/xcrun", arguments_, {
timeoutMs: 30_000,
});
const compiled = await processes.run("/usr/bin/xcrun", arguments_);
expect(compiled.exitCode, compiled.stderr).toBe(0);
}
@@ -20,11 +20,13 @@ describe.skipIf(process.platform !== "darwin")(
const source = join(directory, "qa.c");
const object = join(directory, "qa.o");
await writeFile(source, "int qa(void) { return 7; }\n");
const compiled = await processes.run(
"/usr/bin/xcrun",
["clang", "-c", source, "-o", object],
{ timeoutMs: 30_000 },
);
const compiled = await processes.run("/usr/bin/xcrun", [
"clang",
"-c",
source,
"-o",
object,
]);
expect(compiled.exitCode, compiled.stderr).toBe(0);
const result = await cli.run({
arguments: ["inspect-macho", object, "--json"],
@@ -70,7 +70,6 @@ cliTest.skipIf(process.platform === "win32")(
const setup = await processes.run(npm.command, npm.arguments, {
cwd: trusted,
env: environment,
timeoutMs: 30_000,
});
expect(setup.exitCode, setup.stderr).toBe(0);
const configPath = join(home, ".omp", "agent", "mcp.json");
@@ -160,7 +159,7 @@ cliTest.skipIf(process.platform === "win32")(
const missing = await processes.run(
registration.command,
registration.args,
{ cwd: project, env: clientEnvironment, timeoutMs: 10_000 },
{ cwd: project, env: clientEnvironment },
);
expect(missing.exitCode).not.toBe(0);
await expect(access(marker)).rejects.toMatchObject({ code: "ENOENT" });
@@ -192,7 +191,6 @@ cliTest.skipIf(process.platform === "win32")(
USERPROFILE: home,
PATH: [bin, process.env.PATH ?? ""].join(delimiter),
},
timeoutMs: 20_000,
},
);
expect(result.exitCode, result.stderr).toBe(0);
@@ -211,7 +209,7 @@ cliTest.skipIf(process.platform === "win32")(
const start = await processes.run(
settings["amp.mcpServers"].rea.command,
[alias, "--version"],
{ cwd: home, timeoutMs: 10_000 },
{ cwd: home },
);
expect(start.exitCode, start.stderr).toBe(0);
expect(start.stdout).toContain(PRODUCT_IDENTITY.packageVersion);
@@ -75,7 +75,6 @@ for (const { runner, userAgent } of [
arguments: arguments_,
cwd: home,
environment,
timeoutMs: 20_000,
});
const setup = await run([
"setup",
@@ -28,7 +28,6 @@ cliTest.skipIf(process.platform === "win32").for(["blocked", "ready"] as const)(
REA_KUNA_COMMAND: command,
REA_KUNA_CACHE_DIR: cachePath,
},
timeoutMs: 20_000,
});
expect(result.exitCode, result.stderr).toBe(0);
expect(result.json).toMatchObject({
@@ -88,7 +87,6 @@ cliTest.skipIf(process.platform === "win32")(
const setup = await cli.run({
arguments: ["setup", "--client", "claude_code", "--dry-run", "--json"],
environment,
timeoutMs: 20_000,
});
expect(setup.exitCode, setup.stdout).toBe(0);
expect(setup.json).toMatchObject({
@@ -111,7 +109,6 @@ cliTest.skipIf(process.platform === "win32")(
const doctor = await cli.run({
arguments: ["doctor", "--json"],
environment,
timeoutMs: 20_000,
});
expect(doctor.json).toMatchObject({
providerInspections: expect.arrayContaining([
@@ -130,15 +130,12 @@ cliTest.skipIf(process.platform === "win32")(
const root = await createTestTempDirectory("rea-script-selection-cli-");
const capturePath = join(root, "capture.pipe");
const outputDirectory = join(root, "export");
const created = await processes.run("mkfifo", [capturePath], {
timeoutMs: 5_000,
});
const created = await processes.run("mkfifo", [capturePath]);
expect(created.exitCode).toBe(0);
const response = await cli.run({
arguments: ["export-web-scripts", capturePath, outputDirectory, "--json"],
environment: { REA_LOG_LEVEL: "silent" },
timeoutMs: 5_000,
});
expect(response.exitCode).toBe(1);
expect(response.signal).toBeNull();
@@ -53,7 +53,6 @@ for (const [fixture, factory, ordinaryPath, malformedPath] of [
["--input-type=module", "-e", program],
{
cwd: fileURLToPath(new URL("../../../", import.meta.url)),
timeoutMs: 10_000,
},
);
expect(result.signal, result.stderr).toBeNull();
@@ -116,7 +116,6 @@ it("keeps owned Gemini launcher facts separate from native connection admission
process.execPath,
["--import", "tsx", entrypoint],
{
timeoutMs: 20_000,
env: {
PATH: process.env.PATH,
SystemRoot: process.env.SystemRoot,
@@ -249,7 +249,6 @@ for (const scenario of cases) {
],
{
cwd: project,
timeoutMs: 15_000,
},
);
expect(result.signal, result.stderr).toBeNull();
@@ -294,7 +293,7 @@ export const unnecessary = /\!/;
"--fix",
applicationSource,
],
{ cwd: project, timeoutMs: 15_000 },
{ cwd: project },
);
expect(result.signal, result.stderr).toBeNull();
expect(result.exitCode, result.stderr || result.stdout).toBe(0);
@@ -18,11 +18,11 @@ processTest.skipIf(process.platform === "win32")(
import.meta.url,
),
);
const result = await processes.run(
process.execPath,
[probe, readerModule, root],
{ timeoutMs: 3_000 },
);
const result = await processes.run(process.execPath, [
probe,
readerModule,
root,
]);
expect(result.exitCode, result.stderr).toBe(0);
expect(result.stdout.trim()).toBe("changed");
},
@@ -154,7 +154,6 @@ processTest(
[reporter, "typed-lint", ...Object.keys(sources)],
{
cwd: root,
timeoutMs: 20_000,
env: { ...process.env, GOMAXPROCS: "2", GOMEMLIMIT: "1GiB" },
},
);
@@ -263,11 +263,11 @@ processTest(
else await removeTestWorkspace(workspace.root);
}
`;
const result = await processes.run(
process.execPath,
["--input-type=module", "--eval", program],
{ timeoutMs: 20_000 },
);
const result = await processes.run(process.execPath, [
"--input-type=module",
"--eval",
program,
]);
expect(result.exitCode, result.stderr).toBe(0);
expect(result.signal, result.stderr).toBeNull();
@@ -354,23 +354,16 @@ it("rejects relative paths through in-memory MCP handlers", async () => {
}
});
it("rejects unpaired surrogates through in-memory MCP handlers without advertising them", async () => {
// advertisedPatternsVMode.test.ts proves no schema profile advertises the
// surrogate escape; this case proves the handlers still refuse such paths.
it("rejects unpaired surrogates through in-memory MCP handlers", async () => {
const firmwareCalls: string[] = [];
const { client, close } = await createMcp(firmwareCalls, "full");
const { client, close } = await createMcp(firmwareCalls);
try {
const absolute = resolve("rea-absolute-input");
const cases = inputCases(absolute, `${absolute}\ud800`);
const listed = await client.listTools();
const checked: string[] = [];
for (const { name, field, invalid, issuePath } of cases) {
const schema = listed.tools.find(
(tool) => tool.name === name,
)?.inputSchema;
if (schema === undefined)
throw new Error(`Missing advertised tool ${name}`);
// Strict pattern compilers refuse the complete tools request for a
// `\uD800-\uDFFF` range, so the rule is enforced only by the handler.
expect(JSON.stringify(schema), name).not.toMatch(/\\\\u[dD][89a-fA-F]/u);
const result = await client.callTool({ name, arguments: invalid });
expect(result.isError, `${name}.${field}`).toBe(true);
expect(parseMcpToolError(result).error, `${name}.${field}`).toMatchObject(
@@ -46,7 +46,6 @@ for (const scenario of [
const digest = createHash("sha256").update(source).digest("hex");
const cliResponse = await cli.run({
arguments: ["analyze-javascript-application", root, "--json"],
timeoutMs: 60_000,
});
expect(cliResponse.exitCode).toBe(0);
const cliEvidence = toolContract(
@@ -48,7 +48,6 @@ cliTest(
"directory",
"--json",
],
timeoutMs: 60_000,
});
expect(cliResponse.exitCode).toBe(0);
const cliEvidence = toolContract(
+37 -3
View File
@@ -8,7 +8,7 @@ import {
MCP_CONNECTION_LOST,
MCP_TRANSPORT_ERROR,
MCP_CONNECTION_START_FAILED,
MCP_HTTP_LISTEN_FAILED,
mcpHttpListenFailed,
MCP_SHUTDOWN_FAILED,
SERVER_START_FAILED,
} from "../../../src/main/messages.js";
@@ -251,7 +251,9 @@ describe("MCP runtime HTTP transport errors", () => {
}),
),
).toBe(1);
expect(output).toEqual([`${refused.remediationAction}\n`]);
expect(output).toEqual([
`${mcpHttpListenFailed(refused.remediationAction)}\n`,
]);
expect(output[0]).toContain("Set MCP_ALLOWED_HOSTS");
expect(output[0]).not.toContain("Choose another --port");
});
@@ -273,6 +275,38 @@ describe("MCP runtime HTTP transport errors", () => {
}),
),
).toBe(1);
expect(output).toEqual([`${MCP_HTTP_LISTEN_FAILED}\n`]);
expect(output).toHaveLength(1);
expect(output[0]).toMatch(
/^REA could not listen for MCP HTTP connections\./u,
);
expect(output[0]).not.toContain("SECRET");
});
it.each([
["ENOTFOUND", /host name resolution/u],
["EADDRNOTAVAIL", /address assigned to this machine/u],
["EACCES", /permitted to bind/u],
["EADDRINUSE", /another --port or MCP_PORT/u],
])(
"reports %s listener recovery from its parsed failure",
async (code, recovery) => {
const output: string[] = [];
const cause = Object.assign(new Error(`SECRET ${code}`), { code });
expect(
await run(
dependencies({
serve: () => Promise.reject(new StreamableHttpListenError(cause)),
output,
shutdown: [],
exitCodes: [],
}),
),
).toBe(1);
expect(output).toHaveLength(1);
expect(output[0]).toMatch(recovery);
expect(output[0]).not.toContain("SECRET");
if (code !== "EADDRINUSE")
expect(output[0]).not.toContain("Choose another --port");
},
);
});
@@ -7,22 +7,18 @@ processTest.for([3, 130_000])(
async (count, { processes }) => {
// Thread-pool tests have a larger stack than the stdio server. Use a fresh
// main thread and enough heap for the ledger's conservative admission.
const result = await processes.run(
process.execPath,
[
"--max-old-space-size=4096",
"--import",
"tsx",
fileURLToPath(
new URL(
"../../fixtures/promptOccurrenceCompletion.ts",
import.meta.url,
),
const result = await processes.run(process.execPath, [
"--max-old-space-size=4096",
"--import",
"tsx",
fileURLToPath(
new URL(
"../../fixtures/promptOccurrenceCompletion.ts",
import.meta.url,
),
String(count),
],
{ timeoutMs: 30_000 },
);
),
String(count),
]);
expect(result.exitCode, result.stderr).toBe(0);
expect(JSON.parse(result.stdout)).toMatchObject({
values: Math.min(count + 1, 100),
@@ -26,11 +26,11 @@ processTest(
const entry = join(root, "scripts/fixtures/android/fetch.mjs");
// Invalid arguments stop before downloads while exercising Node's real
// source-module loading, without Vitest's .js-to-.ts resolution.
const result = await processes.run(
process.execPath,
[entry, "extra", "argument"],
{ timeoutMs: 10000 },
);
const result = await processes.run(process.execPath, [
entry,
"extra",
"argument",
]);
expect(result.exitCode).toBe(1);
expect(result.stderr).toContain(
"Usage: npm run fixtures:android -- [DIRECTORY]",
Loaded 100 of 122 files, more files were not shown because too many files have changed in this diff. Show more