Merge origin/main into feat/artifact-integrity-policy

Keep main's skill metadata version (27) and regenerate the package, tool
catalog and product metadata for the merged tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-07 14:18:28 +00:00
co-authored by Claude Opus 5.5
124 changed files with 6709 additions and 167 deletions
@@ -62,4 +62,26 @@ describe("CDP connection", () => {
await connection.close();
}
});
it("preserves the selected payload limit reason for pending and subsequent commands", async () => {
const browser = await startFakeCdpBrowser({
commandResult: () => ({ oversized: "x".repeat(2_048) }),
});
browsers.push(browser);
const connection = await CdpConnection.connect(
browser.browserWebSocketUrl,
"observe_web_execution",
undefined,
{ maxPayloadBytes: 512 },
);
try {
for (const method of ["Runtime.enable", "Debugger.enable"]) {
await expect(connection.send(method)).rejects.toMatchObject({
reason: "payload_limit",
userMessage: expect.stringContaining("512 byte protocol budget"),
});
}
} finally {
await connection.close();
}
});
});
@@ -0,0 +1,34 @@
import { expect, it, onTestFinished } from "vitest";
import { CdpConnection } from "../../../src/browser/CdpConnection.js";
import type { BrowserObservationError } from "../../../src/domain/browserObservationError.js";
import { startFakeCdpBrowser } from "../../fixtures/fakeCdpBrowser.js";
it("reports one fatal wire failure without a pending command and retains it for late subscribers", async () => {
const browser = await startFakeCdpBrowser();
onTestFinished(() => browser.close());
const connection = await CdpConnection.connect(
browser.browserWebSocketUrl,
"observe_web_execution",
);
onTestFinished(() => connection.close());
const failures: BrowserObservationError[] = [];
const failure = new Promise<BrowserObservationError>((resolve) => {
connection.onProtocolFailure((error) => {
failures.push(error);
resolve(error);
});
});
browser.emitRawMessage("{not-json");
browser.emitRawMessage(JSON.stringify({ method: 42 }));
expect(await failure).toMatchObject({ reason: "protocol_error" });
let lateFailure: BrowserObservationError | undefined;
connection.onProtocolFailure((error) => {
lateFailure = error;
});
expect(lateFailure).toMatchObject({ reason: "protocol_error" });
await expect(connection.send("Page.getFrameTree")).rejects.toMatchObject({
reason: "protocol_error",
});
expect(failures).toHaveLength(1);
expect(browser.commands).toEqual([]);
});
@@ -0,0 +1,433 @@
import { createHash } from "node:crypto";
import { describe, expect, it, onTestFinished } from "vitest";
import { CdpWebRuntimeProvider } from "../../../src/browser/execution/CdpWebRuntimeProvider.js";
import { observeWebExecutionInputSchema } from "../../../src/domain/webExecution.js";
import { inspectWebEventListenersInputSchema } from "../../../src/domain/webEventListeners.js";
import {
runtimeSourceA,
runtimeSourceB,
startRuntimeBrowser,
} from "../../fixtures/webRuntime.js";
import type { FakeOptions } from "../../fixtures/fakeCdpBrowser.js";
const fixture = async (options: FakeOptions = {}) => {
const browser = await startRuntimeBrowser(options);
onTestFinished(() => browser.close());
const provider = new CdpWebRuntimeProvider();
const input = {
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 5,
};
return {
browser,
provider,
execution: observeWebExecutionInputSchema.parse(input),
listeners: inspectWebEventListenersInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
selector: "#selected",
}),
};
};
describe("native runtime producer boundary", () => {
it("binds complete producer stacks by script ID and ignores foreign sessions without URL guessing", async () => {
const { browser, provider, execution } = await fixture();
const params = {
requestId: "selected-request",
frameId: "runtime-main",
timestamp: 12.5,
request: {
url: `${browser.endpoint}/request?caller-value=retained`,
method: "POST",
},
initiator: {
type: "script",
producerExtension: "retain-unknown-fields",
stack: {
description: "observed-sync-stack",
callFrames: [
{
scriptId: "script-b",
url: `${browser.endpoint}/same.js`,
functionName: "alias",
lineNumber: 0,
columnNumber: 2,
},
],
parent: {
description: "observed-async-stack",
callFrames: [
{
scriptId: "unknown-script",
url: `${browser.endpoint}/same.js`,
functionName: "unknown",
lineNumber: 0,
columnNumber: 3,
},
],
parentId: { id: "async-parent", debuggerId: "other-debugger" },
},
},
},
};
const result = await provider.observeExecution(
{ ...execution, observation_ms: 30 },
{
progress: {
report: async (update) => {
if (update.completed !== 1) return;
browser.emitEvent({
method: "Network.requestWillBeSent",
params,
sessionId: "foreign-session",
});
browser.emitEvent({
method: "Network.requestWillBeSent",
params,
sessionId: "session-1",
});
},
},
},
);
if (!result.ok) throw result.error;
expect(result.value.requests).toHaveLength(1);
expect(result.value.requests[0]?.reported_initiator).toEqual(
params.initiator,
);
expect(result.value.requests[0]?.callsites).toMatchObject([
{ script_id: "script-b", source_association: "script_id" },
{ script_id: "unknown-script", source_association: "unknown" },
]);
expect(result.value.requests[0]?.async_parent_ids).toEqual([
{ id: "async-parent", debugger_id: "other-debugger" },
]);
expect(result.value.requests[0]?.causal_attribution).toBe("unknown");
});
});
describe("runtime window and producer granularity", () => {
it("ends at document replacement and leaves coverage explicitly unavailable", async () => {
const { browser, provider, execution } = await fixture();
const result = await provider.observeExecution(
{ ...execution, observation_ms: 30_000 },
{
progress: {
report: async (update) => {
if (update.completed === 1)
browser.emitEvent({
method: "Page.frameNavigated",
sessionId: "session-1",
params: {
frame: {
id: "runtime-main",
url: `${browser.endpoint}/new-document`,
},
},
});
},
},
},
);
if (!result.ok) throw result.error;
expect(result.value.window.end_reason).toBe("document_changed");
expect(result.value.coverage.state).toBe("unavailable");
expect(result.value.instrumentation.takes_one_resetting_sample).toBe(false);
});
it("reports disconnected cleanup as unknown instead of successful detachment", async () => {
const { provider, execution } = await fixture({
closeOnMethod: "Profiler.takePreciseCoverage",
});
const result = await provider.observeExecution(execution);
if (result.ok)
throw new Error("Disconnect cannot confirm instrumentation cleanup");
expect(result.error.cleanupIncomplete).toBe(true);
});
it("retains function-only producer granularity without fabricating zero branches", async () => {
const { provider, execution } = await fixture({
commandResult: (command, origin) =>
command.method === "Profiler.takePreciseCoverage"
? {
timestamp: 13,
result: [
{
scriptId: "script-a",
url: `${origin}/same.js`,
functions: [
{
functionName: "selected",
isBlockCoverage: false,
ranges: [
{
startOffset: 0,
endOffset: runtimeSourceA.length,
count: 1,
},
],
},
],
},
],
}
: undefined,
});
const result = await provider.observeExecution(execution);
if (!result.ok) throw result.error;
expect(result.value.coverage.scripts[0]?.functions[0]).toMatchObject({
is_block_coverage: false,
ranges: [{ count: 1 }],
});
expect(result.value.script_inventory.not_reported_script_ids).toContain(
"script-b",
);
expect(result.value.script_inventory.coverage_absence).toBe("unknown");
});
});
describe("runtime source and listener identity", () => {
it("retains same-URL script identities, UTF-16 bounds, nested zero counts and actual cleanup", async () => {
const { browser, provider, execution } = await fixture();
const result = await provider.observeExecution(execution);
if (!result.ok) throw result.error;
expect(
result.value.coverage.scripts.map((script) => script.script_id),
).toEqual(["script-a", "script-b"]);
expect(result.value.coverage.excluded_scripts).toBe(1);
expect(
result.value.sources.map((script) =>
script.source.state === "captured" ? script.source.text : null,
),
).toEqual([runtimeSourceA, runtimeSourceB]);
const source = result.value.sources[0];
expect(source?.producer_hash).toBe("producer-reported-hash");
expect(source?.source).toMatchObject({
sha256: createHash("sha256").update(runtimeSourceA).digest("hex"),
utf16_units: runtimeSourceA.length,
utf8_bytes: Buffer.byteLength(runtimeSourceA),
});
expect(
result.value.coverage.scripts[0]?.functions[0]?.ranges[1],
).toMatchObject({ count: 0, source_bounds: "verified" });
expect(
browser.commands.some(
(command) => command.method === "Profiler.stopPreciseCoverage",
),
).toBe(true);
expect(
browser.commands.some(
(command) => command.method === "Target.detachFromTarget",
),
).toBe(true);
expect(
browser.commands.some((command) =>
["Browser.close", "Target.closeTarget", "Runtime.evaluate"].includes(
command.method,
),
),
).toBe(false);
});
it("inspects listener source and releases only its owned object group", async () => {
const { browser, provider, listeners } = await fixture();
const result = await provider.inspectEventListeners(listeners);
if (!result.ok) throw result.error;
expect(result.value.listeners[0]).toMatchObject({
type: "click",
location: {
script_id: "script-a",
source_association: "script_id",
line_number: 1,
},
execution: "unknown",
});
const resolve = browser.commands.find(
(command) => command.method === "DOM.resolveNode",
);
const release = browser.commands.find(
(command) => command.method === "Runtime.releaseObjectGroup",
);
expect(release?.params.objectGroup).toBe(resolve?.params.objectGroup);
expect(resolve?.params.objectGroup).toMatch(/^rea-listeners-/u);
});
it("returns an explicit missing node without source/handler evaluation", async () => {
const { provider, listeners } = await fixture();
const result = await provider.inspectEventListeners({
...listeners,
selector: "#missing",
});
if (!result.ok) throw result.error;
expect(result.value.selected_node.match).toBe("not_found");
expect(result.value.listeners).toEqual([]);
});
});
describe("runtime lifecycle and invalid producer data", () => {
it("releases instrumentation after cancellation delivered at the actual armed point", async () => {
const { browser, provider, execution } = await fixture();
const controller = new AbortController();
const result = await provider.observeExecution(
{ ...execution, observation_ms: 30_000 },
{
signal: controller.signal,
progress: {
report: async (update) => {
if (update.completed === 1) controller.abort();
},
},
},
);
expect(result.ok).toBe(false);
if (result.ok)
throw new Error("Cancellation must not produce successful evidence");
expect(result.error._tag).toBe("AnalysisCancelledError");
expect(
browser.commands.some(
(command) => command.method === "Profiler.stopPreciseCoverage",
),
).toBe(true);
});
it("returns cleanup failure when coverage stop cannot be confirmed", async () => {
const { browser, provider, execution } = await fixture({
unsupportedMethods: ["Profiler.stopPreciseCoverage"],
});
const result = await provider.observeExecution(execution);
expect(result.ok).toBe(false);
if (result.ok) throw new Error("Failed cleanup must not return success");
expect(result.error.cleanupIncomplete).toBe(true);
expect(
browser.commands.some(
(command) => command.method === "Target.detachFromTarget",
),
).toBe(true);
});
it("preserves the unsupported command reason", async () => {
const { provider, execution } = await fixture({
unsupportedMethods: ["Profiler.startPreciseCoverage"],
});
const result = await provider.observeExecution(execution);
if (result.ok) throw new Error("Unsupported instrumentation must fail");
expect(result.error.userMessage).toContain("Profiler.startPreciseCoverage");
expect(result.error.userMessage).toContain("Method not found");
});
it("rejects a malformed sample and still stops coverage", async () => {
const { browser, provider, execution } = await fixture({
commandResult: (command) =>
command.method === "Profiler.takePreciseCoverage"
? { timestamp: 1, result: "wrong" }
: undefined,
});
const result = await provider.observeExecution(execution);
if (result.ok) throw new Error("Malformed producer coverage must fail");
expect(result.error._tag).toBe("AnalysisOutputError");
expect(
browser.commands.some(
(command) => command.method === "Profiler.stopPreciseCoverage",
),
).toBe(true);
});
it("rejects a source range measured as UTF-8 bytes instead of UTF-16 units", async () => {
const { provider, execution } = await fixture({
commandResult: (command, origin) =>
command.method === "Profiler.takePreciseCoverage"
? {
timestamp: 13,
result: [
{
scriptId: "script-a",
url: `${origin}/same.js`,
functions: [
{
functionName: "bad",
isBlockCoverage: true,
ranges: [
{
startOffset: 0,
endOffset: Buffer.byteLength(runtimeSourceA),
count: 1,
},
],
},
],
},
],
}
: undefined,
});
const result = await provider.observeExecution(execution);
if (result.ok)
throw new Error("Byte offsets must not be mislabeled UTF-16");
expect(result.error._tag).toBe("AnalysisOutputError");
});
});
describe("runtime document identity and authorization failures", () => {
it.each(["execution", "listeners"] as const)(
"rejects newly reported loader identity for %s when the initial loader was unknown",
async (action) => {
const { provider, execution, listeners } = await fixture({
commandResult: (command, origin, frameReads) =>
command.method === "Page.getFrameTree"
? {
frameTree: {
frame: {
id: "runtime-main",
url: `${origin}/allowed`,
...(frameReads === 1 ? {} : { loaderId: "new-document" }),
},
},
}
: undefined,
});
const result =
action === "execution"
? await provider.observeExecution(execution)
: await provider.inspectEventListeners(listeners);
if (result.ok)
throw new Error(
"Unknown loader must not accept a newly reported document identity",
);
expect(result.error).toMatchObject({ reason: "target_changed" });
},
);
it.each(["execution", "listeners"] as const)(
"reports the selected %s operation when the live frame origin is denied",
async (action) => {
const { provider, execution, listeners } = await fixture({
commandResult: (command) =>
command.method === "Page.getFrameTree"
? {
frameTree: {
frame: {
id: "runtime-main",
url: "https://unselected.example/document",
loaderId: "denied",
},
},
}
: undefined,
});
const result =
action === "execution"
? await provider.observeExecution(execution)
: await provider.inspectEventListeners(listeners);
if (result.ok) throw new Error("Unselected live origin must be denied");
expect(result.error).toMatchObject({
reason: "target_not_allowed",
operation:
action === "execution"
? "observe_web_execution"
: "inspect_web_event_listeners",
});
},
);
});
@@ -0,0 +1,140 @@
import { describe, expect, it, onTestFinished } from "vitest";
import { CdpWebRuntimeProvider } from "../../../src/browser/execution/CdpWebRuntimeProvider.js";
import type { CdpEvent } from "../../../src/browser/CdpConnection.js";
import { observeWebExecutionInputSchema } from "../../../src/domain/webExecution.js";
import { inspectWebEventListenersInputSchema } from "../../../src/domain/webEventListeners.js";
import { startRuntimeBrowser } from "../../fixtures/webRuntime.js";
describe("runtime final collection boundaries", () => {
it("retains a script parsed during the final resetting coverage command", async () => {
let emitEvent: ((event: CdpEvent) => void) | undefined;
const browser = await startRuntimeBrowser({
commandResult: (command, origin) => {
if (command.method === "Profiler.takePreciseCoverage") {
emitEvent?.({
method: "Debugger.scriptParsed",
sessionId: "session-1",
params: {
scriptId: "late-script",
url: `${origin}/late.js`,
executionContextId: 1,
executionContextAuxData: { frameId: "runtime-main" },
startLine: 0,
startColumn: 0,
endLine: 0,
endColumn: 1,
},
});
return {
timestamp: 12,
result: [
{
scriptId: "late-script",
url: `${origin}/late.js`,
functions: [
{
functionName: "late",
isBlockCoverage: true,
ranges: [{ startOffset: 0, endOffset: 1, count: 1 }],
},
],
},
],
};
}
if (
command.method === "Debugger.getScriptSource" &&
command.params.scriptId === "late-script"
)
return { scriptSource: ";" };
return undefined;
},
});
emitEvent = browser.emitEvent;
onTestFinished(() => browser.close());
const result = await new CdpWebRuntimeProvider().observeExecution(
observeWebExecutionInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 5,
}),
);
if (!result.ok) throw result.error;
expect(result.value.coverage.scripts[0]).toMatchObject({
script_id: "late-script",
functions: [{ ranges: [{ count: 1, source_bounds: "verified" }] }],
});
expect(
result.value.sources.find(({ script_id }) => script_id === "late-script")
?.source,
).toMatchObject({ state: "captured", text: ";" });
expect(result.value.coverage.excluded_scripts).toBe(0);
});
it.each(["#selected", "#missing"])(
"rejects known malformed source metadata during final listener assertion for %s",
async (selector) => {
let emitEvent: ((event: CdpEvent) => void) | undefined;
const browser = await startRuntimeBrowser({
commandResult: (command, _origin, reads) => {
if (command.method === "Page.getFrameTree" && reads === 3)
emitEvent?.({
method: "Debugger.scriptParsed",
sessionId: "session-1",
params: {},
});
return undefined;
},
});
emitEvent = browser.emitEvent;
onTestFinished(() => browser.close());
const result = await new CdpWebRuntimeProvider().inspectEventListeners(
inspectWebEventListenersInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
selector,
}),
);
if (result.ok)
throw new Error(
"Known producer failure cannot return partial listener success",
);
expect(result.error._tag).toBe("AnalysisOutputError");
},
);
});
describe("runtime fatal protocol stream", () => {
it.each(["{not-json", JSON.stringify({ method: 42 })])(
"stops an armed command-free window on malformed wire data %s",
async (message) => {
const browser = await startRuntimeBrowser();
onTestFinished(() => browser.close());
const result = await new CdpWebRuntimeProvider().observeExecution(
observeWebExecutionInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 2_147_483_647,
}),
{
signal: AbortSignal.timeout(2_000),
progress: {
report: async (update) => {
if (update.completed === 1) browser.emitRawMessage(message);
},
},
},
);
if (result.ok)
throw new Error(
"Malformed wire data must not produce successful evidence",
);
expect(result.error).toMatchObject({
cleanupIncomplete: true,
diagnostics: {
previous_error: expect.stringMatching(/protocol|malformed/iu),
},
});
},
);
});
@@ -0,0 +1,133 @@
import { describe, expect, it, onTestFinished } from "vitest";
import { CdpWebRuntimeProvider } from "../../../src/browser/execution/CdpWebRuntimeProvider.js";
import { observeWebExecutionInputSchema } from "../../../src/domain/webExecution.js";
import { startRuntimeBrowser } from "../../fixtures/webRuntime.js";
describe("runtime initiator URL representation", () => {
it.each(["before", "after"])(
"omits proven transport userinfo and preserves declared names with metadata %s the request",
async (ordering) => {
const browser = await startRuntimeBrowser();
onTestFinished(() => browser.close());
const resourceUrl =
browser.endpoint.replace("http://", "http://transport:credential@") +
"/resource.js?caller=value#fragment";
const declaredUrl =
browser.endpoint.replace("http://", "http://declared:label@") +
"/declaration.js?caller=value#fragment";
const metadata = (
scriptId: string,
url: string,
hasSourceURL: boolean,
) => ({
scriptId,
url,
hasSourceURL,
executionContextId: 999,
startLine: 0,
startColumn: 0,
endLine: 1,
endColumn: 0,
});
const frames = [
{
scriptId: "resource-script",
url: resourceUrl,
functionName: "resource",
lineNumber: 0,
columnNumber: 0,
},
{
scriptId: "declared-script",
url: declaredUrl,
functionName: "declared",
lineNumber: 0,
columnNumber: 0,
},
];
const initiator = {
type: "script",
url: resourceUrl,
lineNumber: 0,
producerExtension: { url: declaredUrl, opaque: "keep caller data" },
stack: {
description: "producer sync",
callFrames: [frames[0]],
parent: {
description: "producer async",
callFrames: [frames[1]],
parentId: { id: "retained-parent" },
},
},
};
const result = await new CdpWebRuntimeProvider().observeExecution(
observeWebExecutionInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 30,
}),
{
progress: {
report: async (update) => {
if (update.completed !== 1) return;
const scripts = () => {
for (const params of [
metadata("resource-script", resourceUrl, false),
metadata("declared-script", declaredUrl, true),
])
browser.emitEvent({
method: "Debugger.scriptParsed",
params,
sessionId: "session-1",
});
};
if (ordering === "before") scripts();
browser.emitEvent({
method: "Network.requestWillBeSent",
sessionId: "session-1",
params: {
requestId: "request",
frameId: "runtime-main",
timestamp: 12,
request: {
url: `${browser.endpoint}/selected`,
method: "GET",
},
initiator,
},
});
if (ordering === "after") scripts();
},
},
},
);
if (!result.ok) throw result.error;
const sanitized = `${browser.endpoint}/resource.js?caller=value#fragment`;
expect(result.value.requests[0]?.reported_initiator).toEqual({
...initiator,
url: sanitized,
stack: {
...initiator.stack,
callFrames: [{ ...frames[0], url: sanitized }],
},
});
expect(result.value.requests[0]?.callsites.map(({ url }) => url)).toEqual(
[sanitized, declaredUrl, sanitized],
);
expect(
result.value.sources.find(
({ script_id }) => script_id === "resource-script",
)?.url,
).toBe(sanitized);
expect(
result.value.sources.find(
({ script_id }) => script_id === "declared-script",
)?.url,
).toBe(declaredUrl);
expect(JSON.stringify(result.value)).not.toContain(
"transport:credential@",
);
expect(JSON.stringify(result.value)).toContain("declared:label@");
},
);
});
@@ -0,0 +1,219 @@
import { describe, expect, it, onTestFinished } from "vitest";
import { CdpWebRuntimeProvider } from "../../../src/browser/execution/CdpWebRuntimeProvider.js";
import { observeWebExecutionInputSchema } from "../../../src/domain/webExecution.js";
import { inspectWebEventListenersInputSchema } from "../../../src/domain/webEventListeners.js";
import { startRuntimeBrowser } from "../../fixtures/webRuntime.js";
describe("runtime document identity across same-document URL changes", () => {
it.each(["execution", "listeners"] as const)(
"accepts a stable loader for %s while retaining the initial location",
async (operation) => {
const browser = await startRuntimeBrowser({
commandResult: (command, origin, reads) =>
command.method === "Page.getFrameTree"
? {
frameTree: {
frame: {
id: "runtime-main",
url: `${origin}/${reads === 1 ? "allowed" : "new-path?caller=value#fragment"}`,
loaderId: "same-document",
},
},
}
: undefined,
});
onTestFinished(() => browser.close());
const provider = new CdpWebRuntimeProvider();
const scope = {
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
};
const result =
operation === "execution"
? await provider.observeExecution(
observeWebExecutionInputSchema.parse({
...scope,
observation_ms: 5,
}),
)
: await provider.inspectEventListeners(
inspectWebEventListenersInputSchema.parse({
...scope,
selector: "#selected",
}),
);
if (!result.ok) throw result.error;
expect(result.value.target.initial_url).toBe(
`${browser.endpoint}/allowed`,
);
expect(result.value.target.loader_id).toBe("same-document");
},
);
it.each([
{ loader: undefined, denied: false, reason: "target_changed" },
{ loader: "same-document", denied: true, reason: "target_not_allowed" },
])(
"preserves conservative identity and origin checks: $reason",
async ({ loader, denied, reason }) => {
const browser = await startRuntimeBrowser({
commandResult: (command, origin, reads) =>
command.method === "Page.getFrameTree"
? {
frameTree: {
frame: {
id: "runtime-main",
url:
reads === 1
? `${origin}/allowed`
: denied
? "https://unselected.example/new"
: `${origin}/new`,
...(loader === undefined ? {} : { loaderId: loader }),
},
},
}
: undefined,
});
onTestFinished(() => browser.close());
const result = await new CdpWebRuntimeProvider().inspectEventListeners(
inspectWebEventListenersInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
selector: "#selected",
}),
);
if (result.ok) throw new Error("Unverified document or origin must fail");
expect(result.error).toMatchObject({ reason });
},
);
});
describe("runtime collector failure and uncertain source metadata", () => {
it.each(["Debugger.scriptParsed", "Network.requestWillBeSent"])(
"stops an armed long window immediately for malformed %s",
async (method) => {
const browser = await startRuntimeBrowser();
onTestFinished(() => browser.close());
const result = await new CdpWebRuntimeProvider().observeExecution(
observeWebExecutionInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 2_147_483_647,
}),
{
signal: AbortSignal.timeout(2_000),
progress: {
report: async (update) => {
if (update.completed === 1)
browser.emitEvent({
method,
params: {},
sessionId: "session-1",
});
},
},
},
);
if (result.ok) throw new Error("Malformed producer data must fail");
expect(result.error._tag).toBe("AnalysisOutputError");
expect(
browser.commands.some(
({ method: command }) => command === "Profiler.stopPreciseCoverage",
),
).toBe(true);
expect(
browser.commands.some(
({ method: command }) => command === "Target.detachFromTarget",
),
).toBe(true);
},
);
it("retains reported metadata without claiming ownership or reading unowned source", async () => {
const browser = await startRuntimeBrowser();
onTestFinished(() => browser.close());
const script = {
scriptId: "uncertain-script",
url: `${browser.endpoint}/declared.js?caller=value#fragment`,
executionContextId: 999,
hash: "observed-hash",
sourceMapURL: "../declared.map?query=value#fragment",
hasSourceURL: true,
scriptLanguage: "JavaScript",
startLine: 4,
startColumn: 8,
endLine: 8,
endColumn: 0,
};
const result = await new CdpWebRuntimeProvider().observeExecution(
observeWebExecutionInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 30,
}),
{
progress: {
report: async (update) => {
if (update.completed !== 1) return;
browser.emitEvent({
method: "Debugger.scriptParsed",
params: script,
sessionId: "session-1",
});
browser.emitEvent({
method: "Network.requestWillBeSent",
sessionId: "session-1",
params: {
requestId: "uncertain-request",
frameId: "runtime-main",
timestamp: 12,
request: { url: `${browser.endpoint}/request`, method: "GET" },
initiator: {
type: "script",
stack: {
callFrames: [
{
scriptId: script.scriptId,
url: script.url,
functionName: "unknown",
lineNumber: 4,
columnNumber: 8,
},
],
},
},
},
});
},
},
},
);
if (!result.ok) throw result.error;
expect(
result.value.sources.find(
({ script_id }) => script_id === script.scriptId,
),
).toMatchObject({
url: script.url,
execution_context_id: 999,
frame_id: null,
producer_hash: script.hash,
source_map_url: script.sourceMapURL,
has_source_url: true,
language: "JavaScript",
resource_start: { line_number: 4, column_number: 8 },
source: { state: "excluded" },
});
expect(result.value.requests[0]?.callsites[0]?.source_association).toBe(
"unknown",
);
expect(
browser.commands.some(
({ method, params }) =>
method === "Debugger.getScriptSource" &&
params.scriptId === script.scriptId,
),
).toBe(false);
});
});
@@ -0,0 +1,44 @@
import { expect, it, onTestFinished } from "vitest";
import { CdpWebRuntimeProvider } from "../../../src/browser/execution/CdpWebRuntimeProvider.js";
import { inspectWebEventListenersInputSchema } from "../../../src/domain/webEventListeners.js";
import { startRuntimeBrowser } from "../../fixtures/webRuntime.js";
it.each([
{
code: -32000,
message: "DOM Error while querying",
expected: "AnalysisInputError",
},
{
code: -32000,
message: "Could not find node with given id",
expected: "BrowserObservationError",
},
{
code: -32601,
message: "Method not found",
expected: "BrowserObservationError",
},
])(
"classifies the actual selector rejection $message",
async ({ code, message, expected }) => {
const browser = await startRuntimeBrowser({
commandError: ({ method }) =>
method === "DOM.querySelector" ? { code, message } : undefined,
});
onTestFinished(() => browser.close());
const result = await new CdpWebRuntimeProvider().inspectEventListeners(
inspectWebEventListenersInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
selector: "[",
}),
);
if (result.ok)
throw new Error("Rejected selectors cannot produce listener evidence");
expect(result.error._tag).toBe(expected);
expect(result.error.cleanupIncomplete).toBe(false);
if (result.error._tag === "AnalysisInputError")
expect(result.error.message).toContain("inspect_web_event_listeners");
},
);
@@ -0,0 +1,136 @@
import { expect, it, onTestFinished } from "vitest";
import type { CdpEvent } from "../../../src/browser/CdpConnection.js";
import { CdpWebRuntimeProvider } from "../../../src/browser/execution/CdpWebRuntimeProvider.js";
import { observeWebExecutionInputSchema } from "../../../src/domain/webExecution.js";
import { inspectWebEventListenersInputSchema } from "../../../src/domain/webEventListeners.js";
import { startRuntimeBrowser } from "../../fixtures/webRuntime.js";
it.each(
["listeners", "execution"].flatMap((operation) =>
["source_read", "other_source_read", "final_assertion"].map((phase) => ({
operation,
phase,
})),
),
)(
"revalidates $operation joins when a known script changes at $phase",
async ({ operation, phase }) => {
let emit: ((event: CdpEvent) => void) | undefined;
const browser = await startRuntimeBrowser({
commandResult: (command, origin, reads) => {
if (
(phase === "source_read" &&
command.method === "Debugger.getScriptSource" &&
command.params.scriptId === "script-a") ||
(phase === "other_source_read" &&
command.method === "Debugger.getScriptSource" &&
command.params.scriptId === "script-b") ||
(phase === "final_assertion" &&
command.method === "Page.getFrameTree" &&
reads === (operation === "listeners" ? 3 : 4))
)
emit?.({
sessionId: "session-1",
method: "Debugger.scriptParsed",
params: {
scriptId: "script-a",
url: `${origin}/changed.js`,
executionContextId: 1,
executionContextAuxData: { frameId: "runtime-main" },
startLine: 0,
startColumn: 0,
endLine: 1,
endColumn: 0,
hash: "changed-producer-hash",
hasSourceURL: true,
scriptLanguage: "JavaScript",
},
});
if (command.method === "DOMDebugger.getEventListeners")
return {
listeners: ["script-a", "script-b"].map((scriptId) => ({
type: "click",
useCapture: false,
passive: true,
once: false,
scriptId,
lineNumber: 0,
columnNumber: 0,
})),
};
return undefined;
},
});
emit = browser.emitEvent;
onTestFinished(() => browser.close());
const provider = new CdpWebRuntimeProvider();
const scope = { cdp_endpoint: browser.endpoint, target_id: "allowed-page" };
if (operation === "listeners") {
const result = await provider.inspectEventListeners(
inspectWebEventListenersInputSchema.parse({
...scope,
selector: "#selected",
}),
);
if (!result.ok) throw result.error;
expect(result.value.listeners[0]?.location.source_association).toBe(
"unknown",
);
expect(result.value.sources[0]).toMatchObject({
frame_id: null,
source: { state: "excluded" },
});
} else {
const result = await provider.observeExecution(
observeWebExecutionInputSchema.parse({ ...scope, observation_ms: 5 }),
{
progress: {
report: async (update) => {
if (update.completed !== 1) return;
browser.emitEvent({
sessionId: "session-1",
method: "Network.requestWillBeSent",
params: {
requestId: "source-completion-request",
frameId: "runtime-main",
timestamp: 12,
request: {
url: `${new URL(browser.endpoint).origin}/selected`,
method: "GET",
},
initiator: {
type: "script",
stack: {
callFrames: [
{
scriptId: "script-a",
url: `${new URL(browser.endpoint).origin}/same.js`,
lineNumber: 0,
columnNumber: 0,
functionName: "selected",
},
],
},
},
},
});
},
},
},
);
if (!result.ok) throw result.error;
expect(
result.value.coverage.scripts.some(
({ script_id }) => script_id === "script-a",
),
).toBe(false);
expect(result.value.requests[0]?.callsites[0]?.source_association).toBe(
"unknown",
);
expect(result.value.script_inventory.main_document_scripts).toBe(1);
expect(
result.value.sources.find(({ script_id }) => script_id === "script-a"),
).toMatchObject({ frame_id: null, source: { state: "excluded" } });
}
},
);
@@ -0,0 +1,176 @@
import { describe, expect, it, onTestFinished } from "vitest";
import { CdpWebRuntimeProvider } from "../../../src/browser/execution/CdpWebRuntimeProvider.js";
import type { CdpEvent } from "../../../src/browser/CdpConnection.js";
import { observeWebExecutionInputSchema } from "../../../src/domain/webExecution.js";
import { startRuntimeBrowser } from "../../fixtures/webRuntime.js";
describe("runtime flat-session lifecycle", () => {
it("rejects a producer detachment between counter startup and local arming", async () => {
let emitEvent: ((event: CdpEvent) => void) | undefined;
const browser = await startRuntimeBrowser({
commandResult: (command) => {
if (command.method !== "Profiler.startPreciseCoverage")
return undefined;
emitEvent?.({
method: "Target.detachedFromTarget",
params: { sessionId: "session-1" },
});
return { timestamp: 12 };
},
});
emitEvent = browser.emitEvent;
onTestFinished(() => browser.close());
let reportedArmed = false;
const result = await new CdpWebRuntimeProvider().observeExecution(
observeWebExecutionInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 2_147_483_647,
}),
{
signal: AbortSignal.timeout(2_000),
progress: {
report: async (update) => {
if (update.completed === 1) reportedArmed = true;
},
},
},
);
if (result.ok)
throw new Error("A terminated target cannot arm an execution window");
expect(result.error).toMatchObject({ reason: "target_changed" });
expect(reportedArmed).toBe(false);
});
it("ends immediately on its root detachment without confusing another session", async () => {
const browser = await startRuntimeBrowser();
onTestFinished(() => browser.close());
const result = await new CdpWebRuntimeProvider().observeExecution(
observeWebExecutionInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 2_147_483_647,
}),
{
signal: AbortSignal.timeout(2_000),
progress: {
report: async (update) => {
if (update.completed !== 1) return;
browser.emitEvent({
method: "Target.detachedFromTarget",
params: { sessionId: "another-session" },
});
browser.emitEvent({
method: "Target.detachedFromTarget",
params: { sessionId: "session-1" },
});
},
},
},
);
if (!result.ok) throw result.error;
expect(result.value.window.end_reason).toBe("target_terminated");
expect(result.value.coverage.state).toBe("unavailable");
expect(result.value.instrumentation.takes_one_resetting_sample).toBe(false);
});
it("ignores root detachment for a different flat session", async () => {
const browser = await startRuntimeBrowser();
onTestFinished(() => browser.close());
const result = await new CdpWebRuntimeProvider().observeExecution(
observeWebExecutionInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 30,
}),
{
progress: {
report: async (update) => {
if (update.completed === 1)
browser.emitEvent({
method: "Target.detachedFromTarget",
params: { sessionId: "another-session" },
});
},
},
},
);
if (!result.ok) throw result.error;
expect(result.value.window.end_reason).toBe("window_elapsed");
});
});
describe("coverage URL representation", () => {
it("sanitizes proven resource URLs while preserving declared source names", async () => {
let resourceUrl = "";
let declaredUrl = "";
const browser = await startRuntimeBrowser({
commandResult: (command) => {
if (command.method === "Profiler.takePreciseCoverage")
return {
timestamp: 12,
result: [
{ scriptId: "transport-script", url: resourceUrl, functions: [] },
{ scriptId: "declared-script", url: declaredUrl, functions: [] },
],
};
if (
command.method === "Debugger.getScriptSource" &&
["transport-script", "declared-script"].includes(
String(command.params.scriptId),
)
)
return { scriptSource: ";" };
return undefined;
},
});
onTestFinished(() => browser.close());
resourceUrl =
browser.endpoint.replace("http://", "http://transport:credential@") +
"/resource.js?caller=value#fragment";
declaredUrl =
browser.endpoint.replace("http://", "http://declared:label@") +
"/declared.js?caller=value#fragment";
const result = await new CdpWebRuntimeProvider().observeExecution(
observeWebExecutionInputSchema.parse({
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
observation_ms: 30,
}),
{
progress: {
report: async (update) => {
if (update.completed !== 1) return;
for (const [scriptId, url, hasSourceURL] of [
["transport-script", resourceUrl, false],
["declared-script", declaredUrl, true],
] as const)
browser.emitEvent({
method: "Debugger.scriptParsed",
sessionId: "session-1",
params: {
scriptId,
url,
hasSourceURL,
executionContextId: 1,
executionContextAuxData: { frameId: "runtime-main" },
startLine: 0,
startColumn: 0,
endLine: 0,
endColumn: 1,
},
});
},
},
},
);
if (!result.ok) throw result.error;
expect(
result.value.coverage.scripts.map(({ reported_url }) => reported_url),
).toEqual([
`${browser.endpoint}/resource.js?caller=value#fragment`,
declaredUrl,
]);
expect(JSON.stringify(result.value)).not.toContain("transport:credential@");
});
});
@@ -0,0 +1,121 @@
import { describe, expect, it, onTestFinished } from "vitest";
import { CdpWebRuntimeProvider } from "../../../src/browser/execution/CdpWebRuntimeProvider.js";
import { observeWebExecutionInputSchema } from "../../../src/domain/webExecution.js";
import { inspectWebEventListenersInputSchema } from "../../../src/domain/webEventListeners.js";
import { startRuntimeBrowser } from "../../fixtures/webRuntime.js";
const unknownWorld = { frameId: "runtime-main" };
const defaultWorld = { ...unknownWorld, isDefault: true, type: "default" };
const isolatedWorld = { ...unknownWorld, isDefault: false, type: "isolated" };
describe("runtime execution world ownership", () => {
it.each([
{ name: "isolated context", context: isolatedWorld, script: isolatedWorld },
{
name: "isolated script metadata",
context: undefined,
script: isolatedWorld,
},
{ name: "unknown world", context: unknownWorld, script: unknownWorld },
{
name: "contradictory worlds",
context: isolatedWorld,
script: defaultWorld,
},
{
name: "isolated script with default context",
context: defaultWorld,
script: isolatedWorld,
},
{
name: "worker context",
context: { ...unknownWorld, type: "worker" },
script: unknownWorld,
},
])(
"does not attribute $name to website execution or listeners",
async ({ context, script }) => {
const browser = await startRuntimeBrowser({
commandEvents: (command, origin) => {
if (command.method === "Runtime.enable")
return context === undefined
? []
: [
{
sessionId: "session-1",
method: "Runtime.executionContextCreated",
params: {
context: {
id: 1,
origin,
name: "reported-world",
auxData: context,
},
},
},
];
if (command.method === "Debugger.enable")
return ["script-a", "script-b"].map((scriptId) => ({
sessionId: "session-1",
method: "Debugger.scriptParsed",
params: {
scriptId,
url: `${origin}/same.js`,
executionContextId: 1,
executionContextAuxData: script,
startLine: 0,
startColumn: 0,
endLine: 1,
endColumn: 0,
},
}));
return undefined;
},
});
onTestFinished(() => browser.close());
const provider = new CdpWebRuntimeProvider();
const scope = {
cdp_endpoint: browser.endpoint,
target_id: "allowed-page",
};
const execution = await provider.observeExecution(
observeWebExecutionInputSchema.parse({ ...scope, observation_ms: 5 }),
);
if (!execution.ok) throw execution.error;
expect(execution.value.coverage.scripts).toEqual([]);
expect(execution.value.coverage.excluded_scripts).toBe(3);
expect(execution.value.script_inventory.main_document_scripts).toBe(0);
const listeners = await provider.inspectEventListeners(
inspectWebEventListenersInputSchema.parse({
...scope,
selector: "#selected",
}),
);
if (!listeners.ok) throw listeners.error;
expect(listeners.value.listeners[0]?.location.source_association).toBe(
"unknown",
);
expect(listeners.value.sources[0]).toMatchObject({
source: { state: "excluded" },
});
expect(
listeners.value.sources[0]?.reported_script_context_aux_data,
).toEqual(script);
expect(listeners.value.sources[0]?.reported_execution_context).toEqual(
context === undefined
? null
: {
id: 1,
origin: new URL(browser.endpoint).origin,
name: "reported-world",
auxData: context,
},
);
expect(
browser.commands.filter(
({ method }) => method === "Debugger.getScriptSource",
),
).toEqual([]);
},
);
});
@@ -0,0 +1,35 @@
import { execFile } from "node:child_process";
import { promisify } from "node:util";
import { expect, it } from "vitest";
it("attempts every fixture cleanup and retains the primary capture failure", async () => {
const helper = new URL(
"../../../scripts/lib/browser-runtime-fixture-lifecycle.mjs",
import.meta.url,
);
const script = `
const { closeRuntimeFixtureResources } = await import(${JSON.stringify(helper.href)});
const seen = [];
try {
await closeRuntimeFixtureResources([
async () => { seen.push('first'); throw new Error('first cleanup failed'); },
async () => { seen.push('second'); throw new Error('second cleanup failed'); },
async () => { seen.push('third'); },
], new Error('capture failed'));
throw new Error('Expected aggregate cleanup failure');
} catch (error) {
if (!(error instanceof AggregateError)) throw error;
console.log(JSON.stringify({ seen, errors: error.errors.map(item => item.message) }));
}
`;
const { stdout } = await promisify(execFile)(
process.execPath,
["--input-type=module", "-e", script],
{ timeout: 10_000 },
);
const result: unknown = JSON.parse(stdout);
expect(result).toEqual({
seen: ["first", "second", "third"],
errors: ["capture failed", "first cleanup failed", "second cleanup failed"],
});
});
@@ -6,7 +6,7 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import { writeAnalysisSnapshot } from "../../../src/application/binary/AnalysisSnapshotFiles.js";
import { runDirectAnalysis } from "../../../src/application/DirectAnalysis.js";
import { runDirectAnalysis } from "../../../src/composition/directAnalysis.js";
import type { AnalysisSnapshot } from "../../../src/domain/analysisSnapshot.js";
import {
snapshotBinding,
@@ -11,7 +11,7 @@ import { describe, expect, it } from "vitest";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import { runProviderAnalysis } from "../../../src/application/DirectAnalysis.js";
import { runProviderAnalysis } from "../../../src/composition/directAnalysis.js";
import { parseEvidence } from "../../../src/domain/evidence.js";
import {
identifyRuntimes,
@@ -5,7 +5,7 @@ import { expect, it } from "vitest";
import { z } from "zod";
import { parseConfig } from "../../../src/config.js";
import { createBinarySession } from "../../../src/application/runtime.js";
import { createBinarySession } from "../../../src/composition/binary.js";
import { createServer } from "../../../src/server/createServer.js";
import { artifactInspectionResultSchema } from "../../../src/domain/artifactInspection.js";
import { artifactInventoryResultSchema } from "../../../src/domain/artifactGraph.js";
@@ -6,7 +6,7 @@ import { TextReader, Uint8ArrayWriter, ZipWriter } from "@zip.js/zip.js";
import { expect, it } from "vitest";
import { z } from "zod";
import { parseConfig } from "../../../src/config.js";
import { createBinarySession } from "../../../src/application/runtime.js";
import { createBinarySession } from "../../../src/composition/binary.js";
import { keyedArchiveResultSchema } from "../../../src/domain/apple/keyedArchive.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
@@ -10,7 +10,7 @@ import {
} from "@zip.js/zip.js";
import { afterEach, expect, it } from "vitest";
import { runProviderAnalysis } from "../../../src/application/DirectAnalysis.js";
import { runProviderAnalysis } from "../../../src/composition/directAnalysis.js";
import { parseEvidence } from "../../../src/domain/evidence.js";
import { createTestBinarySession } from "../../fixtures/binarySession.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
+1 -1
View File
@@ -4,7 +4,7 @@ import { join } from "node:path";
import { describe, expect } from "vitest";
import { z } from "zod";
import { createBinarySession } from "../../../src/application/runtime.js";
import { createBinarySession } from "../../../src/composition/binary.js";
import { parseConfig } from "../../../src/config.js";
import { createServer } from "../../../src/server/createServer.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
+1 -1
View File
@@ -2,7 +2,7 @@ import type { StdioServerHandle } from "@modelcontextprotocol/server/stdio";
import pino from "pino";
import { expect, it } from "vitest";
import { createManagedBinarySession } from "../../../src/application/runtime.js";
import { createManagedBinarySession } from "../../../src/composition/binary.js";
import { MCP_SHUTDOWN_FAILED } from "../../../src/main/messages.js";
import { createShutdown } from "../../../src/main/shutdown.js";
import type { RuntimeDependencies } from "../../../src/main/types.js";
+78
View File
@@ -0,0 +1,78 @@
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
import { Ajv2020 } from "ajv/dist/2020.js";
import { expect, it, onTestFinished } from "vitest";
import { WebRuntimeService } from "../../../src/application/WebRuntimeService.js";
import { recordingWebRuntimePort } from "../../../src/application/WebRuntimeService.fixture.js";
import { toolContract } from "../../../src/contracts/toolContracts.js";
import { parseEvidence } from "../../../src/domain/evidence.js";
import { createServer } from "../../../src/server/createServer.js";
import { createTestBinarySession } from "../../fixtures/binarySession.js";
it("advertises actual SDK schemas, instrumentation effects and session-owned inline runtime evidence", async () => {
const session = createTestBinarySession(() => {
throw new Error("Binary provider must not start");
});
const server = createServer(session, session, {
webRuntime: new WebRuntimeService(recordingWebRuntimePort()),
});
const client = new Client({ name: "web-runtime-contract", version: "1" });
onTestFinished(async () => {
await client.close();
await server.close();
await session.close();
});
const [clientTransport, serverTransport] =
InMemoryTransport.createLinkedPair();
await server.connect(serverTransport);
await client.connect(clientTransport);
const tools = (await client.listTools()).tools;
const ajv = new Ajv2020({ strict: false, validateFormats: false });
const input = {
cdp_endpoint: "http://127.0.0.1:9222",
target_id: "allowed-page",
observation_ms: 5,
};
for (const name of [
"observe_web_execution",
"inspect_web_event_listeners",
] as const) {
const advertised = tools.find((tool) => tool.name === name);
if (advertised?.outputSchema === undefined)
throw new Error(`Missing advertised runtime schemas: ${name}`);
const inputSchema: Record<string, unknown> = advertised.inputSchema;
const outputSchema: Record<string, unknown> = advertised.outputSchema;
expect(ajv.validateSchema(inputSchema)).toBe(true);
expect(ajv.validateSchema(outputSchema)).toBe(true);
const args =
name === "observe_web_execution"
? input
: {
cdp_endpoint: "http://127.0.0.1:9222",
target_id: "allowed-page",
selector: "#selected",
};
expect(ajv.validate(inputSchema, args)).toBe(true);
const response = await client.callTool({ name, arguments: args });
expect(response.isError).not.toBe(true);
expect(
ajv.validate(outputSchema, response.structuredContent),
JSON.stringify(ajv.errors),
).toBe(true);
const parsed = toolContract(name).outputSchema.parse(
response.structuredContent,
);
const evidence = parseEvidence(parsed.evidence);
expect(parsed.result).toEqual(evidence.normalized_result);
expect(session.evidenceById(evidence.evidence_id)).toEqual(evidence);
}
expect(toolContract("observe_web_execution").effects).toMatchObject({
mutatesTarget: true,
mayDiscardData: true,
idempotent: false,
});
const invalid = await client.callTool({
name: "observe_web_execution",
arguments: { ...input, observation_ms: 2_147_483_648 },
});
expect(invalid.isError).toBe(true);
});
@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";
import { runProviderAnalysis } from "../../../../src/application/DirectAnalysis.js";
import { runProviderAnalysis } from "../../../../src/composition/directAnalysis.js";
import { parseEvidence } from "../../../../src/domain/evidence.js";
import { buildManagedPeFixture } from "../../../../src/dotnet/ManagedPe.fixture.js";
@@ -7,7 +7,7 @@ import { describe, expect, it } from "vitest";
import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";
import { runProviderAnalysis } from "../../../../src/application/DirectAnalysis.js";
import { runProviderAnalysis } from "../../../../src/composition/directAnalysis.js";
import { ArtifactProvider } from "../../../../src/artifacts/ArtifactProvider.js";
import { artifactInventoryResultSchema } from "../../../../src/domain/artifactGraph.js";
import { artifactInspectionResultSchema } from "../../../../src/domain/artifactInspection.js";
@@ -6,7 +6,7 @@ import { describe, expect, it } from "vitest";
import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";
import { runProviderAnalysis } from "../../../../src/application/DirectAnalysis.js";
import { runProviderAnalysis } from "../../../../src/composition/directAnalysis.js";
import {
ArtifactPathRegistry,
normalizeArtifactPath,
@@ -5,7 +5,7 @@ import { createPackageWithOptions } from "@electron/asar";
import { expect, it } from "vitest";
import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";
import { runProviderAnalysis } from "../../../../src/application/DirectAnalysis.js";
import { runProviderAnalysis } from "../../../../src/composition/directAnalysis.js";
import { artifactInspectionResultSchema } from "../../../../src/domain/artifactInspection.js";
import { parseEvidence } from "../../../../src/domain/evidence.js";