mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
fix(javascript): align module lookup and source evidence
Preserve CommonJS literal paths and confined ESM URL semantics, including package main fallback, directory intent, Unicode identity, and present opaque modules. Parse extraction inputs at their AST/source owner, retain skipped HTML and source-map coverage, and distinguish endpoint candidates from proven receiver facts. Version structural fingerprints with computed literal contents and propagate them through worker contracts. Reviewed fixes include #1810, #1840, #2642, #2700, #2702, #2714, #2803, #2960, #2968, #2986, #3035, and #3036. Validation: 158 resolver tests passed; public CLI/MCP module lookup controls, package-main/Unicode workflows, and six builtin workflows passed in the current compiled lane. Worker schema/fingerprint regressions passed. Large public pdf.js completion and real Electron analysis remain unverified.
This commit is contained in:
@@ -2,9 +2,12 @@ import { expect, it } from "vitest";
|
||||
|
||||
import { BrowserObservationError } from "../../domain/browserObservationError.js";
|
||||
import { AnalysisCancelledError } from "../../domain/analysisErrorCore.js";
|
||||
import { err } from "../../domain/result.js";
|
||||
import { err, ok } from "../../domain/result.js";
|
||||
import type { JavaScriptRuntimeObservationPort } from "./JavaScriptRuntimeObservationPort.js";
|
||||
import { observeJavaScriptRuntime } from "./JavaScriptRuntimeObservationService.js";
|
||||
import {
|
||||
listJavaScriptRuntimeTargets,
|
||||
observeJavaScriptRuntime,
|
||||
} from "./JavaScriptRuntimeObservationService.js";
|
||||
|
||||
it("preserves failed Inspector cleanup when cancellation occurs during observation", async () => {
|
||||
const controller = new AbortController();
|
||||
@@ -44,3 +47,42 @@ it("preserves failed Inspector cleanup when cancellation occurs during observati
|
||||
expect(result.error.cleanupResources).toEqual(["browser_transport"]);
|
||||
expect(result.error.userCategory).toBe("cancelled");
|
||||
});
|
||||
|
||||
it("does not publish targets when cancellation arrives during provider cleanup", async () => {
|
||||
const controller = new AbortController();
|
||||
const provider: JavaScriptRuntimeObservationPort = {
|
||||
identity: () => ({
|
||||
id: "test-inspector",
|
||||
name: "Test Inspector",
|
||||
version: "1",
|
||||
}),
|
||||
listTargets: async () => {
|
||||
controller.abort();
|
||||
return ok({
|
||||
runtime: {
|
||||
product: "node.js/v24",
|
||||
protocol_version: "1.3",
|
||||
v8_version: "13",
|
||||
},
|
||||
targets: [],
|
||||
excluded: { unsupported_location: 0, unconnectable: 0 },
|
||||
limitations: [],
|
||||
});
|
||||
},
|
||||
observe: async () =>
|
||||
err(new AnalysisCancelledError("observe_javascript_runtime")),
|
||||
};
|
||||
const result = await listJavaScriptRuntimeTargets(
|
||||
provider,
|
||||
{ inspector_endpoint: "http://127.0.0.1:9229" },
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisCancelledError",
|
||||
operation: "list_javascript_runtime_targets",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user