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:
morluto
2026-10-12 12:37:00 +08:00
parent 48c352b6bf
commit e55ef72135
23 changed files with 249 additions and 40 deletions
+6 -1
View File
@@ -43,7 +43,12 @@ const electronTargetSchema = z.object({
type: z.string(),
title: z.string(),
file_path: z.string(),
attached: z.boolean(),
attached: z
.boolean()
.nullable()
.describe(
"Discovery-reported debugger attachment state; null means unknown",
),
});
/** Complete local file target inventory from one Electron CDP endpoint. */
@@ -89,7 +89,12 @@ export type JavaScriptRuntimeTargetLocation = z.infer<
const javascriptRuntimeTargetSchema = z.strictObject({
target_id: z.string().min(1),
protocol_type: z.string().min(1),
attached: z.boolean(),
attached: z
.boolean()
.nullable()
.describe(
"Discovery-reported debugger attachment state; null means unknown",
),
location: javascriptRuntimeTargetLocationSchema,
});
@@ -44,21 +44,21 @@ interface NormalizedV8Inspection {
readonly target_id: string;
readonly type: string;
readonly title: string;
readonly attached: boolean;
readonly attached: boolean | null;
readonly file_path: string;
}
| {
readonly target_id: string;
readonly type: string;
readonly title: string;
readonly attached: boolean;
readonly attached: boolean | null;
readonly url: string;
}
| {
readonly target_id: string;
readonly type: string;
readonly title: string;
readonly attached: boolean;
readonly attached: boolean | null;
readonly unresolved_location: Extract<
JavaScriptRuntimeObservation["target"]["location"],
{ kind: "unresolved" }