fix(filesystem): preserve failure provenance across cleanup owners

Carry descriptor outcomes, cancellation, retention and physical origin as named facts so wrappers cannot drop ownership context. Replace raw primary failure unwrapping with provenance facts across artifact consumers, and use Result for Kuna span reads including undefined rejections.

Exercise actual descriptors, rollback, cancellation and cleanup retry; update brittle snapshot and completion fixtures to use their producing boundaries.
This commit is contained in:
morluto committed 2026-10-24 07:43:49 +08:00
1 parent a062529bb2
commit 4610843efd
41 files changed
+1172 -412

No files matched your search

+10 -15
View File
@@ -291,13 +291,13 @@ const openSnapshotSource = async (
return await openRegularFile(path, { symlinks: "follow", signal });
} catch (cause: unknown) {
if (!(cause instanceof RegularFileAdmissionFailure)) throw cause;
throw new RegularFileCleanupFailure(
throw new RegularFileCleanupFailure({
path,
cause.owner,
{ kind: "failed", cause: cause.cause },
cause.cleanupCause,
retainAdmissionOwner(retention.retainFailedClose, cause.owner),
);
owner: cause.owner,
outcome: { kind: "failed", cause: cause.cause },
cleanupCause: cause.cleanupCause,
retention: retainAdmissionOwner(retention.retainFailedClose, cause.owner),
});
}
};
@@ -328,15 +328,10 @@ const projectSnapshotFailure = (
return cause;
const projected = projectSnapshotFailure(cause.outcome.cause, projectChanged);
if (projected === cause.outcome.cause) return cause;
return new RegularFileCleanupFailure(
cause.path,
cause.owner,
{ kind: "failed", cause: projected },
cause.cleanupCause,
cause.retention,
cause.completionCancellation,
cause.operationFailure,
);
return new RegularFileCleanupFailure({
...cause,
outcome: { kind: "failed", cause: projected },
});
};
const verifySourceState = async (