fix(ci): repair boundary regressions and evidence assertions
Detach cancelled CDP sessions within the cleanup budget and retain event-finalization failures across retries. Honor Git filesystem encodings and exclude the promise-API probe from source-read failures. Align existing integration regressions with retained process resources, filesystem-order-independent truncation, owned skill files, explicit native access facts and streamed JSON errors. Validation: 132 acceptance tests passed (2 skipped), 83 affected boundary tests passed, Git/JSON/CLI boundary regressions passed, check:ci, docs:check and test discovery passed. Local verification used Node 24.18.0 on macOS; cross-platform CI remains pending.
This commit is contained in:
@@ -17,6 +17,7 @@ import { parse as parseJsonc, type ParseError } from "jsonc-parser";
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
import { clearClientLocationEnvironment } from "../../fixtures/clientEnvironment.js";
|
||||
import { supportedClients } from "../../../src/application/SupportedClients.js";
|
||||
import { PRODUCT_IDENTITY } from "../../../src/identity.js";
|
||||
|
||||
import { readClientRegistrationStatuses } from "../../../src/application/ClientRegistrationStatus.js";
|
||||
import { configureClientConfiguration } from "../../../src/application/SetupClientConfiguration.js";
|
||||
@@ -31,6 +32,7 @@ import {
|
||||
} from "../../../src/application/Uninstall.js";
|
||||
|
||||
const roots: string[] = [];
|
||||
const ownedSkillManifest = `---\nname: ${PRODUCT_IDENTITY.skillName}\n---\n# REA\n`;
|
||||
beforeEach(clearClientLocationEnvironment);
|
||||
afterEach(async () => {
|
||||
vi.unstubAllEnvs();
|
||||
@@ -1353,7 +1355,7 @@ describe("client configuration filesystem removal", () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
await writeFile(skill, "managed");
|
||||
await writeFile(skill, ownedSkillManifest);
|
||||
await mkdir(join(home, ".rea"), { recursive: true });
|
||||
await import("node:fs/promises").then(({ symlink }) =>
|
||||
symlink(home, join(home, ".rea/cache")),
|
||||
@@ -1422,7 +1424,9 @@ describe("client configuration filesystem removal", () => {
|
||||
readFile(`${configPath}.rea.backup`, "utf8"),
|
||||
).rejects.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("uninstall configuration preflight", () => {
|
||||
it("fails closed on malformed client configuration", async () => {
|
||||
const home = await createTestTempDirectory("rea-uninstall-bad-");
|
||||
roots.push(home);
|
||||
@@ -1447,8 +1451,12 @@ describe("client configuration filesystem removal", () => {
|
||||
roots.push(home);
|
||||
const codex = join(home, ".codex/config.toml");
|
||||
const cursor = join(home, ".cursor/mcp.json");
|
||||
const skillMarker = join(
|
||||
home,
|
||||
".agents/skills/reverse-engineer-anything/marker.txt",
|
||||
);
|
||||
const managed = [
|
||||
join(home, ".agents/skills/reverse-engineer-anything/marker.txt"),
|
||||
skillMarker,
|
||||
join(home, ".rea/cache/marker.txt"),
|
||||
join(home, ".rea/state/marker.txt"),
|
||||
];
|
||||
@@ -1463,6 +1471,8 @@ describe("client configuration filesystem removal", () => {
|
||||
await writeFile(codex, "[mcp_servers.rea]\ncommand = [broken\n");
|
||||
await writeFile(cursor, cursorConfig);
|
||||
for (const path of managed) await writeFile(path, "marker");
|
||||
const manifest = join(dirname(skillMarker), "SKILL.md");
|
||||
await writeFile(manifest, ownedSkillManifest);
|
||||
|
||||
const stopped = await runUninstall(true, systemUninstallHost(home));
|
||||
|
||||
@@ -1478,6 +1488,7 @@ describe("client configuration filesystem removal", () => {
|
||||
expect(await readFile(cursor, "utf8")).toBe(cursorConfig);
|
||||
for (const path of managed)
|
||||
expect(await readFile(path, "utf8")).toBe("marker");
|
||||
expect(await readFile(manifest, "utf8")).toBe(ownedSkillManifest);
|
||||
|
||||
await writeFile(codex, "");
|
||||
const repaired = await runUninstall(true, systemUninstallHost(home));
|
||||
@@ -1485,7 +1496,12 @@ describe("client configuration filesystem removal", () => {
|
||||
expect(JSON.parse(await readFile(cursor, "utf8"))).toEqual({
|
||||
mcpServers: { other: { command: "echo", args: ["hello"] } },
|
||||
});
|
||||
for (const path of managed)
|
||||
// Uninstall removes only the managed bundle, never arbitrary skill files.
|
||||
expect(await readFile(skillMarker, "utf8")).toBe("marker");
|
||||
await expect(readFile(manifest, "utf8")).rejects.toMatchObject({
|
||||
code: "ENOENT",
|
||||
});
|
||||
for (const path of managed.slice(1))
|
||||
await expect(readFile(path, "utf8")).rejects.toThrow();
|
||||
});
|
||||
});
|
||||
@@ -1625,6 +1641,7 @@ describe("client configuration filesystem failure reporting", () => {
|
||||
roots.push(home);
|
||||
const skillRoot = join(home, ".agents/skills/reverse-engineer-anything");
|
||||
await mkdir(skillRoot, { recursive: true });
|
||||
await writeFile(join(skillRoot, "SKILL.md"), ownedSkillManifest);
|
||||
const result = await runUninstall(
|
||||
false,
|
||||
systemUninstallHost(home, {
|
||||
@@ -1637,11 +1654,14 @@ describe("client configuration filesystem failure reporting", () => {
|
||||
name: "skill",
|
||||
status: "failed",
|
||||
detail: expect.stringContaining(
|
||||
"This item could not be removed. Check file permissions, then rerun uninstall.",
|
||||
`Managed file could not be removed: ${join(skillRoot, "SKILL.md")}`,
|
||||
),
|
||||
}),
|
||||
);
|
||||
expect(JSON.stringify(result)).not.toContain("SECRET");
|
||||
expect(await readFile(join(skillRoot, "SKILL.md"), "utf8")).toBe(
|
||||
ownedSkillManifest,
|
||||
);
|
||||
});
|
||||
|
||||
it("uninstalls all managed skill roots, including a custom Claude Code directory", async () => {
|
||||
@@ -1653,7 +1673,11 @@ describe("client configuration filesystem failure reporting", () => {
|
||||
join(customClaudeDirectory, "skills/reverse-engineer-anything"),
|
||||
];
|
||||
await Promise.all(
|
||||
rootsToRemove.map((path) => mkdir(path, { recursive: true })),
|
||||
rootsToRemove.map(async (path) => {
|
||||
await mkdir(path, { recursive: true });
|
||||
await writeFile(join(path, "SKILL.md"), ownedSkillManifest);
|
||||
await writeFile(join(path, "user-notes.txt"), "user-authored");
|
||||
}),
|
||||
);
|
||||
|
||||
const result = await systemUninstallHost(home, testFileSystem, {
|
||||
@@ -1663,7 +1687,12 @@ describe("client configuration filesystem failure reporting", () => {
|
||||
expect(result).toMatchObject({ status: "removed" });
|
||||
await Promise.all(
|
||||
rootsToRemove.map(async (path) => {
|
||||
await expect(lstat(path)).rejects.toMatchObject({ code: "ENOENT" });
|
||||
await expect(
|
||||
readFile(join(path, "SKILL.md"), "utf8"),
|
||||
).rejects.toMatchObject({ code: "ENOENT" });
|
||||
expect(await readFile(join(path, "user-notes.txt"), "utf8")).toBe(
|
||||
"user-authored",
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user