diff --git a/tests/composition/directAnalysisCleanup.test.ts b/tests/composition/directAnalysisCleanup.test.ts index f023e6832f..54f552016e 100644 --- a/tests/composition/directAnalysisCleanup.test.ts +++ b/tests/composition/directAnalysisCleanup.test.ts @@ -262,45 +262,6 @@ it.each([false, true])( }, ); -it("retains both execution and final-close resources in one-shot failures", async () => { - const [path] = await createBinarySessionTargets(); - const executionError = new AnalysisTimeoutError("read_bytes", 100, { - capturedOutput: { - stdout: "execution observation", - stderr: "", - truncated: false, - }, - cleanup: { - reason: "execution worker remains", - resources: ["execution-worker", "shared-owner"], - }, - }); - const closeError = new ProviderCleanupError( - "fixture", - ["session-owner", "shared-owner"], - { reason: "session remains" }, - ); - const { dependencies } = factories({ - executionError, - cleanupError: closeError, - }); - const result = analysisCliErrorEnvelopeSchema.parse( - await runDirectAnalysis(dependencies, path, "read_bytes", { - address: "0x1000", - length: 1, - }).then(projectCliAnalysisResult), - ); - expect(result).toMatchObject({ - code: "cleanup_incomplete", - details: { - resources: ["execution-worker", "shared-owner", "session-owner"], - execution_failure: "provider_timeout", - captured_output: executionError.capturedOutput, - cleanup_error: projectAnalysisError(closeError), - }, - }); -}); - it.each([false, true])( "binds the exact caller path to provider failure Evidence (session cleanup fails: %s)", async (closeFails) => { @@ -613,20 +574,25 @@ describe("snapshot publication finalization", () => { }); it.each([false, true])( - "retains original cleanup diagnostics when final close fails: %s", + "retains original cleanup diagnostics and distinct resources (final close fails: %s)", async (closeFails) => { const [path] = await createBinarySessionTargets(); const executionError = new AnalysisTimeoutError("read_bytes", 100, { cleanup: { reason: "snapshot removal failed during execution", - resources: ["primary-snapshot"], + resources: ["primary-snapshot", "shared-owner"], }, capturedOutput: primaryError.capturedOutput, }); + const closeError = new ProviderCleanupError( + "fixture", + ["fixture-provider-process", "shared-owner"], + { reason: "process exit could not be confirmed" }, + ); const primary = projectAnalysisError(executionError); const { dependencies } = factories({ executionError, - ...(closeFails ? { cleanupError } : {}), + ...(closeFails ? { cleanupError: closeError } : {}), }); const result = analysisCliErrorEnvelopeSchema.parse( await runDirectAnalysis(dependencies, path, "read_bytes", { @@ -639,8 +605,13 @@ it.each([false, true])( ...primary.details, ...(closeFails ? { - resources: ["primary-snapshot", "fixture-provider-process"], - cleanup_error: projectAnalysisError(cleanupError), + resources: [ + "primary-snapshot", + "shared-owner", + "fixture-provider-process", + ], + execution_failure: "provider_timeout", + cleanup_error: projectAnalysisError(closeError), } : {}), },