refactor(process): route remaining captured output and cancellations through their owners (#11787)

Migrate the remaining 2 direct AnalysisCancelledError constructions onto cancelledBy and the remaining 14 process-snapshot stdout/stderr copy sites onto capturedProviderOutput, burning down both architecture-guard baselines to zero.
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 20:39:33 -05:00
1 parent 1e9df09f68
commit 62f5946ba1
17 files changed
+94 -123

No files matched your search

+6 -6
View File
@@ -267,8 +267,8 @@ export const runWakaruCommand = async (context: WakaruCommandContext) => {
if (failure === undefined || failure instanceof AnalysisError)
failure = analysisErrorWithCancellation(failure, cancelled);
}
if (failure instanceof AnalysisError)
failure.retainCapturedOutput(capturedProviderOutput(snapshot));
const captured = capturedProviderOutput(snapshot);
if (failure instanceof AnalysisError) failure.retainCapturedOutput(captured);
if (stopped.status === "incomplete")
throw new WakaruCleanupFailure(
supervisor,
@@ -280,10 +280,10 @@ export const runWakaruCommand = async (context: WakaruCommandContext) => {
);
if (failure !== undefined) throw failure;
return {
exit_code: snapshot.exitCode ?? null,
signal: snapshot.signal ?? null,
stdout: snapshot.stdout.text,
stderr: snapshot.stderr.text,
exit_code: captured.exit_code ?? null,
signal: captured.signal ?? null,
stdout: captured.stdout,
stderr: captured.stderr,
command: context.command,
arguments: [...context.arguments],
resource_limiter: context.limiter,
@@ -49,6 +49,7 @@ import {
type SpawnedOwnedProviderProcess,
} from "../../process/ProviderProcess.js";
import { prepareProcessOwnershipInspection } from "../../process/ProcessOwnershipObservation.js";
import { capturedProviderOutput } from "../../process/capturedProviderOutput.js";
import { errorMessage } from "../../kernel/errorMessage.js";
const OPERATION = "trace_web_source_location";
@@ -544,15 +545,14 @@ class OwnedCodec implements SourceMapCleanupOwner {
outputComplete: boolean,
) {
if (snapshot === undefined) return undefined;
const captured = capturedProviderOutput(
exit === undefined
? snapshot
: { ...snapshot, exitCode: exit.code, signal: exit.signal },
);
return {
stdout: snapshot.stdout.text,
stderr: snapshot.stderr.text,
truncated: snapshot.diagnosticTruncated === true || !outputComplete,
stdout_bytes: snapshot.stdout.observedBytes,
stderr_bytes: snapshot.stderr.observedBytes,
...(exit === undefined
? {}
: { exit_code: exit.code, signal: exit.signal }),
...captured,
truncated: captured.truncated || !outputComplete,
};
}