Add Exact and Calm information modes to the floating bar (SOU-178)#45
Add Exact and Calm information modes to the floating bar (SOU-178)#45tsouth89 wants to merge 4 commits into
Conversation
Adds the Exact/Calm information-mode setting (separate from density) with
safe migration, and the pure Calm presentation logic. No rendering yet;
Exact stays the default so existing bars are unchanged.
- settings: float_bar_information_mode ("exact"|"calm"), default exact,
normalized (unknown/older -> exact, never silently calm), threaded
through raw loader, floatbar SettingsPatch, bridge snapshot/update, and
TS types. Settings default/normalization/round-trip tests.
- capacityPresentation.calmPresentation(): trustworthy pace state only
when the snapshot is live and pace is actually supported (never invents
"on pace"); falls back to next reset, then to exact %. Unit tests cover
every branch (steady / running-low-with-eta / no-eta-silent / missing /
stale / errored / reset-vs-exact fallback).
Wires the Exact/Calm information mode into the float bar and settings.
- FloatBar: Calm pills lead with the trustworthy pace state ("On pace" /
"Running low") and the next reset of the displayed window; the exact %
is revealed on click/Enter (keyboard-accessible, not hover-only). The
Calm pill is a focusable button that opts out of the native drag region
(drag the bar by its handle) and stops propagation so a click never
starts a move. Usage-pressure tone (border) still shows, so a critical
provider isn't hidden; no new motion, so reduced-motion is unaffected.
- Settings: an "Information" select (Exact / Calm) in the float-bar
section, separate from Density (geometry).
- CSS: calm pace states (steady/watch) with light-bg overrides and a
focus ring.
- Tests: FloatBar renders the pace state, hides the exact % until expand,
and expands on click; every fixture carries the new setting.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds a persisted float-bar information mode with exact and calm options. Calm mode derives pace or reset presentation, supports expandable percentages, exposes a settings selector, and updates backend/frontend contracts, styling, and tests. ChangesFloat-bar information mode
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant SettingsSection
participant SettingsCommand
participant SettingsPatch
participant Settings
participant FloatBar
SettingsSection->>SettingsCommand: submit floatBarInformationMode
SettingsCommand->>SettingsPatch: create information_mode patch
SettingsPatch->>Settings: normalize and persist mode
Settings->>FloatBar: provide SettingsSnapshot
FloatBar->>FloatBar: render exact or calm presentation
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ceiling | cf77517 | Commit Preview URL Branch Preview URL |
Jul 18 2026, 01:25 AM |
Compact density hides the window/reset elements, which left the calm reset row with an orphan leading "·" separator, and in a narrow edge (no pace, a reset with no display time) could collapse the pill to just the provider icon. Calm now degrades cleanly in compact: it shows the pace state, or the exact % when there's no pace, and skips the window·reset row entirely — matching compact's minimal intent and guaranteeing a non-blank pill. Standard/detailed density are unchanged. Adds a compact-calm test.
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
rust/src/settings/tests.rs (1)
251-256: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winCover the missing-key migration path.
Add a case that deserializes an older settings object without
float_bar_information_modeand verifies it becomes"exact". This directly protects the backward-compatibility behavior promised by the serde default.🤖 Prompt for 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. In `@rust/src/settings/tests.rs` around lines 251 - 256, Add a test in the settings normalization tests that deserializes an older settings object omitting float_bar_information_mode, then assert the resulting setting is "exact". Reuse the existing serde deserialization path and fixtures or construction pattern in rust/src/settings/tests.rs to verify the missing-key default migration behavior.apps/desktop-tauri/src/floatbar/FloatBar.test.tsx (1)
253-264: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExercise Enter and Space activation.
The test verifies
roleandtabIndex, but not the newonKeyDownbehavior. Dispatch both activation keys and assert thataria-expandedand the exact percentage update.🤖 Prompt for 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. In `@apps/desktop-tauri/src/floatbar/FloatBar.test.tsx` around lines 253 - 264, Extend the calm pace pill test around the `.floatbar__pill--calm` element to dispatch both Enter and Space keyboard activation events, rather than only calling click. After each activation, assert `aria-expanded` reflects the expanded state and `.floatbar__pct--calm` contains the exact `60%` text, while preserving the existing role and tabindex assertions.
🤖 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 `@apps/desktop-tauri/src-tauri/src/commands/settings.rs`:
- Line 61: Update the notifies_float_bar() predicate to include
float_bar_information_mode alongside the existing FloatBar settings, so
mode-only changes emit the configuration event. Add a regression test covering
an Exact/Calm-only change and verify that it triggers notification.
In `@apps/desktop-tauri/src/floatbar/FloatBar.css`:
- Line 325: Update the border-left declaration in FloatBar.css to use the
Stylelint-compliant casing for the color-mix function keyword, preserving the
existing color values and border styling.
In `@apps/desktop-tauri/src/floatbar/FloatBar.tsx`:
- Around line 215-220: Update the floatbar accessibility label around the
titleBits/onToggleExpand props to use a Calm-specific label that includes the
visible pace/reset state and appends the exact percentage only when expanded;
retain titleBits as the fallback label for non-Calm cases. Apply the resulting
label consistently to aria-label while preserving aria-expanded behavior.
In `@apps/desktop-tauri/src/lib/capacityPresentation.ts`:
- Around line 259-269: The calmPresentation function ignores
PaceSnapshot.windowLabel, allowing pace data from one window to accompany
another window’s reset. Match the provider pace to the supplied window using the
stable window identifier, or set pace to null when they differ; update
apps/desktop-tauri/src/lib/capacityPresentation.ts lines 259-269 accordingly. In
apps/desktop-tauri/src/lib/capacityPresentation.test.ts lines 241-259, replace
the expectation that Weekly pace applies to Monthly and cover both matching and
mismatching window cases.
---
Nitpick comments:
In `@apps/desktop-tauri/src/floatbar/FloatBar.test.tsx`:
- Around line 253-264: Extend the calm pace pill test around the
`.floatbar__pill--calm` element to dispatch both Enter and Space keyboard
activation events, rather than only calling click. After each activation, assert
`aria-expanded` reflects the expanded state and `.floatbar__pct--calm` contains
the exact `60%` text, while preserving the existing role and tabindex
assertions.
In `@rust/src/settings/tests.rs`:
- Around line 251-256: Add a test in the settings normalization tests that
deserializes an older settings object omitting float_bar_information_mode, then
assert the resulting setting is "exact". Reuse the existing serde
deserialization path and fixtures or construction pattern in
rust/src/settings/tests.rs to verify the missing-key default migration behavior.
🪄 Autofix (Beta)
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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2a9ef25e-596d-482b-80ec-50a287debdea
📒 Files selected for processing (20)
apps/desktop-tauri/src-tauri/src/commands/bridge.rsapps/desktop-tauri/src-tauri/src/commands/settings.rsapps/desktop-tauri/src-tauri/src/floatbar/mod.rsapps/desktop-tauri/src/App.test.tsxapps/desktop-tauri/src/floatbar/FloatBar.cssapps/desktop-tauri/src/floatbar/FloatBar.test.tsxapps/desktop-tauri/src/floatbar/FloatBar.tsxapps/desktop-tauri/src/floatbar/SettingsSection.test.tsxapps/desktop-tauri/src/floatbar/SettingsSection.tsxapps/desktop-tauri/src/lib/capacityPresentation.test.tsapps/desktop-tauri/src/lib/capacityPresentation.tsapps/desktop-tauri/src/surfaces/PopOutPanel.test.tsxapps/desktop-tauri/src/surfaces/TrayPanel.test.tsxapps/desktop-tauri/src/surfaces/settings/tabs/AboutTab.test.tsxapps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsxapps/desktop-tauri/src/types/bridge.test.tsapps/desktop-tauri/src/types/bridge.tsrust/src/settings.rsrust/src/settings/raw.rsrust/src/settings/tests.rs
| pub float_bar_style: Option<String>, | ||
| pub taskbar_widget_open_on_hover: Option<bool>, | ||
| pub float_bar_density: Option<String>, | ||
| pub float_bar_information_mode: Option<String>, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Notify the detached FloatBar when information mode changes.
notifies_float_bar() does not check float_bar_information_mode. Therefore, changing only Exact/Calm can persist to Rust without emitting the configuration event that makes FloatBar.tsx re-fetch its snapshot, leaving the visible bar in the previous mode until another setting change or restart. Include this field in the predicate and add a mode-only update regression test.
Suggested fix
fn notifies_float_bar(&self) -> bool {
self.enabled_providers.is_some()
|| self.refresh_interval_secs.is_some()
|| self.codex_custom_sessions_dirs.is_some()
|| self.high_usage_threshold.is_some()
|| self.critical_usage_threshold.is_some()
|| self.provider_usage_thresholds.is_some()
|| self.show_as_used.is_some()
|| self.reset_time_relative.is_some()
|| self.show_reset_when_exhausted.is_some()
+ || self.float_bar_information_mode.is_some()
}🤖 Prompt for 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.
In `@apps/desktop-tauri/src-tauri/src/commands/settings.rs` at line 61, Update the
notifies_float_bar() predicate to include float_bar_information_mode alongside
the existing FloatBar settings, so mode-only changes emit the configuration
event. Add a regression test covering an Exact/Calm-only change and verify that
it triggers notification.
| .floatbar__pct--calm { | ||
| padding-left: calc(6px * var(--floatbar-scale, 1)); | ||
| margin-left: calc(2px * var(--floatbar-scale, 1)); | ||
| border-left: 1px solid color-mix(in srgb, currentColor 18%, transparent); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use the Stylelint-compliant keyword casing.
- border-left: 1px solid color-mix(in srgb, currentColor 18%, transparent);
+ border-left: 1px solid color-mix(in srgb, currentcolor 18%, transparent);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| border-left: 1px solid color-mix(in srgb, currentColor 18%, transparent); | |
| border-left: 1px solid color-mix(in srgb, currentcolor 18%, transparent); |
🧰 Tools
🪛 Stylelint (17.14.0)
[error] 325-325: Expected "currentColor" to be "currentcolor" (value-keyword-case)
(value-keyword-case)
🤖 Prompt for 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.
In `@apps/desktop-tauri/src/floatbar/FloatBar.css` at line 325, Update the
border-left declaration in FloatBar.css to use the Stylelint-compliant casing
for the color-mix function keyword, preserving the existing color values and
border styling.
Source: Linters/SAST tools
| title={titleBits} | ||
| role="button" | ||
| tabIndex={0} | ||
| aria-expanded={expanded} | ||
| aria-label={titleBits} | ||
| onClick={onToggleExpand} |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the accessible label reflect Calm mode and expansion.
titleBits always announces the exact percentage and never announces the visible pace state. Consequently, screen readers receive “60%” before expansion and cannot perceive what expansion revealed.
Build a Calm-specific label containing the pace/reset state, adding the exact percentage only when expanded or used as the fallback.
🤖 Prompt for 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.
In `@apps/desktop-tauri/src/floatbar/FloatBar.tsx` around lines 215 - 220, Update
the floatbar accessibility label around the titleBits/onToggleExpand props to
use a Calm-specific label that includes the visible pace/reset state and appends
the exact percentage only when expanded; retain titleBits as the fallback label
for non-Calm cases. Apply the resulting label consistently to aria-label while
preserving aria-expanded behavior.
| export function calmPresentation( | ||
| provider: ProviderUsageSnapshot, | ||
| window: ConstrainingWindow, | ||
| nowMs: number = Date.now(), | ||
| ): CalmPresentation { | ||
| const fresh = capacityFreshness(provider, nowMs) === "live"; | ||
| const pace = fresh && !provider.error ? calmPaceState(provider.pace) : null; | ||
| const hasReset = Boolean( | ||
| window.window.resetsAt || window.window.resetDescription, | ||
| ); | ||
| return { pace, window, hasReset, showExactFallback: !pace && !hasReset }; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Keep Calm pace and reset information tied to one window.
PaceSnapshot.windowLabel is ignored, allowing pace for one window to be presented with another window’s reset.
apps/desktop-tauri/src/lib/capacityPresentation.ts#L259-L269: match pace to the supplied window using a stable identifier, or suppress mismatched pace.apps/desktop-tauri/src/lib/capacityPresentation.test.ts#L241-L259: stop expectingWeeklypace to apply to the selectedMonthlywindow; cover both matching and mismatching cases.
📍 Affects 2 files
apps/desktop-tauri/src/lib/capacityPresentation.ts#L259-L269(this comment)apps/desktop-tauri/src/lib/capacityPresentation.test.ts#L241-L259
🤖 Prompt for 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.
In `@apps/desktop-tauri/src/lib/capacityPresentation.ts` around lines 259 - 269,
The calmPresentation function ignores PaceSnapshot.windowLabel, allowing pace
data from one window to accompany another window’s reset. Match the provider
pace to the supplied window using the stable window identifier, or set pace to
null when they differ; update apps/desktop-tauri/src/lib/capacityPresentation.ts
lines 259-269 accordingly. In
apps/desktop-tauri/src/lib/capacityPresentation.test.ts lines 241-259, replace
the expectation that Weekly pace applies to Monthly and cover both matching and
mismatching window cases.
- FloatBar calm pill: aria-label now reflects what's visible (provider, pace/reset state, and the exact % only once revealed) instead of always announcing the hidden percentage — screen readers and sighted users now perceive the same thing. aria-expanded still conveys the toggle state. - Add a regression test proving an information-mode-only change is a non-empty float-bar patch, so the detached bar is notified and re-fetches (after_settings_saved notifies on a non-empty patch — the reported notifies_float_bar() gap does not apply to patch-owned fields).
…es (#46) Collapses three reviewed passes onto current `main` (1.0.0-rc.1) as one clean merge, per the plan. Supersedes #43, #44, #45 (each fully reviewed by adversarial subagents + CodeRabbit; all findings addressed). Only conflict was the English-only `.ftl` removals, resolved by accepting the deletion. ## What's included - **Codex banked resets (#43):** explicit "0 avail" chip (Codex-only, all 3 surfaces); backend records `Some(0)` instead of hiding it. **Send test notification** button that runs the real Windows toast pipeline and reports success/failure. - **Explicit enforcement states — SOU-122 (#44):** `EnforcementState { Tracked, NotEnforced, Unavailable }` exposed to every surface without fabricating a %. A process-local, per-scope `EnforcementTracker` flags a core subscription window `unavailable` when it drops out of a successful response — sticky until it returns, core-windows-only (bonus pools never false-flag), scoped by provider|source|email|org, ignores errors. - **Exact & Calm floatbar modes — SOU-178 (#45):** `float_bar_information_mode` (Exact default, safe migration). Calm leads with a trustworthy pace state + next reset; exact % on keyboard/click expand. Pace claimed only when live and actually supported. ## Verification (against this main) - Rust `codexbar` lib **621**, desktop crate **372** — 0 failures - Frontend **246** (48 files); `tsc` clean; locale-drift OK (English-only) ## Review fixes folded in Sticky/core-only tracker (one-shot bug), org-scoped observations, compact-density calm layout, calm aria-label matching visible state. --------- Co-authored-by: tsouth89 <tsouth89@users.noreply.github.com>
|
Superseded by #46, which collapsed all three reviewed passes onto current main (1.0.0-rc.1) and merged. All findings from this PR's reviews were addressed there. |
Stacked on #44 → #43. Base retargets down the stack as each merges.
Gives users control over how much the always-on floating bar exposes, without conflating content with visual density. Exact stays the default, so existing bars are unchanged.
Behavior
Trust rules (per the issue)
Accessibility / preservation
role="button"(Tab + Enter/Space), so exact % isn't hover-only. It opts out of the native drag region and stops propagation so a click never starts a window move; drag the bar by its handle.Implementation
float_bar_information_mode("exact"|"calm"), default exact, normalized (unknown/older → exact, never silently calm), threaded through raw loader → floatbar SettingsPatch → bridge snapshot/update → TS types. An "Information" select in the float-bar settings.calmPresentation()holds the trust logic; the component only renders.Verification
codexbarlib 632, desktop crate 380 (incl. settings default/normalization/round-trip).tscclean; locale-drift OK.Summary by CodeRabbit
New Features
Tests