From f6c1992dba0dbf60185d6d0e9b24b7643f3884df Mon Sep 17 00:00:00 2001 From: Udaya Tejas Date: Mon, 17 Aug 2026 23:56:51 -0700 Subject: [PATCH 1/2] fix(cli): accept every Git boolean for commit.gpgsign in the doctor The contributor doctor read `commit.gpgsign` with `git config --get` and compared the raw stored token against the literal string "true". Git's boolean grammar also accepts `1`, `yes`, `on`, case variants, and a valueless key, so a checkout that signs every commit correctly was reported as "Git commit signing is incomplete" and told to set `commit.gpgsign=true`, which was already in effect. The doctor exits non-zero on that failure, so `npm run dev:setup` stopped as well. Read the value with `git config --get --type=bool` and let Git normalize it. False values still normalize to `false`, and an unset or non-boolean value still yields an empty string, so both keep failing exactly as before. The fake `git` fixture now answers the raw `--get` with `1` and the `--type=bool` read with `true`, so every existing ready-environment case in test/dev-setup-doctor.test.ts fails if the doctor goes back to comparing the raw token. Signed-off-by: Udaya Tejas --- scripts/dev-setup.sh | 2 +- test/dev-setup-doctor.test.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/dev-setup.sh b/scripts/dev-setup.sh index 44dfd4afa96..209c0eb2e3f 100755 --- a/scripts/dev-setup.sh +++ b/scripts/dev-setup.sh @@ -446,7 +446,7 @@ check_git_configuration() { "Set repository-local user.name and user.email before committing." fi - sign_enabled="$(git_config commit.gpgsign)" + sign_enabled="$(git -C "${REPO_ROOT}" config --get --type=bool commit.gpgsign 2>/dev/null || true)" if ! sign_format="$(git -C "${REPO_ROOT}" config --get gpg.format 2>/dev/null)"; then sign_format="openpgp" fi diff --git a/test/dev-setup-doctor.test.ts b/test/dev-setup-doctor.test.ts index 7caf6f722d4..5eb64002f7a 100644 --- a/test/dev-setup-doctor.test.ts +++ b/test/dev-setup-doctor.test.ts @@ -174,10 +174,14 @@ fi`, if [ "\${FAKE_GIT_IDENTITY_MISSING:-}" = "1" ]; then exit 1; fi echo "contributor@example.com" ;; - *" config --get commit.gpgsign "*) + *" config --get --type=bool commit.gpgsign "*) if [ "\${FAKE_GIT_SIGNING_MISSING:-}" = "1" ]; then exit 1; fi echo "true" ;; + *" config --get commit.gpgsign "*) + if [ "\${FAKE_GIT_SIGNING_MISSING:-}" = "1" ]; then exit 1; fi + echo "1" + ;; *" config --get gpg.format "*) if [ "\${FAKE_GIT_SIGN_FORMAT_UNSET:-}" = "1" ]; then exit 1; fi echo "\${FAKE_GIT_SIGN_FORMAT-ssh}" From d046e391327756ca3aa086f25b7dfa64f05a2f89 Mon Sep 17 00:00:00 2001 From: Prekshi Vyas Date: Tue, 18 Aug 2026 12:19:23 -0700 Subject: [PATCH 2/2] test(dev): cover Git signing boolean failures Signed-off-by: Prekshi Vyas --- test/dev-setup-doctor.test.ts | 40 ++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/test/dev-setup-doctor.test.ts b/test/dev-setup-doctor.test.ts index 5eb64002f7a..46356bb7d93 100644 --- a/test/dev-setup-doctor.test.ts +++ b/test/dev-setup-doctor.test.ts @@ -176,7 +176,12 @@ fi`, ;; *" config --get --type=bool commit.gpgsign "*) if [ "\${FAKE_GIT_SIGNING_MISSING:-}" = "1" ]; then exit 1; fi - echo "true" + if [ "\${FAKE_GIT_SIGNING_UNSET:-}" = "1" ]; then exit 1; fi + if [ "\${FAKE_GIT_SIGNING_INVALID:-}" = "1" ]; then + echo "fatal: bad boolean config value" >&2 + exit 128 + fi + echo "\${FAKE_GIT_SIGNING_BOOL-true}" ;; *" config --get commit.gpgsign "*) if [ "\${FAKE_GIT_SIGNING_MISSING:-}" = "1" ]; then exit 1; fi @@ -448,6 +453,39 @@ describe("contributor environment doctor", () => { expect(result.output).toContain("Git pre-push hook is missing"); }); + it.each([ + ["disabled", { FAKE_GIT_SIGNING_BOOL: "false" }], + ["unset", { FAKE_GIT_SIGNING_UNSET: "1" }], + ["invalid", { FAKE_GIT_SIGNING_INVALID: "1" }], + ])("rejects %s commit signing", (_scenario, env) => { + const fixture = createFixture(); + + const result = runDoctor(fixture, env); + + expect(result.status).toBe(1); + expect(result.output).toContain("Git commit signing is incomplete"); + expect(result.output).not.toContain("Git commit signing configured"); + expect(result.output).not.toContain("Ready to create a feature branch."); + }); + + it.each([ + ["true", "commit.gpgsign=true"], + ["yes", "commit.gpgsign=yes"], + ["on", "commit.gpgsign=on"], + ["1", "commit.gpgsign=1"], + ["uppercase", "commit.gpgsign=TRUE"], + ["valueless", "commit.gpgsign"], + ])("lets Git normalize the %s commit-signing spelling", (_scenario, configArg) => { + const result = spawnSync( + "git", + ["-c", configArg, "config", "--get", "--type=bool", "commit.gpgsign"], + { encoding: "utf-8" }, + ); + + expect(result.status).toBe(0); + expect(result.stdout.trim()).toBe("true"); + }); + it("rejects an unsupported git signing format with a precise remediation", () => { const fixture = createFixture();