Compare commits

...

2 Commits

Author SHA1 Message Date
aweiker 89596516d7 Merge pull request 'refactor(#154): extract baseSubprocessArgs helper in main_test.go subprocess tests' (#155) from issue-154 into main
CI / test (push) Successful in 19s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (push) Has been skipped
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (push) Has been skipped
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (push) Has been skipped
Reviewed-on: #155
Reviewed-by: security-review-bot <10+security-review-bot@noreply.gitea.weiker.me>
Reviewed-by: Aaron Weiker <aaron@weiker.org>
2026-05-15 21:28:41 +00:00
Rodin 282b6e0e86 nit(#154): add t.Fatal guard if baseSubprocessArgs flag not found
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / test (pull_request) Successful in 17s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 22s
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 38s
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 40s
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.
2026-05-15 08:06:18 -07:00
+10
View File
@@ -903,12 +903,17 @@ func TestMainSubprocess_InvalidRepo(t *testing.T) {
flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError) flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
args := baseSubprocessArgs() args := baseSubprocessArgs()
// Replace the canonical --repo value with an invalid one. // Replace the canonical --repo value with an invalid one.
found := false
for i, a := range args { for i, a := range args {
if a == "--repo" && i+1 < len(args) { if a == "--repo" && i+1 < len(args) {
args[i+1] = "invalidrepo" args[i+1] = "invalidrepo"
found = true
break break
} }
} }
if !found {
t.Fatal("baseSubprocessArgs() does not contain --repo; test is broken")
}
os.Args = args os.Args = args
main() main()
return return
@@ -930,12 +935,17 @@ func TestMainSubprocess_InvalidPRNumber(t *testing.T) {
flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError) flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
args := baseSubprocessArgs() args := baseSubprocessArgs()
// Replace the canonical --pr value with a non-numeric string. // Replace the canonical --pr value with a non-numeric string.
found := false
for i, a := range args { for i, a := range args {
if a == "--pr" && i+1 < len(args) { if a == "--pr" && i+1 < len(args) {
args[i+1] = "notanumber" args[i+1] = "notanumber"
found = true
break break
} }
} }
if !found {
t.Fatal("baseSubprocessArgs() does not contain --pr; test is broken")
}
os.Args = args os.Args = args
main() main()
return return