From 282b6e0e864627f0cca41ffe7853eb63f6f8b087 Mon Sep 17 00:00:00 2001 From: Rodin Date: Fri, 15 May 2026 08:00:27 -0700 Subject: [PATCH] nit(#154): add t.Fatal guard if baseSubprocessArgs flag not found Address sonnet NIT: if --repo or --pr is ever removed from baseSubprocessArgs(), the mutation loop silently no-ops and the test becomes meaningless. Adding a found guard and t.Fatal makes the regression immediately visible. --- cmd/review-bot/main_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/review-bot/main_test.go b/cmd/review-bot/main_test.go index db6d536..540dd5b 100644 --- a/cmd/review-bot/main_test.go +++ b/cmd/review-bot/main_test.go @@ -903,12 +903,17 @@ func TestMainSubprocess_InvalidRepo(t *testing.T) { flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError) args := baseSubprocessArgs() // Replace the canonical --repo value with an invalid one. + found := false for i, a := range args { if a == "--repo" && i+1 < len(args) { args[i+1] = "invalidrepo" + found = true break } } + if !found { + t.Fatal("baseSubprocessArgs() does not contain --repo; test is broken") + } os.Args = args main() return @@ -930,12 +935,17 @@ func TestMainSubprocess_InvalidPRNumber(t *testing.T) { flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError) args := baseSubprocessArgs() // Replace the canonical --pr value with a non-numeric string. + found := false for i, a := range args { if a == "--pr" && i+1 < len(args) { args[i+1] = "notanumber" + found = true break } } + if !found { + t.Fatal("baseSubprocessArgs() does not contain --pr; test is broken") + } os.Args = args main() return -- 2.47.3