cli: collapse --tag provided/value signals into one in browsers update#186
Conversation
tagsFromFlag now reports whether the --tag flag was provided (independent of
whether its values parsed), so runBrowsersUpdate no longer rebuilds that
signal via cmd.Flags().Changed("tag"). Renames BrowsersUpdateInput.SetTags
to TagsProvided, sourced from the helper, and updates the three other call
sites to discard the new bool. Behavior is unchanged and the name side is
left as-is. Non-blocking follow-up to PR #184.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Firetiger deploy monitoring skipped This PR didn't match the auto-monitor filter configured on your GitHub connection:
Reason: PR is in an unspecified repo; while it mentions CLI changes that could relate to kernel services, the repo name is not confirmed to be one of the four monitored repos (kernel, infra, hypeman, hypeship). To monitor this PR anyway, reply with |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 49f26e5. Configure here.
An empty `--tag=` leaves pflag's StringArray slice empty but still marks the flag Changed, so deriving "provided" from len(specs) > 0 regressed validation: `--tag= --clear-tags` silently cleared tags and a lone `--tag=` fell through to the generic "must specify at least one" error instead of being rejected. Source the provided signal from cmd.Flags().Changed (matching pre-refactor behavior), and exercise tagsFromFlag through real flag parsing plus an empty-value regression test instead of default-value injection. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Summary
tagsFromFlagnow reports whether the--tagflag was provided (independent of whether its values parsed), sorunBrowsersUpdateno longer rebuilds that signal viacmd.Flags().Changed("tag")—BrowsersUpdateInput.SetTagsis renamed toTagsProvidedand sourced from the helper, with the three other call sites discarding the new bool. This is a behavior-preserving structural cleanup (non-blocking follow-up to #184) that leaves the--name/--clear-nameside untouched, since it has no equivalent redundancy. Two helper tests were added to pin the newly-distinguished "absent" vs. "provided-but-all-malformed" states.Test plan
go build ./...,go vet ./cmd/,gofmt -lcleango test ./...green (incl.TestBrowsersUpdate_*,TestTagsFromFlag_*,TestParseKeyValueSpecs)--tag foo→ "No valid --tag KEY=VALUE pairs provided";--tag foo --clear-tags→ "Cannot specify both --tag and --clear-tags"🤖 Generated with Claude Code
Note
Low Risk
CLI-only flag parsing refactor with regression tests; intended to preserve browsers update validation behavior.
Overview
tagsFromFlagnow returns parsed tags plus aprovidedbool frompflag’sChanged, so an empty--tag=still counts as the user passing--tag(not a silent no-op).browsers updatewires that bool intoBrowsersUpdateInput.TagsProvided(replacingSetTagsand duplicateChanged("tag")in the runner). Validation for conflicting--clear-tags, all-malformed tags, and lone empty--tagstill keys off “flag was provided,” not only a non-empty map.List/create/acquire call sites adopt the new two-value return and ignore
provided. Tests addtagsCmdWithArgsand cases for absent flag, all-malformed, and empty--tag=.Reviewed by Cursor Bugbot for commit 282203a. Bugbot is set up for automated code reviews on this repo. Configure here.