From 3ba20f0eb8387c2eede14249a32c86ba15fef294 Mon Sep 17 00:00:00 2001 From: gensokyo-dev Date: Sat, 21 Nov 2026 18:13:28 +0000 Subject: [PATCH] refactor(hopper): compose bridge image cleanup through the shared owner The image and publisher cleanup retry built its composite and bound the parts by hand; providerCleanupErrorFromFailures builds the same composite. It names close_binary, the ProviderCleanupError default that the parts and the previous composite used. Refs #11859 Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --- .../baselines/cleanup-dependency-binding.json | 2 +- src/hopper/BridgeLauncher.ts | 28 ++++++++----------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/scripts/verify/baselines/cleanup-dependency-binding.json b/scripts/verify/baselines/cleanup-dependency-binding.json index 4c2089e38d..f72bee6a5d 100644 --- a/scripts/verify/baselines/cleanup-dependency-binding.json +++ b/scripts/verify/baselines/cleanup-dependency-binding.json @@ -11,7 +11,7 @@ "src/domain/explicitSensitiveFailure.ts": 1, "src/evm/EvmoleInterfaceProvider.ts": 3, "src/gdb/GdbSessionManager.ts": 2, - "src/hopper/BridgeLauncher.ts": 3, + "src/hopper/BridgeLauncher.ts": 2, "src/hopper/HopperAnalysisProfile.ts": 1, "src/hopper/HopperImageCopy.ts": 1, "src/ida/IdaSessionClient.ts": 1, diff --git a/src/hopper/BridgeLauncher.ts b/src/hopper/BridgeLauncher.ts index c4314e30de..f257565f85 100644 --- a/src/hopper/BridgeLauncher.ts +++ b/src/hopper/BridgeLauncher.ts @@ -12,6 +12,7 @@ import { } from "./HopperErrors.js"; import { err, ok, type Result } from "../domain/result.js"; import { ProviderCleanupError } from "../domain/providerCleanupError.js"; +import { providerCleanupErrorFromFailures } from "../domain/analysisErrorCleanup.js"; import { ArtifactReaderFailure, artifactPrimaryCleanupLeases, @@ -266,23 +267,18 @@ export class HopperApplicationLauncher implements BridgeLauncher { } if (failures.length === 0) return ok(null); if (failures.length === 1) return err(failures[0]!); - const resources = [ - ...new Set(failures.flatMap((failure) => failure.cleanupResources)), - ]; - const failure = new ProviderCleanupError( - "hopper", - resources, - { - reason: failures.map((failure) => failure.message).join("; "), - }, - { - cause: new AggregateError( - failures, - "Hopper image and publisher cleanup remain incomplete", - ), - }, + // Match the parts, which use ProviderCleanupError's default operation. + return err( + providerCleanupErrorFromFailures( + "hopper", + failures, + failures.map((failure) => failure.message).join("; "), + { + operation: "close_binary", + message: "Hopper image and publisher cleanup remain incomplete", + }, + ), ); - return err(failure.bindCleanupDependencies(failures)); } async launch(