Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

opt_selector enabled multiple labels#753

Merged
mangelajo merged 4 commits intojumpstarter-dev:mainfrom
evakhoni:multi_selector
Nov 27, 2025
Merged

opt_selector enabled multiple labels#753
mangelajo merged 4 commits intojumpstarter-dev:mainfrom
evakhoni:multi_selector

Conversation

@evakhoni
Copy link
Copy Markdown
Contributor

@evakhoni evakhoni commented Nov 27, 2025

this is a bug fix for closing issue https://github.com/jumpstarter-dev/jumpstarter/issues/732 for multiple label selectors

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Selector option now supports multiple selections, letting you specify the option repeatedly to capture several values.
    • Multiple selector values are combined into a single comma-separated string for simpler downstream use and display.

✏️ Tip: You can customize this high-level summary in your review settings.

@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 27, 2025

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit c8841df
🔍 Latest deploy log https://app.netlify.com/projects/jumpstarter-docs/deploys/692877b99d0f5d00087a4be7
😎 Deploy Preview https://deploy-preview-753--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 27, 2025

Walkthrough

Added a private callback _opt_selector_callback(ctx, param, value) that joins multiple selector values into a comma-separated string. The opt_selector Click option was changed to multiple=True and now uses this callback; its help text was updated to indicate multiple uses.

Changes

Cohort / File(s) Summary
Selector option enhancement
packages/jumpstarter-cli/jumpstarter_cli/common.py
Added _opt_selector_callback(ctx, param, value) to aggregate multiple selector values into a comma-separated string; updated opt_selector to multiple=True and callback=_opt_selector_callback; refreshed help text to reflect multi-use behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify callback correctly joins values and handles empty/None inputs.
  • Confirm Click multiple=True interacts properly with the callback and downstream code expecting a string.
  • Check updated help text appears correctly in CLI help output.

Poem

🐰
A selector once single, now multiple and spry,
I gather the choices and stitch them with a sigh.
Commas connect hops across every row,
The CLI now dances — onward we go! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: enabling the opt_selector option to accept multiple labels, which is directly reflected in the code changes (adding multiple=True and a callback).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e1f4972 and d2c7044.

📒 Files selected for processing (1)
  • packages/jumpstarter-cli/jumpstarter_cli/common.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/jumpstarter-cli/jumpstarter_cli/common.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Redirect rules - jumpstarter-docs
  • GitHub Check: Header rules - jumpstarter-docs
  • GitHub Check: Pages changed - jumpstarter-docs
  • GitHub Check: build
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.13)
  • GitHub Check: e2e
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.11)
  • GitHub Check: pytest-matrix (macos-15, 3.12)
  • GitHub Check: pytest-matrix (macos-15, 3.11)
  • GitHub Check: pytest-matrix (macos-15, 3.13)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.12)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/jumpstarter-cli/jumpstarter_cli/common.py (1)

9-11: Selector callback behavior looks correct; consider marking unused args.

Joining the multiple=True values into a single comma-separated string and returning None when empty keeps the CLI semantics consistent and should fix the multi-label bug without breaking existing single-usage callers.

Minor: ctx and param are unused here and may trigger Ruff’s unused-argument rules. You could rename them to _ctx / _param to keep linters happy:

-def _opt_selector_callback(ctx, param, value):
+def _opt_selector_callback(_ctx, _param, value):
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf8aa0d and e1f4972.

📒 Files selected for processing (1)
  • packages/jumpstarter-cli/jumpstarter_cli/common.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Ruff should be used for code formatting and linting, excluding jumpstarter-protocol package

Files:

  • packages/jumpstarter-cli/jumpstarter_cli/common.py
🧬 Code graph analysis (1)
packages/jumpstarter-cli/jumpstarter_cli/common.py (2)
packages/jumpstarter-cli-common/jumpstarter_cli_common/opt.py (1)
  • callback (224-225)
packages/jumpstarter-cli-common/jumpstarter_cli_common/config.py (1)
  • callback (22-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Redirect rules - jumpstarter-docs
  • GitHub Check: Header rules - jumpstarter-docs
  • GitHub Check: Pages changed - jumpstarter-docs
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.13)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.11)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.12)
  • GitHub Check: build
  • GitHub Check: e2e
🔇 Additional comments (1)
packages/jumpstarter-cli/jumpstarter_cli/common.py (1)

15-18: opt_selector multi-value wiring and help text are aligned with the intended behavior.

Enabling multiple=True and feeding the tuple through _opt_selector_callback to get a single comma-joined selector string matches the documented behavior (“Can be specified multiple times”) and preserves backward compatibility for existing --selector key1=value1,key2=value2 invocations.

No functional issues spotted here; just ensure any downstream parsing logic expects a single comma-separated string, which this change still provides.

@mangelajo mangelajo enabled auto-merge November 27, 2025 15:32
@mangelajo
Copy link
Copy Markdown
Member

tested manually, it works :D

@evakhoni
Copy link
Copy Markdown
Contributor Author

evakhoni commented Nov 27, 2025

thanks @mangelajo
tested locally as well, works with single selector: -l enabled=true
multiple selectors: -l enabled=true -l board-type=sometype
none, and multiple with some comma separated while others are not:
-l enabled=true,firmware=someversion --selector board-type=anothertype
all works as expected.

auto-merge was automatically disabled November 27, 2025 15:50

Head branch was pushed to by a user without write access

@mangelajo mangelajo enabled auto-merge November 27, 2025 16:09
@mangelajo mangelajo merged commit ec806a0 into jumpstarter-dev:main Nov 27, 2025
18 checks passed
@evakhoni evakhoni deleted the multi_selector branch November 27, 2025 16:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants