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 24 additions and 4 deletions
Showing only changes of commit 86a2d9d069 - Show all commits

No files matched your search

@@ -141,4 +141,24 @@ describe("audit command envelope", () => {
runWithAuditIntent(writer, auditEntry, () => Promise.reject(original)),
).rejects.toBe(original);
});
it("preserves a pathological rejection when failure evidence rejects", async () => {
const { proxy, revoke } = Proxy.revocable(
new Error("operation failed"),
{},
);
revoke();
const writer: HousekeepingAuditWriter = {
write: vi
.fn()
.mockResolvedValueOnce(undefined)
.mockRejectedValueOnce(new Error("audit failure")),
};
let rejected: unknown;
try {
await runWithAuditIntent(writer, auditEntry, () => Promise.reject(proxy));
} catch (error) {
rejected = error;
}
expect(rejected === proxy).toBe(true);
});
});
@@ -49,15 +49,15 @@ export async function runWithAuditIntent<T>(
try {
await writeOutcome(writer, entry, "failure", transaction);
} catch (auditOutcomeError) {
if (error instanceof Error) {
try {
try {
if (error instanceof Error) {
Object.defineProperty(error, "auditOutcomeError", {
value: auditOutcomeError,
configurable: true,
});
} catch {
// Frozen or non-extensible errors still preserve their original identity.
}
} catch {
// Enrichment is best-effort; always preserve the original rejection.
}
}
throw error;