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>
66 lines
2.3 KiB
TypeScript
66 lines
2.3 KiB
TypeScript
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { expect, it } from "vitest";
|
|
import { createCli } from "../../../src/cli.js";
|
|
import { parseConfig } from "../../../src/config/parseConfig.js";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
|
|
it("validates selected and existing JEB endpoints without losing caller selection", async () => {
|
|
const home = await createTestTempDirectory("rea-setup-jeb-selection-");
|
|
const path = join(home, ".cursor/mcp.json");
|
|
await mkdir(join(home, ".cursor"));
|
|
const oldEndpoint = "http://127.0.0.1:8425/mcp";
|
|
const invalidEndpoint = "https://example.com/mcp";
|
|
const selectedEndpoint = "http://127.0.0.1:8426/mcp/";
|
|
const registration = (endpoint: string) =>
|
|
JSON.stringify({
|
|
mcpServers: {
|
|
rea: {
|
|
command: "rea",
|
|
args: ["mcp"],
|
|
env: { REA_JEB_MCP_URL: endpoint },
|
|
},
|
|
},
|
|
});
|
|
const original = registration(oldEndpoint);
|
|
await writeFile(path, original);
|
|
const env: Record<string, string> = {
|
|
HOME: home,
|
|
USERPROFILE: home,
|
|
REA_JEB_MCP_URL: invalidEndpoint,
|
|
HOPPER_LAUNCHER_PATH: join(home, "missing"),
|
|
};
|
|
const setup = async () => {
|
|
let stdout = "";
|
|
await createCli(env).serve(
|
|
["setup", "--client", "cursor", "--skill=false", "--yes", "--json"],
|
|
{
|
|
env,
|
|
stdout: (chunk) => {
|
|
stdout += chunk;
|
|
},
|
|
exit: () => undefined,
|
|
},
|
|
);
|
|
return JSON.parse(stdout) as { status: string; remediation?: string };
|
|
};
|
|
|
|
const refused = await setup();
|
|
expect(refused.status).toBe("needs_human");
|
|
expect(refused.remediation).toContain("REA_JEB_MCP_URL");
|
|
expect(await readFile(path, "utf8")).toBe(original);
|
|
expect(parseConfig(env).ok).toBe(true);
|
|
|
|
delete env.REA_JEB_MCP_URL;
|
|
const invalidExisting = registration(invalidEndpoint);
|
|
await writeFile(path, invalidExisting);
|
|
expect((await setup()).status).toBe("needs_human");
|
|
expect(await readFile(path, "utf8")).toBe(invalidExisting);
|
|
|
|
env.REA_JEB_MCP_URL = selectedEndpoint;
|
|
const repaired = await setup();
|
|
expect(repaired.status, JSON.stringify(repaired)).toBe("ready");
|
|
const saved = JSON.parse(await readFile(path, "utf8"));
|
|
expect(saved.mcpServers.rea.env.REA_JEB_MCP_URL).toBe(selectedEndpoint);
|
|
});
|