From c043e4e3a87816e29f30e2deb8148a9a1f441e63 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sun, 15 Nov 2026 20:18:21 +0800 Subject: [PATCH] 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. --- scripts/verify/architecture-guard-baselines.json | 3 +-- src/firmware/FirmwareProvider.ts | 10 +++++----- src/firmware/FirmwarePublication.ts | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/verify/architecture-guard-baselines.json b/scripts/verify/architecture-guard-baselines.json index ec84a9c555..2e4f7b144f 100644 --- a/scripts/verify/architecture-guard-baselines.json +++ b/scripts/verify/architecture-guard-baselines.json @@ -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, diff --git a/src/firmware/FirmwareProvider.ts b/src/firmware/FirmwareProvider.ts index e9c61b34dc..7f5319e0b0 100644 --- a/src/firmware/FirmwareProvider.ts +++ b/src/firmware/FirmwareProvider.ts @@ -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; diff --git a/src/firmware/FirmwarePublication.ts b/src/firmware/FirmwarePublication.ts index ab07fd0f27..d3d87ff2b9 100644 --- a/src/firmware/FirmwarePublication.ts +++ b/src/firmware/FirmwarePublication.ts @@ -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;