Skip to content

Port upstream 0.68.0: dashboard usage display control - #680

Closed
Finesssee wants to merge 1 commit into
port/upstream-0.68.0from
port/micro-0.68.0-dashboard-usage-display
Closed

Finesssee wants to merge 1 commit into
port/upstream-0.68.0from
port/micro-0.68.0-dashboard-usage-display

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

The codexbar serve dashboard page gets a header "Usage display" control (Follow server, Used, Remaining).

  • Follow server keeps the current behavior (host.usageBarsShowUsed); Used / Remaining override it for this browser.
  • The choice is stored in localStorage["codexbar.dashboard.usageDisplay"]. Only used and remaining are accepted; anything else, a throwing getItem, or unavailable storage yields server. Choosing server removes the key. Storage errors are swallowed and the selection still applies to the page.
  • Changing the control re-renders providers from the cached snapshot without a refetch; it does not touch the error banner, stale state, token, or snapshot cache.
  • Bar severity now follows consumption in every mode (usedPercent: 70 warn, 90 full). Before, pctClass received the displayed value, so 95% left rendered red. The label and bar width still follow the displayed value.
  • Snapshots without host or remainingPercent still default to remaining, deriving 100 - usedPercent.
  • Also fixed a latent ordering bug: state.snapshot was assigned after rows were built, so rows read the previous snapshot's host preference. It is now assigned before rendering.
  • No external assets, no new dependencies, payload unchanged.

Upstream reference

  • Release 0.68.0, dashboard usage display preference.
  • Tag-pinned (v0.68.0): Sources/CodexBarCLI/CLIServeWebUI+HTML.swift (usageDisplayKey, storedUsageDisplay(), changeUsageDisplay(), renderWindow).
  • Local: rust/src/cli/serve/dashboard/dashboard.html, html.rs, docs/CLI.md.

Ported / Deferred

  • Ported: everything in the spec above.
  • Deferred: upstream's worstWindowLevel provider/account pill is not ported. The local dashboard has no such pill (its chip shows provider status), so there is nothing to change; severity for the bars is covered.

Validation

  • cargo +1.98.0 fmt --all: clean
  • cargo +1.98.0 clippy --workspace --all-targets -- -D warnings: pass
  • cargo +1.98.0 test -p codexbar dashboard::html -- --test-threads=4: 14 passed (7 new)
  • cargo +1.98.0 test -p codexbar cli::serve -- --test-threads=4: 121 passed
  • Extracted the page script and ran it under Node with a stub DOM/storage: bogus stored value falls back to server; used/remaining switch label, width, and class without refetch; 95% left renders bar and 5% left renders bar full in remaining mode; a throwing storage still applies the selection.
  • Browser screenshots at 1280 px and 390 px were not captured by this agent; the header uses flex-wrap so the new control wraps at narrow widths.

Affected areas

  • Rust CLI (codexbar serve dashboard page)
  • Docs (docs/CLI.md)
  • Tray / settings / float bar / Tauri shell

UI proof

Not applicable for CUA (served web page, not a desktop surface). Pending: coordinator may capture a browser screenshot at 1280 px and 390 px.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2daf8b2c-7ee7-4b50-a934-ab1868aa6808

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Reviewed by Codex gpt-6-luna (xhigh); verified and validated by Claude

Thermo-nuclear review of PR #680 against the dashboard-usage-display spec (0.68.0). No source-code findings: behavior, tests, accessibility label, provider siloing and the unchanged bridge contract match the spec; no locale keys apply to this standalone English dashboard page. No code changes made, nothing pushed.

Left open (1, S3, not a code defect): the spec asks for 1280 px and 390 px screenshots and the PR notes they were not captured. They need a real rendered page, which this workflow does not produce (the app and browsers are not launched here); to be collected as UI proof by the coordinator.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Adversarial validation (lane-B review)

Head validated: 67ae0c63 ("Port upstream 0.68.0: add dashboard usage display control"). Spec: 0.68.0.md PR 4 (item #4, dashboard usage display, served page).

Verdict: no blocking defects. Spec conformance verified at head:

  • The served dashboard gains a Used/Remaining display selector (<select id="usage-display"> with a proper display-preference label), offering both values; the selection is stored in localStorage under codexbar.dashboard.usageDisplay (defensive read: stored value that parses to neither option falls back to the default).
  • One selected value drives label text, bar geometry and aria attributes (usage_bar_display_uses_one_selected_value_for_label_geometry_and_aria), and changing the preference re-renders the cached snapshot without a refetch.

Validation re-run at head (pinned 1.98.0, E-cores): cargo +1.98.0 fmt --all -- --check clean; cargo +1.98.0 clippy --workspace --all-targets -- -D warnings clean; cargo +1.98.0 test -p codexbar --lib 2166 passed / 0 failed (1 ignored; focused dashboard 85/85); cargo +1.98.0 test -p codexbar-desktop-tauri 461 passed / 1 failed (the documented #684 bootstrap_payload_exposes_every_provider_variant baseline, untouched by this backend/serve-only diff; no frontend app files changed).

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Shipped in v0.70.0: this PR's head is included in main via #735 (merge commit 9d0a37a). Closing as integrated.

@Finesssee Finesssee closed this Oct 3, 2026
junglesub-bot Bot pushed a commit to junglesub/Win-CodexBar that referenced this pull request Oct 4, 2026
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.

1 participant