refactor(process): build provider captured output through one owner (#11330)

* refactor(process): build provider captured output through one owner

* fix(process): report only declared diagnostics on successful provider results
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 03:46:35 +08:00
1 parent 264dcd5fee
commit 0d35ea065d
25 files changed
+198 -147

No files matched your search

+3 -13
View File
@@ -1,3 +1,4 @@
import { capturedProviderOutput } from "../../process/capturedProviderOutput.js";
import { selectArtifactCommandPath } from "../../process/ArtifactCommandPath.js";
import { randomUUID } from "node:crypto";
import { constants } from "node:fs";
@@ -40,17 +41,6 @@ const OPERATION = "recover_javascript_sources";
const WAKARU_REQUIREMENT =
"Provide an absolute REA_WAKARU_COMMAND pointing to a Wakaru ^1.13.0 Linux x64 binary (verified with 1.14.0); no tool is installed by REA. See docs/guides/javascript/javascript-recovery.md#install-wakaru.";
const commandCapturedOutput = (
snapshot: ReturnType<ProviderProcessSupervisor["snapshot"]>,
) => ({
stdout: snapshot.stdout.text,
stderr: snapshot.stderr.text,
exit_code: snapshot.exitCode ?? null,
signal: snapshot.signal ?? null,
truncated:
snapshot.diagnosticTruncated === true || snapshot.outputIncomplete === true,
});
/** Wakaru recovery runs only on Linux x64; discovery and execution share this check. */
export const wakaruHostSupported = (
platform: NodeJS.Platform,
@@ -88,7 +78,7 @@ export class WakaruCleanupFailure extends ProviderCleanupError {
...(previousError instanceof AnalysisError
? { cleanupPrimary: previousError }
: {}),
capturedOutput: commandCapturedOutput(snapshot),
capturedOutput: capturedProviderOutput(snapshot),
},
);
}
@@ -273,7 +263,7 @@ export const runWakaruCommand = async (context: WakaruCommandContext) => {
failure = analysisErrorWithCancellation(failure, cancelled);
}
if (failure instanceof AnalysisError)
failure.retainCapturedOutput(commandCapturedOutput(snapshot));
failure.retainCapturedOutput(capturedProviderOutput(snapshot));
if (stopped.status === "incomplete")
throw new WakaruCleanupFailure(
supervisor,