feat: use the AvailableModes API in cardwire-cli and -gui - #168
Conversation
|
Warning Review limit reached
Next review available in: 16 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe CLI and GUI now retrieve available modes from D-Bus and use them in commands, subscriptions, tray menus, and settings. Mode types support serialization and zbus typing. GUI configuration defaults to ChangesDynamic mode availability
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant GUI
participant CardwireDbus
participant CardwireDaemon
GUI->>CardwireDbus: fetch available modes
CardwireDbus->>CardwireDaemon: call AvailableModes
CardwireDaemon-->>CardwireDbus: return mode list
CardwireDbus-->>GUI: return modes or error
GUI->>GUI: update MainState and tray
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/cardwire-cli/src/main.rs`:
- Around line 75-82: The available-mode retrieval errors must not be hidden. At
crates/cardwire-cli/src/main.rs lines 75-82, update the get_available_modes flow
to pass failures through handle_error or emit a clear error and return a nonzero
status instead of producing "err"; at lines 251-258, apply the same explicit
error handling after refresh rather than silently omitting available modes.
In `@crates/cardwire-gui/src/ui.rs`:
- Around line 684-689: Update gui_setting_section and the primary-click mode
selection flow to pass available_modes into GuiConfig::next_primary_click_mode
(or its equivalent) and filter candidates against that list before producing
Message::SetMode. Ensure unavailable configured modes are skipped while
preserving selection among currently available modes.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: bb09ac76-8c76-46d7-bd83-c7ff1a8326da
📒 Files selected for processing (11)
crates/cardwire-cli/src/args.rscrates/cardwire-cli/src/dbus.rscrates/cardwire-cli/src/main.rscrates/cardwire-gui/src/app.rscrates/cardwire-gui/src/gui_config.rscrates/cardwire-gui/src/helpers/dbus.rscrates/cardwire-gui/src/message.rscrates/cardwire-gui/src/models.rscrates/cardwire-gui/src/subscription.rscrates/cardwire-gui/src/tray.rscrates/cardwire-gui/src/ui.rs
Description
Please include a summary of the changes and if applicable, a related issue.
If this PR introduce a new feature, explain your motivations
Fixes # (issue)
TODO
Checklist: