fix(io): consolidate managed snapshots and retain cleanup ownership
Reuse managed snapshot admission and hashing in sequential path comparisons, retaining caller paths and completed inspection Evidence on later failure. Preserve exact failed-close owners alongside typed read and cancellation failures, and retry them through caller-owned resource scopes. Require canonical Hopper lease identities, remove signed offset coercion, and repair stale setup cleanup expectations that failed CI.
This commit is contained in:
@@ -207,18 +207,26 @@ export const parseBinaryTarget = async (
|
||||
if (cause instanceof AnalysisCancelledError) return err(cause);
|
||||
if (cause instanceof BinaryTargetError) return err(cause);
|
||||
if (!(cause instanceof Error)) throw cause;
|
||||
const code = filesystemErrorCode(cause);
|
||||
if (code === undefined) throw cause;
|
||||
return err(
|
||||
new BinaryTargetError(
|
||||
candidate,
|
||||
targetFailureReason(code, cause.message),
|
||||
{ cause },
|
||||
),
|
||||
);
|
||||
const failure = classifyBinaryTargetFilesystemFailure(candidate, cause);
|
||||
if (failure === undefined) throw cause;
|
||||
return err(failure);
|
||||
}
|
||||
};
|
||||
|
||||
/** Classify a filesystem failure while reading a previously selected target. */
|
||||
export const classifyBinaryTargetFilesystemFailure = (
|
||||
path: string,
|
||||
cause: unknown,
|
||||
): BinaryTargetError | undefined => {
|
||||
if (!(cause instanceof Error)) return undefined;
|
||||
const code = filesystemErrorCode(cause);
|
||||
return code === undefined
|
||||
? undefined
|
||||
: new BinaryTargetError(path, targetFailureReason(code, cause.message), {
|
||||
cause,
|
||||
});
|
||||
};
|
||||
|
||||
const filesystemErrorCode = (cause: Error): string | undefined => {
|
||||
const code: unknown = Reflect.get(cause, "code");
|
||||
return typeof code === "string" ? code : undefined;
|
||||
|
||||
Reference in New Issue
Block a user