Repository navigation
Port upstream 0.67.0: provider switcher shortcut editor and persistence (stacked on #693) - #700
Conversation
Adds the switcher_shortcuts setting (overrides only, validated in Rust and mirrored in TS), the resolved map in the settings snapshot, and a Settings > Menu editor. The switcher hook now follows the configured shortcuts.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Thermo-nuclear reviewHead reviewed: Correctness against the spec
Structure and size
Non-blocking notes (left as is, no change requested)
Validation I re-ran
UI proofSettings chrome changed (Menu tab). A proof build from this head and a proof kit are being prepared for the CUA run at |
Thermo-nuclear review follow-up (second pass)Reviewed by Codex gpt-6-luna (xhigh); verified and validated by Claude. The earlier review comment stands; this pass found and fixed the following. Fixed:
Left:
Commands run: |
CUA proof (rerun)Build commit: Proof-only patch (throwaway, restored with Driven with the cua-driver CLI only, background delivery only (UIA invoke, PostMessage keys, window-state screenshots), proof windows on the second monitor.
Notes: Screenshots (local, not committed), |
UI proof (browser-use)Build commit: Driven over WebView2 CDP (port 9352) with browser-use only — DOM reads, programmatic clicks and
Caveats (both pre-existing, neither caused by this PR's delta):
Screenshots (local, not committed), in |
UI proof (browser-use)Combined build of The PopOut layout is retired on the release line, so the shortcuts reach the tray flyout only (follow-up 40b29a5 drops the pop-out wording).
Every surface also passed the privacy check (no email-like text, account e-mail nodes or profile paths in the DOM) and theme Validation at |
…t editor and persistence (stacked on nesszer#693) Conflicts: commands/settings.rs apply_to keeps the release cost reporting period validation before the switcher_shortcuts normalization; rust/src/settings.rs imports both BTreeMap and Path. PopOutPanel.tsx and its test stay deleted (PopOut layout retired), so the configured shortcuts reach the tray flyout through useTrayPanelController only.
The preferences document test requires every Settings field to be either portable or excluded. Fields that reached the release after nesszer#654's base: - Portable: cost_reporting_period and preferred_currency_code (nesszer#654 asks for both once they land), switcher_shortcuts (nesszer#700 deferred it to this document; upstream 0.70.0 exports switcherShortcuts). Validators accept only stored forms: canonical periods, AUTO or a supported code, and overrides that pass the switcher shortcut rules. - Excluded: stay_awake_enabled (side-effect toggle, nesszer#659), cost_usage_bucket_time_zone (pinned to the machine zone on first launch, no settings control), and menu_bar_color_pace, the stacked tray provider picks and credential_expiry_notifications_enabled, which upstream 0.70.0 also keeps out of its portable keys. null on a field omitted when empty (switcher_shortcuts) now clears it instead of failing. A desktop import that changes the reporting period resets the local cost cache, as update_settings does.
Summary
PR 2 of 2 for the deferred upstream 0.67.0 "provider switcher keyboard shortcuts" feature. PR 1 (#693) added the fixed keys (Left/Right, Ctrl+1..9). This PR makes them configurable:
switcher_shortcutssetting (overrides only; omitted when everything is default), validated in Rust (rust/src/switcher_shortcuts.rs) and mirrored inapps/desktop-tauri/src/lib/switcherShortcuts.ts.{}restores defaults).none, reset to defaults, inline localized errors for duplicate / reserved / invalid keys).tracingwarning; it does not break the rest of the settings.ShortcutCapturegained optionalcompose,recordingHintandemptyLabelprops so the editor reuses it without a mode flag.docs/CONFIGURATION.mddocuments the editor, theswitcher_shortcutskey and the rules.Approved design
From the approved note
design-provider-switcher-shortcuts.md, implemented as written:ctrl alt shift; keys areleft,right,,, or an ASCII letter/digit;nonedisables an action.cmdis accepted as an alias forctrl.ctrl+r,ctrl+q,ctrl+,,ctrl+w, and letters/digits/comma with only shift or no modifier. Duplicates and unknown actions are rejected.left,right,ctrl+1..9.settings.json; the snapshot exposes the resolved map.menusettings tab id is reused, so the tab whitelist is unchanged.Upstream reference
steipete/CodexBar 0.67.0, provider switcher keyboard shortcuts (tag-pinned read only).
Ported / Deferred
Ported: persistence, validation (Rust + TS), snapshot/patch plumbing, Settings > Menu editor, hook wiring, docs.
Deferred: the portable-preferences key
switcherShortcuts, because portable preferences does not exist on this base. It can be added when that feature lands.Validation
cargo +1.98.0 fmt --allcargo +1.98.0 clippy --workspace --all-targets -- -D warnings(both manifests): cleancargo +1.98.0 test -p codexbar: 2175 passed, 0 failedcargo +1.98.0 test -p codexbar-desktop-tauri: 465 passed, 1 failed.commands::tests::bootstrap_payload_exposes_every_provider_variantreports 79 catalog entries vs 78 active providers.get_bootstrap_stateadds a deprecated provider to the catalog when it is enabled in the machine-local settings, so this depends on the developer machine's state and is not touched by this change (this PR only adds a field to the settings snapshot). CI runs on a clean profile.pnpm test(vitest): 71 files, 449 tests passedpnpm run build(tsc + vite): passed; lint has only pre-existing warningsAffected areas
rust/src/switcher_shortcuts.rs(+tests.rs),rust/src/settings.rs,rust/src/settings/raw.rs,rust/src/locale.rs,rust/src/locale/en-US.ftlapps/desktop-tauri/src-tauri/src/commands/settings.rs,commands/bridge.rsapps/desktop-tauri/src/:lib/switcherShortcuts.ts,hooks/useProviderSwitcherKeys.ts,hooks/useTrayPanelController.ts,surfaces/PopOutPanel.tsx,surfaces/settings/SwitcherShortcutsSection.tsx,surfaces/settings/tabs/DisplayTab.tsx,components/ShortcutCapture.tsx,i18n/keys.ts,types/bridge.tsdocs/CONFIGURATION.mdUI proof
This PR changes Settings chrome (Menu tab). CUA / desktop proof has not been captured: the automation run that produced this PR is not permitted to launch the desktop app. Coverage is Vitest component tests (
SwitcherShortcutsSection.test.tsx, 8 tests) only. A CUA retest atCODEXBAR_PROOF_MODE=settings:menuon a fresh debug build is still required before merge; hence this is a draft.