mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 01:54:49 +00:00
* test: focus assertions on behavioral evidence Prune redundant and wording-coupled checks while retaining diagnostic, parser, recovery, and cleanup coverage. * refactor: remove test-only wrappers and duplicate checks Exercise production operations through test fixtures, remove unused adapters, and keep managed-member uncertainty guidance under its existing owner. * test: focus process validation on diagnostic facts * refactor: remove test-only runtime helpers Move semantic evidence fixture setup out of runtime and remove unused Windows settle recovery helpers while checking configured defaults independently. * test: focus artifact diagnostics on format facts * test: verify retained cleanup guidance delivery
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { traceCallPath } from "./CallPathTracing.js";
|
|
import { createAnalysisExecution } from "./AnalysisProvider.js";
|
|
import {
|
|
AnalysisCancelledError,
|
|
AnalysisOutputError,
|
|
} from "../domain/analysisErrorCore.js";
|
|
import { err, ok } from "../domain/result.js";
|
|
|
|
const input = { start: "entry", direction: "forward" as const };
|
|
const provider = { id: "fixture", name: "Fixture", version: "1" };
|
|
|
|
describe("call-path traversal cancellation ownership", () => {
|
|
for (const phase of ["selection", "relationship"] as const)
|
|
for (const reason of [null, { requested: "stop after provider reply" }])
|
|
it(`preserves the exact reason at the ${phase} continuation (${reason === null ? "null" : "object"})`, async () => {
|
|
const controller = new AbortController();
|
|
const result = await traceCallPath(
|
|
async () => {
|
|
if (phase === "selection") controller.abort(reason);
|
|
return ok("0x1000");
|
|
},
|
|
async () => {
|
|
controller.abort(reason);
|
|
return ok(createAnalysisExecution([], provider));
|
|
},
|
|
input,
|
|
controller.signal,
|
|
);
|
|
if (result.ok) throw new Error("Expected cancellation");
|
|
expect(result.error).toBeInstanceOf(AnalysisCancelledError);
|
|
expect(result.error.cause).toBe(reason);
|
|
});
|
|
|
|
it("preserves a selected provider failure when cancellation arrives with its reply", async () => {
|
|
const controller = new AbortController();
|
|
const failure = new AnalysisOutputError(
|
|
"procedure_callees",
|
|
"invalid fixture reply",
|
|
);
|
|
const result = await traceCallPath(
|
|
async () => ok("0x1000"),
|
|
async () => {
|
|
controller.abort({ requested: "stop" });
|
|
return err(failure);
|
|
},
|
|
input,
|
|
controller.signal,
|
|
);
|
|
expect(result).toEqual(err(failure));
|
|
});
|
|
});
|