Files
reverse-engineering-anything/src/application/EvidenceInputResolver.test.ts
T
Jay-Alexander Elliot 57fd3ea5d8 feat(cli): summarize managed members with durable Evidence paging (#5167)
Fixes #5148.

Add opt-in durable managed member summaries and authenticated paging while preserving complete default output, original Evidence, cleanup ownership and queued cancellation.

Verified with bounded real Newtonsoft/Redux/Rust tasks, independent oracles, 556 focused tests and the expanded domain gate; paired token estimates and latency tradeoffs are recorded in experiments/analysis-efficiency/managed-cli.md.
2026-10-22 00:43:30 +00:00

50 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 available from the selected source",
);
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,
},
});
});
});