feat(mcp): select views of retained analysis results (#1180)
Add explicit summary, facet, item and paged views of retained analysis Evidence without repeating analysis. Preserve captured observations, graph validation, artifact identity, coverage and complete default results. Fixes #1050 Verified with focused source, CLI, pinned-SDK schema and MCP tests, serial static checks, and one complete native Windows Notion ASAR workflow. Real Hopper/Ghidra verification was not performed for this provider-independent projection change. Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
This commit is contained in:
co-authored by
Matt Van Horn
parent
911152a04d
commit
db675f1d52
@@ -0,0 +1,82 @@
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { expect } from "vitest";
|
||||
|
||||
import { analysisViewLayoutEvidence } from "../../fixtures/analysisView.js";
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
import { cliTest } from "../../support/cli/cliFixture.js";
|
||||
|
||||
cliTest(
|
||||
"projects one section from a JSON file of inline layout Evidence",
|
||||
async ({ cli }) => {
|
||||
const root = await createTestTempDirectory("rea-analysis-view-cli-");
|
||||
const parent = analysisViewLayoutEvidence();
|
||||
const request = {
|
||||
source: { kind: "inline", evidence: parent },
|
||||
view: {
|
||||
kind: "item",
|
||||
collection: "sections",
|
||||
selector: { name: ".data" },
|
||||
},
|
||||
};
|
||||
const input = join(root, "view.json");
|
||||
await mkdir(root, { recursive: true });
|
||||
await writeFile(input, JSON.stringify(request));
|
||||
const result = await cli.run({
|
||||
arguments: ["inspect-analysis-view", input, "--json"],
|
||||
environment: {
|
||||
HOME: root,
|
||||
XDG_CONFIG_HOME: root,
|
||||
XDG_CACHE_HOME: root,
|
||||
},
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.json).toMatchObject({
|
||||
operation: "inspect_analysis_view",
|
||||
normalized_result: {
|
||||
kind: "item",
|
||||
parent_evidence_id: parent.evidence_id,
|
||||
item: { name: { display: ".data" } },
|
||||
},
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
cliTest("rejects malformed JSON before projection", async ({ cli }) => {
|
||||
const root = await createTestTempDirectory("rea-analysis-view-cli-bad-");
|
||||
const result = await cli.run({
|
||||
arguments: ["inspect-analysis-view", "{", "--json"],
|
||||
environment: {
|
||||
HOME: root,
|
||||
XDG_CONFIG_HOME: root,
|
||||
XDG_CACHE_HOME: root,
|
||||
},
|
||||
});
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.json).toMatchObject({
|
||||
code: "invalid_request",
|
||||
category: "invalid_input",
|
||||
details: { operation: "inspect-analysis-view" },
|
||||
});
|
||||
});
|
||||
|
||||
cliTest("rejects a request that omits source", async ({ cli }) => {
|
||||
const root = await createTestTempDirectory("rea-analysis-view-cli-missing-");
|
||||
const input = join(root, "missing-source.json");
|
||||
await writeFile(input, JSON.stringify({ view: { kind: "summary" } }));
|
||||
const result = await cli.run({
|
||||
arguments: ["inspect-analysis-view", input, "--json"],
|
||||
environment: {
|
||||
HOME: root,
|
||||
XDG_CONFIG_HOME: root,
|
||||
XDG_CACHE_HOME: root,
|
||||
},
|
||||
});
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.json).toMatchObject({
|
||||
code: "invalid_request",
|
||||
category: "invalid_input",
|
||||
details: { operation: "inspect-analysis-view" },
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user