mirror of
https://github.com/morluto/rea
synced 2026-10-28 15:07:26 -04:00
ae029fe2f8
Compute overview counts at the Ghidra inventory owner, preserve complete inventory access and coverage, and share CLI/MCP projection. Keep native aggregate Evidence separate from workflow snapshot identities. Fixes #4746 Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
import { expect, it } from "vitest";
|
|
import { EnhancedTools } from "./EnhancedTools.js";
|
|
import { createAnalysisExecution } from "./AnalysisProvider.js";
|
|
import {
|
|
AnalysisCancelledError,
|
|
AnalysisCapabilityUnavailableError,
|
|
AnalysisOutputError,
|
|
} from "../domain/analysisErrorCore.js";
|
|
import { err, ok } from "../domain/result.js";
|
|
|
|
it("uses the provider-owned overview without requesting complete inventories", async () => {
|
|
const calls: string[] = [];
|
|
const result = {
|
|
document: "selected",
|
|
procedure_count: 12,
|
|
string_count: 34,
|
|
};
|
|
const tools = new EnhancedTools({
|
|
execute: async (operation) => {
|
|
calls.push(operation);
|
|
return ok(
|
|
createAnalysisExecution(result, {
|
|
id: "fixture",
|
|
name: "Fixture",
|
|
version: "1",
|
|
}),
|
|
);
|
|
},
|
|
});
|
|
expect(await tools.execute("binary_overview", {})).toEqual(ok(result));
|
|
expect(calls).toEqual(["read_binary_inventory_summary"]);
|
|
});
|
|
|
|
it.each([
|
|
new AnalysisOutputError("binary_overview", "Malformed aggregate"),
|
|
new AnalysisCancelledError("binary_overview"),
|
|
new AnalysisCapabilityUnavailableError(
|
|
"fixture",
|
|
"binary_overview",
|
|
"Cleanup pending",
|
|
{
|
|
cleanup: {
|
|
reason: "Owned process is still closing",
|
|
resources: ["session"],
|
|
},
|
|
},
|
|
),
|
|
])(
|
|
"preserves an aggregate failure rather than silently repeating analysis: %s",
|
|
async (failure) => {
|
|
const calls: string[] = [];
|
|
const tools = new EnhancedTools({
|
|
execute: async (operation) => {
|
|
calls.push(operation);
|
|
return err(failure);
|
|
},
|
|
});
|
|
expect(await tools.execute("binary_overview", {})).toEqual(err(failure));
|
|
expect(calls).toEqual(["read_binary_inventory_summary"]);
|
|
},
|
|
);
|