Merge remote-tracking branch 'origin/main' into codex/audit-continuation-20261020-refresh20

This commit is contained in:
morluto
2026-10-21 01:02:22 +08:00
@@ -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"));