From 858aec28210c34d9cefda5685f34d6c9a48c3d0c Mon Sep 17 00:00:00 2001 From: Harsh Bhanushali Date: Tue, 13 Oct 2026 20:00:04 +0000 Subject: [PATCH] Fix false booleans in config file being parsed as true Options like `enable-remote-storage: false` in config.yaml are converted to `--enable-remote-storage=false`, but the parser set any boolean option to true regardless of its value. Booleans set to false are now ignored, the same way optional strings set to false already are. Fixes #8049 --- src/node/cli.ts | 6 +++++- test/unit/node/cli.test.ts | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/node/cli.ts b/src/node/cli.ts index 60e9fb78bde7..b7b71f471ddb 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -436,7 +436,11 @@ export const parse = ( const option = options[key] if (option.type === "boolean") { - ;(args[key] as boolean) = true + // Booleans set to false (for example `--flag=false`, which is also how + // false values from the config file are passed in) are ignored. + if (value !== "false") { + ;(args[key] as boolean) = true + } continue } diff --git a/test/unit/node/cli.test.ts b/test/unit/node/cli.test.ts index c4ed29ed33de..628dcd98fabf 100644 --- a/test/unit/node/cli.test.ts +++ b/test/unit/node/cli.test.ts @@ -578,6 +578,19 @@ describe("parser", () => { it("should ignore optional strings set to false", async () => { expect(parse(["--cert=false"])).toEqual({}) }) + it("should ignore booleans set to false", async () => { + expect(parse(["--disable-telemetry=false"])).toEqual({}) + }) + it("should parse booleans set to false in the config file", () => { + const configContents = ` + disable-telemetry: false + disable-update-check: true + ` + expect(parseConfigFile(configContents, "/fake-config-path")).toEqual({ + config: "/fake-config-path", + "disable-update-check": true, + }) + }) it("should use last flag", async () => { expect(parse(["--port", "8081", "--port", "8082"])).toEqual({ port: 8082,