fix(evidence): retain completed observations on late cancellation

Validate completed reports before cancellation projection, retain valid
Evidence and captured command diagnostics, and convert raw cleanup partials
at their application owner. Record partial Evidence consistently across MCP
handlers. Keep page inspection separate from unfinished bundle analysis.

Refs #4261
This commit is contained in:
morluto committed 2026-10-16 06:46:25 +08:00
1 parent 131fd5ddcd
commit 3b698645a0
39 files changed
+1897 -418

No files matched your search

@@ -14,6 +14,7 @@ import {
} from "../../domain/native/binaryLayout.js";
import { analysisInputErrorFromIssues } from "../../domain/inputIssueProjection.js";
import { err, ok, type Result } from "../../domain/result.js";
import { completeProviderEvidence } from "../ProviderOperationExecution.js";
const OPERATION = "inspect_binary_layout";
@@ -79,8 +80,6 @@ export class BinaryLayoutService {
const outputOptions = diagnostics.success
? { capturedOutput: diagnostics.data }
: undefined;
if (options?.signal?.aborted)
return err(new AnalysisCancelledError(OPERATION, outputOptions));
const report = binaryLayoutSchema.safeParse(inspected.value);
if (!report.success || report.data.artifact.path !== input.data.path)
return err(
@@ -91,26 +90,31 @@ export class BinaryLayoutService {
),
);
const value = report.data;
return ok(
createEvidence(
{
path: value.artifact.path,
format: "elf",
architecture: "x86_64",
sha256: value.artifact.sha256,
},
this.provider.identity,
{
operation: OPERATION,
parameters: input.data,
result: value,
// The decoded report is the only representation; do not repeat it.
rawResult: null,
confidence: "observed",
limitations: value.limitations,
locations: [{ kind: "artifact-path", path: value.artifact.path }],
},
return completeProviderEvidence(
ok(
createEvidence(
{
path: value.artifact.path,
format: "elf",
architecture: "x86_64",
sha256: value.artifact.sha256,
},
this.provider.identity,
{
operation: OPERATION,
parameters: input.data,
result: value,
// The decoded report is the only representation; do not repeat it.
rawResult: null,
confidence: "observed",
limitations: value.limitations,
locations: [{ kind: "artifact-path", path: value.artifact.path }],
},
),
),
OPERATION,
options,
outputOptions,
);
}
}