Files
rea/src/application/EvidenceInputResolver.test.ts
T
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

48 lines
1.7 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { JAVASCRIPT_FEATURE_TRACE_EXAMPLE } from "../contracts/javascript/javascriptApplicationWorkflowExamples.js";
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
import { resolveEvidenceInput } from "./EvidenceInputResolver.js";
const evidence = JAVASCRIPT_FEATURE_TRACE_EXAMPLE.application;
const reference = {
kind: "retained-evidence" as const,
evidence_id: evidence.evidence_id,
};
describe("exact Evidence input resolution", () => {
it("reports a missing reference and an available recovery", () => {
for (const lookup of [undefined, () => undefined]) {
const result = resolveEvidenceInput(reference, lookup);
if (result.ok) throw new Error("unknown reference was resolved");
const projected = projectAnalysisError(result.error);
expect(projected).toMatchObject({
details: {
evidence_id: reference.evidence_id,
reason: "missing",
actual: null,
},
});
expect(projected.message).toContain("not retained in this session");
expect(projected.remediation.action).toContain(
"complete inline Evidence",
);
}
});
it("rejects a lookup returning another record rather than guessing identity", () => {
const otherId = `ev_${"f".repeat(64)}`;
const result = resolveEvidenceInput(
{ ...reference, evidence_id: otherId },
() => evidence,
);
if (result.ok) throw new Error("mismatched reference was resolved");
expect(projectAnalysisError(result.error)).toMatchObject({
details: {
reason: "identity_mismatch",
expected: otherId,
actual: evidence.evidence_id,
},
});
});
});