refactor!: enforce canonical evidence and provider boundaries

Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership.

Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers.

BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
This commit is contained in:
morluto
2026-10-09 20:18:52 +08:00
parent 2a7746998d
commit 63bf91405c
514 changed files with 9296 additions and 5825 deletions
+20 -7
View File
@@ -37,7 +37,7 @@ describe("IDA provider composition", () => {
const config = parseConfig({ REA_IDA_MCP_CONFIG: path });
if (!config.ok) throw config.error;
const producer = new RecordingIdaMcp(target, "headless");
const provider = new IdaProvider(config.value, () => producer);
const provider = new IdaProvider(config.value, {}, () => producer);
expect(provider.inspectAvailability()).toMatchObject({
status: "available",
diagnostics: { live_connection_probed: false },
@@ -67,7 +67,7 @@ describe("IDA provider composition", () => {
if (!config.ok) throw config.error;
const producer = new RecordingIdaMcp(target);
const session = createTestBinarySession(
new IdaProvider(config.value, () => producer),
new IdaProvider(config.value, {}, () => producer),
);
expect((await session.open(target.path)).ok).toBe(true);
const query = { procedure: "main", document: target.path };
@@ -124,7 +124,7 @@ describe("IDA provider composition", () => {
await session.close();
expect(producer.closes).toBe(1);
});
it("rejects unsupported target kinds and incomplete upstream compatibility profiles with useful reasons", async () => {
it("rejects unsupported target kinds and reports incomplete upstream profiles on first analysis", async () => {
const { root, target } = await createIdaTarget();
roots.push(root);
const path = join(root, "registration.json");
@@ -139,7 +139,7 @@ describe("IDA provider composition", () => {
const config = parseConfig({ REA_IDA_MCP_CONFIG: path });
if (!config.ok) throw config.error;
const producer = new RecordingIdaMcp(target);
const provider = new IdaProvider(config.value, () => producer);
const provider = new IdaProvider(config.value, {}, () => producer);
expect(
provider.inspectTargetSupport({
path: target.path,
@@ -149,9 +149,22 @@ describe("IDA provider composition", () => {
}),
).toMatchObject({ status: "unsupported", code: "target_kind_unsupported" });
const session = createTestBinarySession(provider);
const opened = await session.open(target.path);
expect(opened.ok).toBe(false);
if (!opened.ok) expect(opened.error.message).toContain("missing tools");
expect((await session.open(target.path)).ok).toBe(true);
expect(producer.connects).toBe(0);
const analyzed = await session.execute("procedure_pseudo_code", {
procedure: "main",
});
expect(analyzed).toMatchObject({
ok: false,
error: {
_tag: "AnalysisProtocolError",
message: expect.stringContaining(
"headless compatibility profile is missing tools: idb_open",
),
},
});
expect(producer.connects).toBe(1);
expect((await session.close()).ok).toBe(true);
expect(producer.closes).toBe(1);
});
});