Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

test(evidence): assert the exact cancellation reason after staging cleanup fails (#5601)

Kaoru082285b379c4caea
diff --git a/tests/boundary/filesystem/jsonOutputOwnership.test.ts b/tests/boundary/filesystem/jsonOutputOwnership.test.ts
index 18928cf71..9f25d9ef3 100644
--- a/tests/boundary/filesystem/jsonOutputOwnership.test.ts
+++ b/tests/boundary/filesystem/jsonOutputOwnership.test.ts
@@ -208,10 +208,13 @@ it("preserves cancellation when staging cleanup also fails", async () => {
if (result.ok) throw new Error("Expected cancellation");
expect(result.error).toBeInstanceOf(AnalysisCancelledError);
expect(result.error.cleanupIncomplete).toBe(true);
- expect(result.error.cause).toMatchObject({
- cause: expect.any(AnalysisCancelledError),
- owner: { directory: expect.stringContaining(".rea-write-") },
- });
+ // The caller's exact abort reason stays the cause; the retained staging
+ // directory is reported as cleanup state, not as the cancellation cause.
+ expect(result.error.cause).toBe(controller.signal.reason);
+ expect(result.error.cleanupPrimary).toBeInstanceOf(AnalysisCancelledError);
+ expect(result.error.cleanupResources).toEqual([
+ expect.stringContaining(".rea-write-"),
+ ]);
await expect(fs.access(join(root, "cancelled.json"))).rejects.toThrow();
const stage = requireStages(root)[0];
if (stage !== undefined) await fs.rm(join(root, stage, "unexpected"));