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.
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { ProviderAdapterError } from "./providerAdapterError.js";
|
|
import { projectAnalysisError } from "./analysisErrorProjection.js";
|
|
import type { AnalysisError } from "./analysisErrorBase.js";
|
|
|
|
/** Preserve the original lifecycle failure alongside incomplete cleanup. */
|
|
export const analysisErrorWithCleanupFailure = (
|
|
primary: AnalysisError,
|
|
cleanup: AnalysisError,
|
|
operation = "close_binary",
|
|
): AnalysisError => {
|
|
const projected = projectAnalysisError(cleanup);
|
|
return new ProviderAdapterError(
|
|
cleanup instanceof ProviderAdapterError ? cleanup.providerId : "rea",
|
|
operation,
|
|
{
|
|
cause: new AggregateError(
|
|
[primary, cleanup],
|
|
"Analysis failed and cleanup remains incomplete.",
|
|
{ cause: primary },
|
|
),
|
|
userMessage: projectAnalysisError(primary).message,
|
|
...(primary.capturedOutput === undefined
|
|
? {}
|
|
: { capturedOutput: primary.capturedOutput }),
|
|
...(primary.partialObservation === undefined
|
|
? {}
|
|
: { partialObservation: primary.partialObservation }),
|
|
cleanup: {
|
|
reason: projected.message,
|
|
resources: [
|
|
...new Set([
|
|
...primary.cleanupResources,
|
|
...cleanup.cleanupResources,
|
|
]),
|
|
],
|
|
},
|
|
diagnostics: {
|
|
primary_error: projectAnalysisError(primary),
|
|
cleanup_error: projected,
|
|
},
|
|
},
|
|
);
|
|
};
|