mirror of
https://github.com/morluto/rea
synced 2026-10-28 06:46:47 -04:00
1201c25542
* fix(ci): retire unused internal analysis declarations * test: use an admitted app bundle for provider routing (cherry picked from commit00aa17f12a) * test: keep bundle routing coverage outside oversized group (cherry picked from commit8658353b0d) * fix(ci): align regression fixtures with current admission contracts * test: bind extraction close fixtures to their ZIP digest (cherry picked from commit626d0250db) * test(cli): match typed analysis outcomes in function detail fixture * test(ghidra): preserve empty Java property separator framing * test(electron): retain unknown IPC ownership for native module gaps * fix(electron): share source-scoped call path identity * test(captures): assert safe source identity on SAZ refusal * test(apple): match root occurrence kind to inventory manifest * fix(examples): align directory root occurrence identity * test(electron): align equivalent fixture assertions with upstream * test(process): assert retained capture root identity * test(windows): declare the PE fixture optional header * test(ci): refresh owned registration and verifier fixtures * test(setup): use owned registrations for refresh fixtures * test(process): control unavailable ownership in CLI cleanup fixture * test(process): guard controlled compiler output arguments * test(setup): align equivalent entrypoint guards with upstream * test(process): release the cleanup target through an owned gate * test(ci): align semantic identities and owned fixture facts * test(pcap): retain the upstream DNS wire fixture branch * test(pcap): use the canonical wire ownership fixture * test(pcap): assert exact DNS wire query labels * test(ci): preserve admission and ownership fixture prerequisites * test(ci): align authenticated fixture and cleanup boundaries * test(windows): align native artifact fixtures with upstream * test(android): request complete evidence for inline MCP contracts * test: avoid pinning diagnostic wording * test: verify cleanup diagnostics at their source * test: strengthen evidence and cleanup checks * test: avoid pinning registration guidance --------- Co-authored-by: Plastic-time <Plastic-time@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
119 lines
4.4 KiB
TypeScript
119 lines
4.4 KiB
TypeScript
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
import { dirname, join } from "node:path";
|
|
import { expect } from "vitest";
|
|
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
import { cliTest } from "../../support/cli/cliFixture.js";
|
|
|
|
const environmentFor = (home: string) => ({
|
|
HOME: home,
|
|
USERPROFILE: home,
|
|
CODEX_HOME: join(home, ".codex"),
|
|
XDG_CONFIG_HOME: join(home, ".config"),
|
|
TMPDIR: home,
|
|
});
|
|
|
|
const setupArguments = [
|
|
"setup",
|
|
"--client",
|
|
"codex",
|
|
"--skill=false",
|
|
"--json",
|
|
] as const;
|
|
|
|
cliTest(
|
|
"codex setup and uninstall preserve signed 64-bit TOML integers exactly",
|
|
async ({ cli }) => {
|
|
const home = await createTestTempDirectory("rea-toml-int64-");
|
|
const config = join(home, ".codex/config.toml");
|
|
const original =
|
|
"[history]\n" +
|
|
"max_bytes = 9223372036854775807 # Int64 maximum\n" +
|
|
"floor = -9223372036854775808\n" +
|
|
"spelled = 0x7fff_ffff_ffff_ffff\n";
|
|
await mkdir(dirname(config), { recursive: true });
|
|
await writeFile(config, original);
|
|
const run = (arguments_: readonly string[]) =>
|
|
cli.run({
|
|
arguments: arguments_,
|
|
cwd: home,
|
|
environment: environmentFor(home),
|
|
});
|
|
|
|
const preview = await run([...setupArguments, "--dry-run"]);
|
|
expect(preview.exitCode, preview.stdout).toBe(0);
|
|
expect(preview.json).toMatchObject({ status: "planned" });
|
|
expect(await readFile(config, "utf8")).toBe(original);
|
|
|
|
const applied = await run([...setupArguments, "--yes"]);
|
|
expect(applied.exitCode, applied.stdout).toBe(0);
|
|
expect(applied.json).toMatchObject({
|
|
status: "ready",
|
|
clients: { codex: { status: "configured" } },
|
|
});
|
|
expect(await readFile(`${config}.rea.backup`, "utf8")).toBe(original);
|
|
const configured = await readFile(config, "utf8");
|
|
expect(configured.startsWith(original)).toBe(true);
|
|
expect(configured).toContain("[mcp_servers.rea]");
|
|
|
|
const repeated = await run([...setupArguments, "--yes"]);
|
|
expect(repeated.exitCode, repeated.stdout).toBe(0);
|
|
expect(repeated.json).toMatchObject({
|
|
status: "ready",
|
|
appliedActions: [],
|
|
});
|
|
expect(await readFile(config, "utf8")).toBe(configured);
|
|
|
|
const removed = await run(["uninstall", "--json"]);
|
|
expect(removed.exitCode, removed.stdout).toBe(0);
|
|
expect(removed.json).toMatchObject({ status: "complete" });
|
|
expect(await readFile(config, "utf8")).toBe(original);
|
|
},
|
|
);
|
|
|
|
cliTest(
|
|
"codex setup keeps exact integers and a large REA timeout in an inline server table",
|
|
async ({ cli }) => {
|
|
const home = await createTestTempDirectory("rea-toml-int64-inline-");
|
|
const config = join(home, ".codex/config.toml");
|
|
const original =
|
|
"# retained comment\n" +
|
|
'mcp_servers = { other = { command = "other", budget = 9007199254740993 }, ' +
|
|
'rea = { command = "npx", args = ["-y", "rea-agents@6.1.0", "mcp"], tool_timeout_sec = 9223372036854775807 } }\n';
|
|
await mkdir(dirname(config), { recursive: true });
|
|
await writeFile(config, original);
|
|
const applied = await cli.run({
|
|
arguments: [...setupArguments, "--yes"],
|
|
cwd: home,
|
|
environment: environmentFor(home),
|
|
});
|
|
expect(applied.exitCode, applied.stdout).toBe(0);
|
|
const configured = await readFile(config, "utf8");
|
|
expect(configured.startsWith("# retained comment\n")).toBe(true);
|
|
expect(configured).toContain("budget = 9007199254740993");
|
|
expect(configured).toContain("tool_timeout_sec = 9223372036854775807");
|
|
expect(configured).not.toContain("rea-agents@6.1.0");
|
|
},
|
|
);
|
|
|
|
for (const value of ["9223372036854775808", "-9223372036854775809"])
|
|
cliTest(
|
|
`codex setup rejects ${value} outside Int64 before writing`,
|
|
async ({ cli }) => {
|
|
const home = await createTestTempDirectory("rea-toml-int64-range-");
|
|
const config = join(home, ".codex/config.toml");
|
|
const original = `[history]\nmax_bytes = ${value}\n`;
|
|
await mkdir(dirname(config), { recursive: true });
|
|
await writeFile(config, original);
|
|
const applied = await cli.run({
|
|
arguments: [...setupArguments, "--yes"],
|
|
cwd: home,
|
|
environment: environmentFor(home),
|
|
});
|
|
expect(applied.exitCode, applied.stdout).toBe(1);
|
|
expect(applied.json).toMatchObject({ status: "needs_human" });
|
|
expect(applied.stdout).toContain("outside the signed 64-bit range");
|
|
expect(await readFile(config, "utf8")).toBe(original);
|
|
},
|
|
);
|