mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
63bf91405c
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.
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import { expect, it } from "vitest";
|
|
|
|
import { BrowserObservationError } from "../../domain/browserObservationError.js";
|
|
import { AnalysisCancelledError } from "../../domain/analysisErrorCore.js";
|
|
import { err } from "../../domain/result.js";
|
|
import type { JavaScriptRuntimeObservationPort } from "./JavaScriptRuntimeObservationPort.js";
|
|
import { observeJavaScriptRuntime } from "./JavaScriptRuntimeObservationService.js";
|
|
|
|
it("preserves failed Inspector cleanup when cancellation occurs during observation", async () => {
|
|
const controller = new AbortController();
|
|
const failure = new BrowserObservationError(
|
|
"observe_javascript_runtime",
|
|
"cleanup_failed",
|
|
{
|
|
cause: new AnalysisCancelledError("observe_javascript_runtime"),
|
|
},
|
|
);
|
|
const provider: JavaScriptRuntimeObservationPort = {
|
|
identity: () => ({
|
|
id: "test-inspector",
|
|
name: "Test Inspector",
|
|
version: "1",
|
|
}),
|
|
listTargets: async () => err(failure),
|
|
observe: async () => {
|
|
controller.abort();
|
|
return err(failure);
|
|
},
|
|
};
|
|
const result = await observeJavaScriptRuntime(
|
|
provider,
|
|
{
|
|
inspector_endpoint: "http://127.0.0.1:9229",
|
|
target_id: "target",
|
|
observation_ms: 0,
|
|
},
|
|
{ signal: controller.signal },
|
|
);
|
|
|
|
expect(result.ok).toBe(false);
|
|
if (result.ok) throw new Error("Expected failed cleanup");
|
|
expect(result.error).toBe(failure);
|
|
expect(result.error.cleanupIncomplete).toBe(true);
|
|
expect(result.error.cleanupResources).toEqual(["browser_transport"]);
|
|
expect(result.error.userCategory).toBe("cancelled");
|
|
});
|