Skip to content

cli: collapse --tag provided/value signals into one in browsers update#186

Merged
bmsaadat merged 2 commits into
mainfrom
bmsaadat/review-pasted-text
Jun 11, 2026
Merged

cli: collapse --tag provided/value signals into one in browsers update#186
bmsaadat merged 2 commits into
mainfrom
bmsaadat/review-pasted-text

Conversation

@bmsaadat

@bmsaadat bmsaadat commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

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")BrowsersUpdateInput.SetTags is renamed to TagsProvided and 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-name side 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 -l clean
  • go test ./... green (incl. TestBrowsersUpdate_*, TestTagsFromFlag_*, TestParseKeyValueSpecs)
  • CLI smoke: --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
tagsFromFlag now returns parsed tags plus a provided bool from pflag’s Changed, so an empty --tag= still counts as the user passing --tag (not a silent no-op).

browsers update wires that bool into BrowsersUpdateInput.TagsProvided (replacing SetTags and duplicate Changed("tag") in the runner). Validation for conflicting --clear-tags, all-malformed tags, and lone empty --tag still 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 add tagsCmdWithArgs and 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.

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-agent

Copy link
Copy Markdown

Firetiger deploy monitoring skipped

This PR didn't match the auto-monitor filter configured on your GitHub connection:

PRs in the kernel, infra, hypeman, and hypeship repos. kernel is a ~mono repo with many logical services underneath, ensure to focus on the implicated service for the PR

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 @firetiger monitor this.

@bmsaadat bmsaadat requested a review from Sayan- June 11, 2026 20:55

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread cmd/browsers.go Outdated
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>
@bmsaadat bmsaadat merged commit 638ef73 into main Jun 11, 2026
7 checks passed
@bmsaadat bmsaadat deleted the bmsaadat/review-pasted-text branch June 11, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants