fix(runtime)!: preserve unknown debugger attachment state
Keep omitted discovery attachment state as null through Node, browser, Electron, and reconciliation evidence. Report the uncertainty while retaining Node observation unless discovery explicitly marks the target attached. Reject worker TargetInfo records missing the required boolean with partial coverage. Validate omitted and explicit states through provider, CLI, and MCP boundaries and real Node 24 Inspector workflows. Consolidate Electron regression coverage into the existing list-and-inspect workflow. BREAKING CHANGE: attached fields in JavaScript runtime, browser, and Electron target discovery and inspection results may be null when discovery does not report attachment state.
This commit is contained in:
@@ -107,6 +107,11 @@ export class CdpBrowserProvider implements BrowserObservationPort {
|
||||
: [
|
||||
`${String(selected.unconnectable)} otherwise allowed page target(s) lacked a validated direct CDP WebSocket and were excluded.`,
|
||||
]),
|
||||
...(selected.allowed.some((target) => target.attached === null)
|
||||
? [
|
||||
"CDP discovery omitted attachment state for one or more targets; attached is reported as unknown.",
|
||||
]
|
||||
: []),
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -57,6 +57,11 @@ export const inspectCdpElectronPage = async (
|
||||
"Local file paths exposed by the selected CDP target are retained in the observation.",
|
||||
"REA does not evaluate renderer JavaScript, invoke Electron APIs, navigate, click, or close the page.",
|
||||
"Select include_script_sources to retain script contents.",
|
||||
...(context.target.attached === null
|
||||
? [
|
||||
"CDP discovery omitted the target attachment state; attached is reported as unknown.",
|
||||
]
|
||||
: []),
|
||||
],
|
||||
mainFrameId: undefined,
|
||||
navigationDuringCapture: false,
|
||||
|
||||
@@ -91,6 +91,11 @@ export class CdpElectronProvider implements ElectronObservationPort {
|
||||
: [
|
||||
`${String(unconnectable)} otherwise allowed page target(s) lacked a validated direct CDP WebSocket and were excluded.`,
|
||||
]),
|
||||
...(allowed.some((target) => target.attached === null)
|
||||
? [
|
||||
"CDP discovery omitted attachment state for one or more targets; attached is reported as unknown.",
|
||||
]
|
||||
: []),
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -61,11 +61,15 @@ export const captureElectronWorkers = async (input: {
|
||||
input.completeness.exclude("workers", "invalid_protocol_value");
|
||||
continue;
|
||||
}
|
||||
if (typeof target.attached !== "boolean") {
|
||||
input.completeness.exclude("workers", "invalid_protocol_value");
|
||||
continue;
|
||||
}
|
||||
workers.push({
|
||||
target_id: targetId,
|
||||
type,
|
||||
file_path: path,
|
||||
attached: target.attached === true,
|
||||
attached: target.attached,
|
||||
opener_target_id: openerTargetId,
|
||||
parent_frame_id: parentFrameId,
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ const endpointTargetSchema = z.object({
|
||||
type: z.string().min(1),
|
||||
title: z.string().default(""),
|
||||
url: z.string(),
|
||||
attached: z.boolean().default(false),
|
||||
attached: z.boolean().nullable().optional(),
|
||||
webSocketDebuggerUrl: z.string().min(1).optional(),
|
||||
});
|
||||
const endpointTargetsSchema = z.array(endpointTargetSchema);
|
||||
@@ -46,7 +46,7 @@ export interface CdpEndpointTarget {
|
||||
readonly type: string;
|
||||
readonly title: string;
|
||||
readonly url: string;
|
||||
readonly attached: boolean;
|
||||
readonly attached: boolean | null;
|
||||
readonly webSocket?: CdpPageWebSocketEndpoint;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ export const discoverCdpEndpoint = async (
|
||||
type: target.type,
|
||||
title: sanitizeTargetTitle(target.title, target.url),
|
||||
url: target.url,
|
||||
attached: target.attached,
|
||||
attached: target.attached ?? null,
|
||||
...targetWebSocket(endpoint, target, operation),
|
||||
})),
|
||||
};
|
||||
|
||||
@@ -84,6 +84,11 @@ export const capturePage = async (
|
||||
"Raw network headers, bodies, cookies, storage values, console objects, and WebSocket payloads are never retained; explicitly requested primitive console text is retained verbatim, while payload captures retain value-free shapes.",
|
||||
"Source maps are reported only as declarative URLs and are not fetched.",
|
||||
"URL-less scripts and console events without an allowed source URL are excluded because their origin cannot be proven.",
|
||||
...(context.target.attached === null
|
||||
? [
|
||||
"CDP discovery omitted the target attachment state; attached is reported as unknown.",
|
||||
]
|
||||
: []),
|
||||
],
|
||||
startedAt: new Date().toISOString(),
|
||||
};
|
||||
|
||||
@@ -55,12 +55,16 @@ export const captureWorkers = async (
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (typeof target.attached !== "boolean") {
|
||||
completeness.exclude("workers", "invalid_protocol_value");
|
||||
continue;
|
||||
}
|
||||
items.push({
|
||||
target_id: cdpStringValue(target.targetId) ?? "",
|
||||
type,
|
||||
url: url.url,
|
||||
origin: url.origin,
|
||||
attached: target.attached === true,
|
||||
attached: target.attached,
|
||||
opener_target_id: cdpStringValue(target.openerId) ?? null,
|
||||
parent_frame_id: cdpStringValue(target.parentFrameId) ?? null,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user