Complete Housekeeping migration and /ase cutover #52

Merged
Simo merged 74 commits from codex/housekeeping-complete into main 2026-08-30 21:27:33 +02:00
2 changed files with 20 additions and 4 deletions
Showing only changes of commit b5957015e7 - Show all commits

No files matched your search

@@ -129,4 +129,16 @@ describe("audit command envelope", () => {
auditOutcomeError: auditFailure,
});
});
it("preserves a frozen operation error when failure evidence rejects", async () => {
const original = Object.freeze(new Error("operation failed"));
const writer: HousekeepingAuditWriter = {
write: vi
.fn()
.mockResolvedValueOnce(undefined)
.mockRejectedValueOnce(new Error("audit failure")),
};
await expect(
runWithAuditIntent(writer, auditEntry, () => Promise.reject(original)),
).rejects.toBe(original);
});
});
@@ -50,10 +50,14 @@ export async function runWithAuditIntent<T>(
await writeOutcome(writer, entry, "failure", transaction);
} catch (auditOutcomeError) {
if (error instanceof Error) {
Object.defineProperty(error, "auditOutcomeError", {
value: auditOutcomeError,
configurable: true,
});
try {
Object.defineProperty(error, "auditOutcomeError", {
value: auditOutcomeError,
configurable: true,
});
} catch {
// Frozen or non-extensible errors still preserve their original identity.
}
}
}
throw error;