refactor(firmware): compose workspace and publication cleanup failures through the shared owner (#11094)

Three firmware sites built analysisErrorWithCleanupFailure(...).bindCleanupDependencies(...) by hand. They now use analysisErrorWithCleanupDependencies, which completes once the primary's and the cleanup's records both release. The phase-interruption site binds only the cleanup today; its primary is a fresh cancellation or timeout without cleanup, so the shared owner's binding is equivalent. The cleanup-dependency-binding baseline shrinks by 3.
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 20:18:21 +08:00
1 parent 4c375b82c8
commit c043e4e3a8
3 files changed
+9 -10

No files matched your search

@@ -216,8 +216,7 @@
"src/electron/ElectronFuseFailures.ts": 1,
"src/evm/EvmoleInterfaceProvider.ts": 6,
"src/firmware/FirmwareFailures.ts": 1,
"src/firmware/FirmwareProvider.ts": 3,
"src/firmware/FirmwarePublication.ts": 1,
"src/firmware/FirmwareProvider.ts": 1,
"src/flutter/FlutterBuildProvider.ts": 2,
"src/frida/FridaInstrumentationManager.ts": 1,
"src/gdb/GdbSessionManager.ts": 2,
+5 -5
View File
@@ -16,7 +16,7 @@ import {
type FirmwarePartialObservation,
} from "../domain/firmware/firmwareAnalysis.js";
import { AnalysisError } from "../domain/analysisErrorBase.js";
import { analysisErrorWithCleanupFailure } from "../domain/analysisErrorCleanup.js";
import { analysisErrorWithCleanupDependencies } from "../domain/analysisErrorCleanup.js";
import {
AnalysisCancelledError,
AnalysisOutputError,
@@ -729,21 +729,21 @@ const finishFirmwareWorkspace = async (
completedFirmwareObservation(outcome.value),
);
return err(
analysisErrorWithCleanupFailure(
analysisErrorWithCleanupDependencies(
primary,
cleanup,
request.operation,
).bindCleanupDependencies([cleanup]),
),
);
}
return err(
outcome.ok
? cleanup
: analysisErrorWithCleanupFailure(
: analysisErrorWithCleanupDependencies(
outcome.error,
cleanup,
request.operation,
).bindCleanupDependencies([outcome.error, cleanup]),
),
);
}
return outcome;
+3 -3
View File
@@ -1,6 +1,6 @@
import { AnalysisCleanupLease } from "../artifacts/AnalysisCleanupLease.js";
import { AnalysisError } from "../domain/analysisErrorBase.js";
import { analysisErrorWithCleanupFailure } from "../domain/analysisErrorCleanup.js";
import { analysisErrorWithCleanupDependencies } from "../domain/analysisErrorCleanup.js";
import {
firmwareFailureDialect,
firmwarePhaseInterruption,
@@ -274,11 +274,11 @@ export const publishFirmwareExtraction = async (context: {
context.retainCleanup(tree, treeLease, cleanup);
if (publishedResult !== undefined)
primary.retainPartialObservation(publishedResult);
throw analysisErrorWithCleanupFailure(
throw analysisErrorWithCleanupDependencies(
primary,
cleanup,
"extract_firmware",
).bindCleanupDependencies([primary, cleanup]);
);
}
if (tree?.published === true && result !== undefined) return result;
throw primary;