refactor(wasm): report WABT failure output through the captured-output owner (#11443)

* refactor(wasm): report WABT failure output through the captured-output owner

* fix(wasm): spread WABT cleanup captured output into its JSON diagnostics
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 05:27:27 +08:00
1 parent c24f0085ae
commit 204bd2bb49
4 files changed
+17 -15

No files matched your search

@@ -12,6 +12,5 @@
"src/native/pwntools/PwntoolsDecoder.ts": 1,
"src/pcap/PcapCommand.ts": 1,
"src/signals/SigrokRecordingProvider.ts": 1,
"src/wasm/WabtArtifactProvider.ts": 2,
"src/wasm/WabtFailures.ts": 1
"src/wasm/WabtArtifactProvider.ts": 1
}
+10
View File
@@ -1031,6 +1031,16 @@ it("rejects configured WABT tools whose admitted releases disagree", async () =>
expect(projected.message).toContain(
"Configured WABT tools report different releases",
);
// The rejected banner keeps what the process wrote, not only its text.
expect(result.error.capturedOutput).toEqual({
stdout: "1.0.44\n",
stderr: "",
stdout_bytes: 7,
stderr_bytes: 0,
exit_code: 0,
signal: null,
truncated: false,
});
} finally {
await provider.close();
}
+1 -5
View File
@@ -410,11 +410,7 @@ export class WabtArtifactProvider implements WasmArtifactPort {
{
userMessage: reason,
diagnostics: versionProbe,
capturedOutput: {
stdout: version.stdout.text,
stderr: version.stderr.text,
truncated: version.diagnosticTruncated === true,
},
capturedOutput: capturedProviderOutput(version),
remediationAction: wabtConfigurationRecoveryAction(),
},
);
+5 -8
View File
@@ -6,6 +6,7 @@ import {
} from "../resources/index.js";
import { utf8HeadExcerpt } from "../domain/utf8HeadExcerpt.js";
import type { ProviderProcessSnapshot } from "../process/ProviderProcess.js";
import { capturedProviderOutput } from "../process/capturedProviderOutput.js";
import type { AnalysisCapturedOutput } from "../domain/analysisErrorBase.js";
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
import {
@@ -153,11 +154,7 @@ export const wabtFailureDialect = (
(kind: ProviderOutcome["kind"]) => (snapshot: ProviderProcessSnapshot) =>
kind === "output-limit"
? outputLimitExcerpt(snapshot)
: {
stdout: snapshot.stdout.text,
stderr: snapshot.stderr.text,
truncated: snapshot.diagnosticTruncated ?? false,
};
: capturedProviderOutput(snapshot);
return {
providerId: WABT_PROVIDER_IDENTITY.id,
operation: OPERATION,
@@ -270,9 +267,9 @@ export const wabtFailureDialect = (
...(outcome.output === undefined
? {}
: {
captured_output: capturedOutput(outcome.kind)(
outcome.output.snapshot,
),
captured_output: {
...capturedOutput(outcome.kind)(outcome.output.snapshot),
},
}),
},
{ operation: OPERATION, cause: command },