Skip to content

Settings follow-ups: System language, quota warnings export, cost switches, thresholds, no email under HPI - #834

Merged
Finesssee merged 11 commits into
mainfrom
feat/settings-followups
Oct 12, 2026
Merged

Finesssee merged 11 commits into
mainfrom
feat/settings-followups

Conversation

@Finesssee

@Finesssee Finesssee commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Settings follow-ups for Mac parity. Each change is a separate commit.

  • Language: System (Q9). The Language picker gets a "System" option, listed first, as on the Mac. While it is selected, the app follows the Windows display language. New installs default to System. Settings files written before this change keep the language they had.

    • New setting ui_language_follows_system: true for new installs, false when an older settings.json doesn't have it.

    • The display language is read from HKCU, in this order:

      • Control Panel\Desktop PreferredUILanguages;
      • Control Panel\International\User Profile Languages;
      • Control Panel\Desktop\MuiCached MachinePreferredUILanguages.

      The first tag the app has a translation for wins. If none has one, the language is English, as on the Mac.

    • It is resolved at load, when System is picked, and after a preferences import. Choosing a specific language, from Settings or the tray menu, stops following the system.

    • The preferences export carries ui_language_follows_system. A file exported before this change has a ui_language but no follow flag. Importing it keeps its language.

  • Quota warnings in the preferences export (Rebuild the provider detail pane in the macOS layout with per-provider quota warnings #827). New portable key provider_quota_warnings, mapping provider id to {session, weekly}. The validator rejects:

    • unknown providers;
    • values that aren't integers from 0 to 100;
    • unknown fields.

    null resets the warnings and takes precedence over the legacy key.

  • Track costs off hides the cost-source switches (Port Mac Usage & Spend settings pane #825). While Track costs is off, Usage & Spend > Data controls hides:

    • "Include OpenCodex usage logs";
    • "Hide native Codex when OpenCodex is present";
    • the Sources filter.
  • Thresholds stay visible (Settings: Mac layout for General, Notifications, Advanced and About #816). The "Warning at % used" and "Critical at % used" fields stay visible while Threshold warnings is off. They also set the usage-bar and float-bar colours. The Mac hides them; this one difference is kept on purpose.

  • Hide Personal Info shows no email anywhere (HPI). With HPI on, no surface shows an email, a placeholder or a partial mask. This matches the Mac, whose email placeholder is "".

    • Tray panel card: the account email is removed from the header, and emails are removed from the error line.
    • Settings provider detail: the identity row is removed; this includes an organization label that contains the email. Emails are also removed from issue notices.
    • Grok accounts list in Settings: shows "Account N".
    • Claude and Grok tray account menus: show "Account N".
    • Tray tooltip: emails are removed from error text.
    • Usage item titles: emails are removed.
    • Redaction helper: hide_emails_in_text removes emails, then tidies the spacing before punctuation, as on the Mac.
    • Logs: still use the "Hidden" placeholder.
    • Bridge snapshot: the email is not removed from the snapshot, because chart history is keyed on it. It is removed at display time, which keeps each provider's data separate.
  • Q10a (adaptive refresh on by default) is already on main, at rust/src/settings.rs:650 with the test at settings/tests.rs:1806. No change needed.

Mac reference (upstream 0.70.0 Sources/CodexBar)

  • PreferencesGeneralPane.swift:5-66: AppLanguage.system is the first case, labelled "System".
  • PreferencesSpendDashboardPane.swift:495-512: the OpenCodex and Hide native Codex toggles and SpendDashboardSourceFilter only render inside if self.settings.costUsageEnabled.
  • PersonalInfoRedactor.swift:
    • :5-15: AccountOrdinal.label is "Account %@";
    • :18: emailPlaceholder = "";
    • :24-38: redactEmail and redactAccountLabel;
    • :40-55: redactEmails(in:) and the spacing tidy-up.
  • Rebuild the provider detail pane in the macOS layout with per-provider quota warnings #827 (quota warnings in the export) is a Windows extension. The Mac export has no per-provider quota warnings.

Commands run on the head (57200c6)

CARGO_TARGET_DIR=W:\cargo-target\settings-followups. Heavy steps ran under the E-core wrapper. CI was not set.

Command Result
cargo fmt --all -- --check pass
cargo test --manifest-path rust/Cargo.toml 4110 passed, 0 failed, 1 ignored
cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings pass, 0 clippy warnings
cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml 679 passed, 0 failed
cargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warnings pass, 0 clippy warnings
pnpm --config.verify-deps-before-run=false test 1059 passed in 119 files, 0 failed
pnpm exec tsc --noEmit pass
pnpm run build pass
pnpm run lint pass

Notes on the output:

  • Clippy: the only warning: line in either log is cargo's existing "profiles for the non root package will be ignored".
  • Lint: the warnings are unused imports in usageSpendSharing.test.ts and AgentSessions.test.tsx. Both files predate this PR and it doesn't touch them.

Tests added or changed:

  • Rust core:
    • settings/system_language.rs: 3 tests (tag mapping, fallback, follow logic).
    • settings/tests.rs: 3 tests (new install follows, legacy file keeps its language, file round trip).
    • preferences_document/tests.rs: quota-warning round trip, null reset, rejection cases, and the legacy export keeping its language.
    • core/redactor.rs: hide_emails_in_text_removes_emails_without_a_placeholder.
  • Tauri shell:
    • commands/settings.rs: choosing_system_language_follows_the_system and choosing_a_specific_language_stops_following_the_system.
    • tray_accounts.rs: hidden_claude_and_grok_tray_labels_show_no_email.
    • tray_bridge.rs: hidden_personal_info_removes_emails_from_tooltip_errors.
    • commands/tests.rs: expectations updated for titles with emails removed.
  • Frontend:

Real-window proof

The proof used a debug build of this head (57200c6), built with the proof-kit dirs/reqwest shim. The shim is not committed.

  • Home: each run used a fresh isolated home. The real %APPDATA%\CodexBar was never touched.
  • Seed: CODEXBAR_SEED_USAGE_JSON seeded synthetic Codex and Claude snapshots, with the emails proof@example.com and proof.claude@example.com.
  • Tools: CDP drove the clicks and reads. cua-driver took the real-window screenshots, on the secondary monitor.
  • Run: lane-s-pr2-20261012-041636, 0 failures.
  • Steps log: W:/mac-parity/report/lane-s/pr2/steps.jsonl.
  • Checks summary: W:/mac-parity/report/lane-s/pr2/checks-summary.txt.

What the log shows:

  • Language: System (Q9).

    • On a fresh home, Language reads "System" and it is the first option. uiLanguageFollowsSystem is true, and the language resolves to English, because this PC's Windows display language is en-US.
    • Picking English gives ui_language_follows_system=false in the DPAPI-decrypted settings.json.
    • Picking System again sets it back to true.
    • Shot: shots/01-language-system.png.
  • Thresholds (Settings: Mac layout for General, Notifications, Advanced and About #816). With Threshold warnings off (show_notifications=false in the file), "Warning at % used" (70) and "Critical at % used" (90) are still shown. Shot: shots/02-thresholds-visible-warnings-off.png.

  • Track costs (Port Mac Usage & Spend settings pane #825).

    • With Track costs on, "Include OpenCodex usage logs" and the Sources filter (Claude, Codex) are shown. Shot: shots/03-track-costs-on.png.
    • After switching it off (cost_usage_enabled=false in the file), the OpenCodex switch, the Hide native Codex switch and Sources are all gone. Shot: shots/04-track-costs-off.png.
  • Hide Personal Info. The no-email check fails if the page's text or HTML attributes contain example.com or anything shaped like an email. With HPI off, the check fires on both surfaces below, which shows it can detect the email.

    Surface HPI off HPI on
    Tray panel card proof@example.com shown (shot 05-tray-panel-hpi-off.png) no email; the plan and 78% left are still shown (shot 09-tray-panel-hpi-on.png)
    Settings > Codex detail Account row shows proof@example.com (shot 06-provider-detail-hpi-off.png) no Account row and no email; Plus is still shown (shot 08-provider-detail-hpi-on.png)
    Float bar no email; it never renders one (shot 05b-float-bar-hpi-off.png) no email (shot 10-float-bar-hpi-on.png)
    • HPI was switched on with the real Settings > Advanced toggle (hide_personal_info=true in the file). Shot: shots/07-advanced-hpi-on.png.
    • The float bar was switched on through the update_settings bridge command, not the Menu toggle.
    • The tray tooltip and the Claude and Grok tray account menus are native, so CDP can't read them. The Rust tests hidden_personal_info_removes_emails_from_tooltip_errors and hidden_claude_and_grok_tray_labels_show_no_email cover them.

I looked at every screenshot. The only emails in them are the two synthetic seed addresses, and they appear only in the HPI-off shots. The screenshots contain no credentials and no local paths.

Open questions (default chosen)

  1. The follow flag in the preferences export. ui_language_follows_system is exported, so importing on another PC follows that PC's language. Default: export it.
  2. Where the display language comes from. It is read from the HKCU registry values listed above. It is not read through the GetUserPreferredUILanguages API. The registry read uses winreg, which is already a dependency, so the PR adds none. Default: the registry.
  3. The "System" label. It is "System" in every locale, the English label from the Mac language_system string. It isn't translated yet. Default: English.
  4. Logs under HPI. They keep the "Hidden" placeholder, so a log line still shows that an email was there. Default: keep "Hidden" in logs.
  5. Stored hidden-row IDs. Usage detail-section IDs still use the "Hidden" placeholder internally, so hidden-row IDs that users already saved stay valid. Default: keep the IDs stable.
  6. Organization labels that contain an email. Under HPI, the provider identity row drops the whole organization label, because the label minus the email can read oddly. Default: drop it.
  7. Settings: Mac layout for General, Notifications, Advanced and About #816. The thresholds stay visible while warnings are off (Windows differs from the Mac on purpose, as noted above). Default: visible.

Summary by CodeRabbit

  • New Features
    • Choose System in language settings to follow your computer’s display language; imported preferences also support this option.
    • Export and import provider-specific quota warning settings.
  • Privacy
    • When Hide Personal Info is enabled, account emails are omitted or replaced with generic account labels, and emails are removed from error messages and tray tooltips.
  • Settings
    • Warning and critical usage thresholds remain available when notifications are off.
    • OpenCodex cost controls and source filters appear when cost tracking is enabled.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: nesszer/Win-CodexBar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 61e64b25-66fe-4f5b-91dc-eb2ee4266eda

📥 Commits

Reviewing files that changed from the base of the PR and between 892ac74 and 252bad8.


📒 Files selected for processing (3)
  • apps/desktop-tauri/src-tauri/src/commands/bridge.rs
  • apps/desktop-tauri/src-tauri/src/tray_bridge.rs
  • apps/desktop-tauri/src/components/MenuCard.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.



📝 Walkthrough

Walkthrough

The changes add system-language following, update personal-information redaction across desktop and tray surfaces, add provider quota warnings to portable preferences, and adjust when settings controls appear.

Changes

System language selection

Layer / File(s) Summary
Persist and resolve system language
rust/src/settings.rs, rust/src/settings/raw.rs, rust/src/settings/system_language.rs, rust/src/settings/tests.rs
Settings persist a follow-system flag and resolve supported system language preferences. Tests cover defaults, legacy settings, and persistence.
Apply language settings through backend commands
apps/desktop-tauri/src-tauri/src/commands/settings.rs, apps/desktop-tauri/src-tauri/src/commands/bridge.rs, apps/desktop-tauri/src-tauri/src/commands/locale_cmd.rs, apps/desktop-tauri/src-tauri/src/commands/preferences_transfer.rs
Backend updates apply explicit-language and follow-system changes, update the settings snapshot, and resolve system language during preference import.
Expose system language in the UI
apps/desktop-tauri/src/types/bridge.ts, apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx, apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx, apps/desktop-tauri/src/App.test.tsx, apps/desktop-tauri/src/floatbar/FloatBar.test.tsx, apps/desktop-tauri/src/surfaces/TrayPanel*.test.tsx, apps/desktop-tauri/src/surfaces/settings/tabs/*Tab.test.tsx
The bridge includes the follow-system setting. The language selector includes a System option, and settings fixtures include the new field.

Personal-information redaction

Layer / File(s) Summary
Add email-removal helpers
rust/src/core/redactor.rs, apps/desktop-tauri/src/lib/personalInfo.ts, apps/desktop-tauri/src/lib/personalInfo.test.ts
Rust and TypeScript helpers remove email addresses from text and tidy spacing. Tests cover removal and email detection.
Redact provider account and error displays
apps/desktop-tauri/src/components/MenuCard.tsx, apps/desktop-tauri/src/components/MenuCard*.test.*, apps/desktop-tauri/src/surfaces/settings/providers/sections/IdentitySection*, apps/desktop-tauri/src/surfaces/settings/providers/sections/ProviderIssueNotice*, apps/desktop-tauri/src/surfaces/settings/providers/sections/credentials/*AccountsSection*, apps/desktop-tauri/src/components/claudeAccountDisplay.ts
When personal information is hidden, account details are omitted or replaced with numbered labels, and provider error text uses the shared helper.
Redact tray labels and usage details
apps/desktop-tauri/src-tauri/src/tray_accounts.rs, apps/desktop-tauri/src-tauri/src/tray_bridge.rs, apps/desktop-tauri/src-tauri/src/commands/usage_items.rs, apps/desktop-tauri/src-tauri/src/commands/tests.rs
Tray account labels use numbered names when details are hidden. Tray tooltips and usage-item titles remove email addresses.

Portable provider quota warnings

Layer / File(s) Summary
Validate and transfer provider quota warnings
rust/src/settings/preferences_document.rs, rust/src/settings/preferences_document/tests.rs
Preference documents export and apply provider quota warnings. Tests cover round trips, clearing and preserving overrides, precedence, and invalid values.

Notification threshold visibility

Layer / File(s) Summary
Keep usage thresholds visible
apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx, apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx
Warning and critical threshold controls remain visible when general notifications are disabled.

Cost tracking control visibility

Layer / File(s) Summary
Gate usage controls on cost tracking
apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.tsx, apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.test.tsx
OpenCodex controls and source filters appear only when cost tracking is enabled.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant GeneralTab
  participant apply_general_settings
  participant Language_system
  participant SettingsSnapshot
  GeneralTab->>apply_general_settings: Send uiLanguageFollowsSystem patch
  apply_general_settings->>Language_system: Resolve system language when following is enabled
  Language_system-->>apply_general_settings: Return resolved language
  apply_general_settings->>SettingsSnapshot: Include resolved language and follow-system flag
Loading

Suggested reviewers: xuelongmu


Merge Risk: ⚪ Minimal · up to 252ba

The settings changes add language, privacy, and preference controls; no actionable user-facing regression is established, so there is no identified merge-blocking risk.

Pre-merge checks | Passed 7 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check Warning The title accurately describes the changes, but it is a long list rather than a short imperative summary. Rewrite the title as a concise imperative summary, such as "Add system language and privacy settings support".
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Provider Data Stays Siloed Passed No provider or account data crosses its silo in the changed code. Provider quota warnings export and import use the same provider ID keys, and tests verify that Claude credentials remain local while C…
Secrets Handled Safely Passed No changed code exposes a real credential. The preference export keeps provider_configs excluded and exports only validated quota-warning fields; tests also verify that API-token fixture values do n…
No Unapproved Dependencies Passed The pull-request diff changes no Cargo.toml, package.json, npm/yarn lockfile, or pnpm configuration file. Therefore, it adds no unapproved dependency or package-manager change under this check.
Ui Changes Include Windows Proof Passed The PR changes visible UI and tray behavior, including settings controls, account labels, email display, and system-language selection. The supplied PR context reports real-window proof on the Windows…

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR







🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 React Doctor (0.9.14)

Project "apps/desktop-tauri" is not a workspace project or a directory. Available projects: desktop-tauri



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
Finesssee merged commit d68a40f into main Oct 12, 2026
3 checks passed
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