fix(managed): keep delivery detail out of retained Evidence identity

Summary, omitted and complete delivery of the same managed inspection
now retain one parent record, as inspect_macho already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822 2026-10-14 01:41:55 +00:00
parent 1f4ee2dcda
commit 935b62249b
3 changed files with 9 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import { err } from "../domain/result.js";
import { registerEvidenceTools } from "./registerEvidenceTools.js";
import {
retainedSummaryDelivery,
withoutDeliveryDetail,
type EvidenceToolFamilyOptions,
} from "./retainedSummaryDelivery.js";
import { runManagedProviderExecution } from "../composition/directAnalysis.js";
@ -23,13 +24,13 @@ export const registerManagedTools = (
options: EvidenceToolFamilyOptions,
): void => {
let selectedManagedPath: string | undefined;
const withoutDelivery = withoutDeliveryDetail(SUMMARY_DELIVERY);
const analysisForAdmission = (
analysis: AnalysisOperationPort,
): AnalysisOperationPort => ({
execute: async (operation, parameters, executionOptions) => {
if (!isManagedToolName(operation))
return analysis.execute(operation, parameters, executionOptions);
const { detail: _detail, ...providerParameters } = parameters;
const requestedPath = parameters.path;
const activeTarget = options.activeTarget?.();
const path =
@ -54,7 +55,7 @@ export const registerManagedTools = (
path,
operation,
executionOptions?.signal,
providerParameters,
parameters,
);
if (execution.ok && typeof requestedPath === "string")
selectedManagedPath = requestedPath;
@ -64,6 +65,8 @@ export const registerManagedTools = (
registerEvidenceTools(server, MANAGED_TOOL_CONTRACTS, {
...options,
...retainedSummaryDelivery(SUMMARY_DELIVERY, options),
parametersForExecution: withoutDelivery,
parametersForEvidence: withoutDelivery,
analysisForAdmission,
});
};

View File

@ -76,7 +76,7 @@ it("returns a first-call overview and pages the unchanged source after its file
parent.normalized_result,
);
expect(parent.operation).toBe("inspect_managed_artifact");
expect(parent.parameters).toEqual({ path, detail: "summary" });
expect(parent.parameters).toEqual({ path });
expect(receipt.evidence_id).not.toBe(parent.evidence_id);
expect(receipt.evidence_links).toEqual([parent.evidence_id]);
const { references, resources, attributes, ...identity } = report;
@ -97,7 +97,7 @@ it("returns a first-call overview and pages the unchanged source after its file
).structuredContent,
);
expect(complete.operation).toBe("inspect_managed_artifact");
expect(complete.normalized_result).toEqual(parent.normalized_result);
expect(complete.evidence_id).toBe(parent.evidence_id);
}
const reused = await client.callTool({
name: "inspect_managed_native_boundaries",

View File

@ -111,6 +111,7 @@ it("summarizes selected members and pages every original collection after the fi
if (parent === undefined)
throw new Error("Complete member source was not retained");
expect(parent.operation).toBe("inspect_managed_members");
expect(parent.parameters).toEqual({ path, type_names });
expect(receipt.evidence_links).toEqual([parent.evidence_id]);
const report = managedMemberInspectionSchema.parse(parent.normalized_result);
expect(view.summary.selection).toEqual({
@ -130,7 +131,7 @@ it("summarizes selected members and pages every original collection after the fi
).structuredContent,
);
expect(complete.operation).toBe("inspect_managed_members");
expect(complete.normalized_result).toEqual(parent.normalized_result);
expect(complete.evidence_id).toBe(parent.evidence_id);
}
const original = JSON.stringify(parent);
await unlink(path);