Files
rea/tests/boundary/providers/managed/managedDirectAnalysis.test.ts
morluto 63bf91405c 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.
2026-10-09 20:18:52 +08:00

60 lines
2.2 KiB
TypeScript

import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";
import { createDirectAnalysis } from "../../../../src/composition/directAnalysis.js";
import { parseEvidence } from "../../../../src/domain/evidence.js";
import { buildManagedPeFixture } from "../../../../src/dotnet/ManagedPe.fixture.js";
const { runProviderAnalysis } = createDirectAnalysis({});
describe("managed direct-analysis path boundary", () => {
it("returns provider evidence through the shared analysis service", async () => {
const directory = await createTestTempDirectory("rea-managed-cli-");
const path = join(directory, "fixture.exe");
await writeFile(path, buildManagedPeFixture());
const evidence = parseEvidence(
await runProviderAnalysis(path, "inspect_managed_artifact", {}),
);
expect(evidence).toMatchObject({
operation: "inspect_managed_artifact",
provider: { id: "rea-dotnet-static" },
subject: { local_path: path, format: "pe" },
normalized_result: {
classification: { status: "managed", runtime_family: "modern-dotnet" },
references: [expect.objectContaining({ name: "System.Runtime" })],
},
});
const memberEvidence = parseEvidence(
await runProviderAnalysis(path, "inspect_managed_members", {}),
);
expect(memberEvidence).toMatchObject({
operation: "inspect_managed_members",
provider: { id: "rea-dotnet-static" },
subject: { local_path: path, format: "pe" },
normalized_result: {
identity_scope: { token_identity: "build-local" },
methods: [expect.objectContaining({ token: expect.any(String) })],
},
});
const boundaryEvidence = parseEvidence(
await runProviderAnalysis(path, "inspect_managed_native_boundaries", {}),
);
expect(boundaryEvidence).toMatchObject({
operation: "inspect_managed_native_boundaries",
provider: { id: "rea-dotnet-static" },
subject: { local_path: path, format: "pe" },
normalized_result: {
identity_scope: { token_identity: "build-local" },
pinvoke_imports: [],
},
});
});
});