Files
reverse-engineering-anything/tests/boundary/mcp/enhancedTools.limitations.test.ts
T
1201c25542 fix(ci): align static checks and regression fixtures with current contracts (#7349)
* fix(ci): retire unused internal analysis declarations

* test: use an admitted app bundle for provider routing

(cherry picked from commit 00aa17f12a)

* test: keep bundle routing coverage outside oversized group

(cherry picked from commit 8658353b0d)

* fix(ci): align regression fixtures with current admission contracts

* test: bind extraction close fixtures to their ZIP digest

(cherry picked from commit 626d0250db)

* test(cli): match typed analysis outcomes in function detail fixture

* test(ghidra): preserve empty Java property separator framing

* test(electron): retain unknown IPC ownership for native module gaps

* fix(electron): share source-scoped call path identity

* test(captures): assert safe source identity on SAZ refusal

* test(apple): match root occurrence kind to inventory manifest

* fix(examples): align directory root occurrence identity

* test(electron): align equivalent fixture assertions with upstream

* test(process): assert retained capture root identity

* test(windows): declare the PE fixture optional header

* test(ci): refresh owned registration and verifier fixtures

* test(setup): use owned registrations for refresh fixtures

* test(process): control unavailable ownership in CLI cleanup fixture

* test(process): guard controlled compiler output arguments

* test(setup): align equivalent entrypoint guards with upstream

* test(process): release the cleanup target through an owned gate

* test(ci): align semantic identities and owned fixture facts

* test(pcap): retain the upstream DNS wire fixture branch

* test(pcap): use the canonical wire ownership fixture

* test(pcap): assert exact DNS wire query labels

* test(ci): preserve admission and ownership fixture prerequisites

* test(ci): align authenticated fixture and cleanup boundaries

* test(windows): align native artifact fixtures with upstream

* test(android): request complete evidence for inline MCP contracts

* test: avoid pinning diagnostic wording

* test: verify cleanup diagnostics at their source

* test: strengthen evidence and cleanup checks

* test: avoid pinning registration guidance

---------

Co-authored-by: Plastic-time <Plastic-time@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-10-27 21:24:30 +08:00

139 lines
4.5 KiB
TypeScript

import { afterEach, expect, it } from "vitest";
import { createAnalysisExecution } from "../../../src/application/AnalysisProvider.js";
import { err, ok } from "../../../src/domain/result.js";
import { AnalysisCapabilityUnavailableError } from "../../../src/domain/analysisErrorCore.js";
import { parseEvidence } from "../../../src/domain/evidence.js";
import { connect, closeEnhancedToolResources } from "./enhancedToolsHarness.js";
import { parseMcpToolError } from "../../fixtures/mcpToolError.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) => {
if (operation === "read_binary_inventory_summary")
return err(
new AnalysisCapabilityUnavailableError(
"fixture",
operation,
"No native overview",
),
);
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.",
`Fixture (fixture 1) current_document, list_procedures, list_segments, list_strings: ${limitation}`,
]);
expect(evidence.normalized_result).toMatchObject({
document: "fixture",
procedure_count: 0,
string_count: 0,
});
expect(calls.length).toBe(new Set(calls).size);
});
it("counts canonical inventory rows in the composed overview without altering labels", async () => {
const procedures = [
{ address: "0x1000", value: "__proto__" },
{ address: "0x2000", value: "ordinary procedure" },
];
const strings = [{ address: "0x3000", value: "__proto__" }];
const before = [JSON.stringify(procedures), JSON.stringify(strings)];
const client = await connect({
execute: async (operation) => {
if (operation === "read_binary_inventory_summary")
return err(
new AnalysisCapabilityUnavailableError(
"fixture",
operation,
"No native overview",
),
);
const value =
operation === "current_document"
? "fixture"
: operation === "list_procedures"
? procedures
: operation === "list_strings"
? strings
: [];
return ok(
createAnalysisExecution(value, {
id: "fixture",
name: "Fixture",
version: "1",
}),
);
},
});
const response = await client.callTool({
name: "binary_overview",
arguments: {},
});
expect(response.isError).not.toBe(true);
const evidence = parseEvidence(response.structuredContent);
expect(evidence.normalized_result).toMatchObject({
document: "fixture",
procedure_count: procedures.length,
string_count: strings.length,
});
expect([JSON.stringify(procedures), JSON.stringify(strings)]).toEqual(before);
});
it.each(["list_procedures", "list_strings"])(
"refuses legacy %s dictionaries instead of declaring a complete overview",
async (invalidOperation) => {
const client = await connect({
execute: async (operation) => {
if (operation === "read_binary_inventory_summary")
return err(
new AnalysisCapabilityUnavailableError(
"fixture",
operation,
"No native overview",
),
);
return ok(
createAnalysisExecution(
operation === "current_document"
? "fixture"
: operation === invalidOperation
? { "0x1000": "legacy" }
: [],
{ id: "fixture", name: "Fixture", version: "1" },
),
);
},
});
const response = await client.callTool({
name: "binary_overview",
arguments: {},
});
expect(parseMcpToolError(response).error).toMatchObject({
code: "unreadable_output",
details: {
operation: invalidOperation,
},
});
},
);