fix(workflows): retain upstream symbol coverage caveats

Keep limitations from exactly the provider observations used by a composed
CLI/MCP call. Reuse the authenticated Ghidra PDB handshake owner, preserve
caller options and failure identity, and deduplicate caveats without extra
engine queries.

Verified on actual Windows with Ghidra 12.1.4 PUBLIC, JDK21.0.12.1 and
Node24.18.0, using the host where.exe and its matching Microsoft public PDB.
Public CLI and MCP composed Evidence retain the referenced GUID/age and
unknown PDB load state. Engine processes used two CPU affinity slots and
512MiB heaps; the CLI test needed a900s startup budget. The initial600s
startup timeout is retained as performance evidence. No paired speedup or
complete-symbol-coverage claim is made.

Refs #2259
This commit is contained in:
N0zoM1z0
2026-10-14 07:44:01 +08:00
parent 20e4f83097
commit 6078652c0a
7 changed files with 245 additions and 16 deletions
@@ -9,6 +9,7 @@ import {
AnalysisOutputError,
} from "../../../src/domain/analysisErrorCore.js";
import type { RelationshipCoverage } from "../../../src/domain/relationshipCoverage.js";
import { parseEvidence } from "../../../src/domain/evidence.js";
import { err, ok as resultOk } from "../../../src/domain/result.js";
import { closeEnhancedToolResources, connect } from "./enhancedToolsHarness.js";
@@ -125,9 +126,13 @@ describe("enhanced MCP tools", () => {
limitations: [caveat],
},
});
expect(JSON.stringify(graph.structuredContent)?.split(caveat)).toHaveLength(
2,
);
const evidence = parseEvidence(graph.structuredContent);
expect(
JSON.stringify(evidence.normalized_result).split(caveat),
).toHaveLength(2);
expect(
evidence.limitations.filter((limit) => limit === caveat),
).toHaveLength(1);
const trace = await client.callTool({
name: "trace_call_path",
@@ -0,0 +1,42 @@
import { afterEach, expect, it } from "vitest";
import { createAnalysisExecution } from "../../../src/application/AnalysisProvider.js";
import { ok } from "../../../src/domain/result.js";
import { parseEvidence } from "../../../src/domain/evidence.js";
import { connect, closeEnhancedToolResources } from "./enhancedToolsHarness.js";
afterEach(closeEnhancedToolResources);
it("retains provider coverage caveats in a composed MCP overview without repeated reads", async () => {
const calls: string[] = [];
const limitation = "Companion PDB symbol coverage is unverified.";
const client = await connect({
execute: async (operation) => {
calls.push(operation);
const value = operation === "current_document" ? "fixture" : [];
return ok(
createAnalysisExecution(
value,
{ id: "fixture", name: "Fixture", version: "1" },
{ limitations: [limitation] },
),
);
},
});
const response = await client.callTool({
name: "binary_overview",
arguments: {},
});
expect(response.isError).not.toBe(true);
const evidence = parseEvidence(response.structuredContent);
expect(evidence.limitations).toEqual([
"Artifact identity is unavailable for this observation.",
"Derived by an REA composed workflow.",
limitation,
]);
expect(evidence.normalized_result).toMatchObject({
document: "fixture",
procedure_count: 0,
string_count: 0,
});
expect(calls.length).toBe(new Set(calls).size);
});
@@ -0,0 +1,54 @@
import { expect, it } from "vitest";
import { parseConfig } from "../../src/config/parseConfig.js";
import { runDirectAnalysis } from "../../src/application/DirectAnalysis.js";
import { createAnalysisExecution } from "../../src/application/AnalysisProvider.js";
import { ok } from "../../src/domain/result.js";
import {
createBinarySessionTargets,
createTestBinarySession,
} from "../fixtures/binarySession.js";
it("retains provider coverage caveats in a composed CLI result and closes the session", async () => {
const [path] = await createBinarySessionTargets();
const limitation = "Companion PDB symbol coverage is unverified.";
let reads = 0;
let closed = 0;
const createSession = () =>
createTestBinarySession(() => ({
execute: async (operation) => {
reads++;
return ok(
createAnalysisExecution(
operation === "current_document" ? "fixture" : [],
{ id: "fixture", name: "Fixture", version: "1" },
{ limitations: [limitation] },
),
);
},
close: async () => {
closed++;
return ok(null);
},
}));
const output = await runDirectAnalysis(
{
readConfiguration: () => parseConfig({}),
createBinarySession: createSession,
createManagedBinarySession: createSession,
},
path,
"binary_overview",
{},
);
expect(output).toMatchObject({
limitations: ["Derived by an REA composed workflow.", limitation],
normalized_result: {
document: "fixture",
segment_count: 0,
procedure_count: 0,
string_count: 0,
},
});
expect(reads).toBe(5);
expect(closed).toBe(1);
});