From 89317a39fab23df81efa4331311d09d2110377bd Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Wed, 4 Nov 2026 20:43:04 +0800 Subject: [PATCH] fix(javascript): remove duplicate childNodes import (#8886) * fix(javascript): remove duplicate childNodes import The squash of #7967 re-added the import already introduced in afc18131f, so typecheck failed with TS2300. * test(gdb): expect the command-output cap limitation The retained-record limitation now names the command-output setting. The coverage assertion still required the previous fixed-cap sentence. * test(cli): keep rejected mcp add values off Amp settings mcp add now rejects a flag in the --command value position. The Amp registration test still treated that invocation as a successful selection. --------- Co-authored-by: Cursor Agent --- .../electronCallPathBlockPrefixes.ts | 2 -- .../cli/defaultAmpRegistration.test.ts | 25 +++++++++++++++---- .../GdbSessionManagerCoverage.test.ts | 9 +++++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/domain/javascript/electronCallPathBlockPrefixes.ts b/src/domain/javascript/electronCallPathBlockPrefixes.ts index 05887cee92..8df1bc04e4 100644 --- a/src/domain/javascript/electronCallPathBlockPrefixes.ts +++ b/src/domain/javascript/electronCallPathBlockPrefixes.ts @@ -1,8 +1,6 @@ import * as t from "@babel/types"; import { childNodes } from "./javascriptSemanticTraversal.js"; -import { childNodes } from "./javascriptSemanticTraversal.js"; - /** Syntax alone can establish an exit, but never a branch's contextual truth. */ export type ElectronStatementFallthrough = | { readonly kind: "exit" } diff --git a/tests/boundary/cli/defaultAmpRegistration.test.ts b/tests/boundary/cli/defaultAmpRegistration.test.ts index 0531cbba8d..e52271e21a 100644 --- a/tests/boundary/cli/defaultAmpRegistration.test.ts +++ b/tests/boundary/cli/defaultAmpRegistration.test.ts @@ -170,13 +170,12 @@ cliTest( "non-Amp selections, command values and discovery do not touch Amp settings", async ({ cli }) => { const f = await fixture("broken JSON\n"); - for (const selection of [ + const selections = [ ["--agent", "claude-code"], ["--agent=claude-code"], ["--agent", "cursor", "--agent", "claude-code"], - ["--command", "--agent", "amp", "--agent", "claude-code"], - ["-c", "--agent", "amp", "--agent", "claude-code"], - ]) { + ]; + for (const selection of selections) { const result = await cli.run({ arguments: ["mcp", "add", ...selection, "--json"], cwd: f.home, @@ -187,8 +186,24 @@ cliTest( expect(await readFile(f.settings, "utf8")).toBe("broken JSON\n"); expect(await readdir(f.directory)).toEqual(["settings.json"]); } + // A following flag is not a command value. Reject it before Amp settings. + for (const selection of [ + ["--command", "--agent", "amp", "--agent", "claude-code"], + ["-c", "--agent", "amp", "--agent", "claude-code"], + ]) { + const result = await cli.run({ + arguments: ["mcp", "add", ...selection, "--json"], + cwd: f.home, + environment: f.environment, + timeoutMs: 20_000, + }); + expect(result.exitCode, result.stdout).toBe(1); + expect(result.stdout).toContain("Missing value for flag:"); + expect(await readFile(f.settings, "utf8")).toBe("broken JSON\n"); + expect(await readdir(f.directory)).toEqual(["settings.json"]); + } const calls = (await readFile(f.log, "utf8")).trim().split("\n"); - expect(calls).toHaveLength(5); + expect(calls).toHaveLength(selections.length); for (const line of calls) expect(JSON.parse(line)).toContain("claude-code"); await writeFile(f.log, ""); for (const flag of [ diff --git a/tests/boundary/providers/GdbSessionManagerCoverage.test.ts b/tests/boundary/providers/GdbSessionManagerCoverage.test.ts index 5d0adde808..bf0d0754e3 100644 --- a/tests/boundary/providers/GdbSessionManagerCoverage.test.ts +++ b/tests/boundary/providers/GdbSessionManagerCoverage.test.ts @@ -28,10 +28,14 @@ import type { import { DEBUGGER_COMMAND_DEADLINE_SETTING, DEBUGGER_MAX_COMMAND_OUTPUT_BYTES_SETTING, + DEFAULT_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES_LIMIT, } from "../../../src/config/debuggerSessionLimits.js"; import { DEFAULT_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES } from "../../../src/domain/analysisResourceLimits.js"; import { projectAnalysisError } from "../../../src/domain/analysisErrorProjection.js"; -import { stopOwnedDebuggerProcess } from "../../../src/process/ownedDebuggerSession.js"; +import { + debuggerAdmissionRecovery, + stopOwnedDebuggerProcess, +} from "../../../src/process/ownedDebuggerSession.js"; import { parseLinuxProcessStat } from "../../../src/process/LinuxProcessStat.js"; import { expectGdbSessionStarted } from "./gdbTestHelpers.js"; @@ -3672,8 +3676,9 @@ it("keeps the session usable after an oversized stream record is dropped", async expect(executed.value.result.console).toContain("before"); expect(executed.value.result.completion_status).toBe("complete"); expect(executed.value.result.output_truncated).toBe(true); + const output = DEFAULT_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES_LIMIT; expect(executed.value.evidence.limitations.join(" ")).toContain( - "Retained MI records reached the 16777216 byte or 16384 record cap. This release has no runtime override. Output completeness is unknown.", + `Retained MI records reached the ${String(output.value)} byte command-output cap or the 16384 record cap. ${debuggerAdmissionRecovery(output)} The record cap has no separate setting. Output completeness is unknown.`, ); } const second = await manager.execute(started.value.session_id, "after-drop");