Shell 7: platform-settings-shell-keybinds (#799) #851

Closed
charles wants to merge 0 commits from shell-7-platform-settings-shell-keybinds into shell
Owner

Stacked on: origin/shell-6-core-shell-ports-settings (already merged into shell; nothing extra stacked).

What

settings.toml gains the desktop shell's tables (spec §5.4), in crates/fluxer-platform/src/settings.rs:

  • [shell]: every switch of ShellSettings::stored, read value by value through ShellSettings::apply_stored (wrong type / unknown value costs only that switch; unknown names ignored; normalised: no tray icon → tray behaviours off).
  • [keybinds]: per original action id (voice_toggle_mute, …) a list of combos { code, key, ctrl, alt, shift, meta, mouse, modifier_only, both_sides, global } (toml writes them as [[keybinds.<id>]]). Empty list = unbound, no entry = defaults. The unit is the combo: one with a wrongly typed value is dropped whole (read as "no Ctrl" it would bind a different, bare key, possibly global); an entry that is not a list is dropped; unknown ids are kept so a newer version's bindings survive.
  • [notifications.sounds]: name → bool/int/string, value by value.
  • One-time copy of [voice.settings].ptt_key (a DOM code) into [keybinds].voice_push_to_talk when that entry is absent; key derived as a US layout would (KeyF→f, Digit4→4, else the code); in-window (global = false) as the old key was; the file is written back at once.
  • [window] unchanged; tables that are not tables load their defaults without setting the file aside.
  • Bindings never logged (spec §12): SettingsFile lost its (unused) Debug; a file the parser refuses is now logged with the error's message and line number instead of its Display, which quotes the offending line.

Deviations

  • One small fluxer-core change (outside the Files list): Keybinds (Task 11) and NotificationPrefs (Task 14) do not exist yet, and the values must live in LocalSettings to survive a save. Added opaque carriers in shell/settings.rs: StoredKeybinds (id → Vec<KeyCombo>, Debug prints StoredKeybinds(…)) and StoredNotificationSounds (name → StoredValue), each with get/set/stored/apply_stored, and LocalSettings::{keybinds, notification_sounds} (boxed). Tasks 11/14 can read these into their models (or swap the field type keeping stored/apply_stored). No shell/mod.rs change (paths are fluxer_core::shell::settings::…).
  • Spec §5.4 lists unread_badge under [notifications]; Task 6 put it in ShellSettings, so it is written in [shell] with the other switches (existing code wins).
  • tests/settings.rs save_then_load_roundtrips_every_field now sets the push-to-talk binding explicitly (with ptt_key = "F8" and no binding, load now migrates it).

Tests

crates/fluxer-platform/tests/settings_shell.rs: file_without_tables_loads_defaults, round_trip, bad_value_costs_only_itself, unknown_keys_ignored, previous_version_reads_new_file (copy of SettingsFile at 549892bc), ptt_key_migrated_once, bindings_never_in_debug_or_error (captures the log of a refused file and of wrongly typed bindings), plus no_tray_icon_normalises_on_load.
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally before merging current origin/shell (Shell 18, 41); after the merge fmt, clippy -D warnings and the tests of fluxer-core/fluxer-platform/fluxer-devserver pass. No desktop tests apply; no Windows-specific code.

Closes #799

🤖 Generated with Claude Code

https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K

Stacked on: origin/shell-6-core-shell-ports-settings (already merged into shell; nothing extra stacked). ## What `settings.toml` gains the desktop shell's tables (spec §5.4), in `crates/fluxer-platform/src/settings.rs`: - `[shell]`: every switch of `ShellSettings::stored`, read value by value through `ShellSettings::apply_stored` (wrong type / unknown value costs only that switch; unknown names ignored; normalised: no tray icon → tray behaviours off). - `[keybinds]`: per original action id (`voice_toggle_mute`, …) a list of combos `{ code, key, ctrl, alt, shift, meta, mouse, modifier_only, both_sides, global }` (toml writes them as `[[keybinds.<id>]]`). Empty list = unbound, no entry = defaults. The unit is the combo: one with a wrongly typed value is dropped whole (read as "no Ctrl" it would bind a different, bare key, possibly global); an entry that is not a list is dropped; unknown ids are kept so a newer version's bindings survive. - `[notifications.sounds]`: name → bool/int/string, value by value. - One-time copy of `[voice.settings].ptt_key` (a DOM code) into `[keybinds].voice_push_to_talk` when that entry is absent; key derived as a US layout would (`KeyF`→`f`, `Digit4`→`4`, else the code); in-window (`global = false`) as the old key was; the file is written back at once. - `[window]` unchanged; tables that are not tables load their defaults without setting the file aside. - Bindings never logged (spec §12): `SettingsFile` lost its (unused) `Debug`; a file the parser refuses is now logged with the error's message and line number instead of its `Display`, which quotes the offending line. ## Deviations - **One small `fluxer-core` change** (outside the Files list): `Keybinds` (Task 11) and `NotificationPrefs` (Task 14) do not exist yet, and the values must live in `LocalSettings` to survive a save. Added opaque carriers in `shell/settings.rs`: `StoredKeybinds` (id → `Vec<KeyCombo>`, `Debug` prints `StoredKeybinds(…)`) and `StoredNotificationSounds` (name → `StoredValue`), each with `get/set/stored/apply_stored`, and `LocalSettings::{keybinds, notification_sounds}` (boxed). Tasks 11/14 can read these into their models (or swap the field type keeping `stored`/`apply_stored`). No `shell/mod.rs` change (paths are `fluxer_core::shell::settings::…`). - Spec §5.4 lists `unread_badge` under `[notifications]`; Task 6 put it in `ShellSettings`, so it is written in `[shell]` with the other switches (existing code wins). - `tests/settings.rs` `save_then_load_roundtrips_every_field` now sets the push-to-talk binding explicitly (with `ptt_key = "F8"` and no binding, load now migrates it). ## Tests `crates/fluxer-platform/tests/settings_shell.rs`: `file_without_tables_loads_defaults`, `round_trip`, `bad_value_costs_only_itself`, `unknown_keys_ignored`, `previous_version_reads_new_file` (copy of `SettingsFile` at 549892bc), `ptt_key_migrated_once`, `bindings_never_in_debug_or_error` (captures the log of a refused file and of wrongly typed bindings), plus `no_tray_icon_normalises_on_load`. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally before merging current `origin/shell` (Shell 18, 41); after the merge fmt, clippy `-D warnings` and the tests of fluxer-core/fluxer-platform/fluxer-devserver pass. No desktop tests apply; no Windows-specific code. Closes #799 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
Adds the opaque carriers LocalSettings::keybinds (StoredKeybinds) and
LocalSettings::notification_sounds (StoredNotificationSounds) in fluxer-core
so the tests compile; the platform does not read or write them yet.

Refs #799

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
[shell] by ShellSettings::stored, [keybinds] (action id -> combos, a combo
read whole or dropped, unknown ids kept), [notifications.sounds] by name;
each table read value by value. One-time copy of [voice.settings].ptt_key
into [keybinds].voice_push_to_talk. A refused file is logged by line and
message, never its text (spec 12).

Refs #799

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
Author
Owner

Independent review: Shell 7 (platform settings: [shell], [keybinds], [notifications])

Reviewed: git diff 549892bc..origin/shell-7-platform-settings-shell-keybinds (head 56062305), limited to this task's files.

Gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree: all steps passed (tests/settings_shell.rs: 8/8).

Checks

  1. Plan tests: all 7 named tests exist and assert what the plan asks: file_without_tables_loads_defaults, round_trip (including saving again giving the same bytes, [window] unchanged), bad_value_costs_only_itself, unknown_keys_ignored, previous_version_reads_new_file (a faithful copy of SettingsFile at 549892bc, checked field by field), ptt_key_migrated_once (and no second copy after the user unbinds), bindings_never_in_debug_or_error (Debug, the parse-error log and the wrong-type logs). There is one extra test, no_tray_icon_normalises_on_load.
  2. Interfaces: the Produces items are all met (value-by-value reading, absent tables load defaults, [window] untouched, a one-time ptt_key copy that is written back at once through complete && !migrated). Consumes: Keybinds::stored / NotificationPrefs::stored do not exist yet, so the branch adds the opaque carriers StoredKeybinds / StoredNotificationSounds and LocalSettings::{keybinds, notification_sounds} in fluxer-core, and this deviation is declared.
  3. Invariants: the fluxer-core additions use only std, do no I/O and pull in no forbidden crates. No secrets or paths. Malformed data cannot panic: a wrong type, an out-of-range mouse value or a non-table value is dropped. Keys are not logged: SettingsFile lost Debug, StoredKeybinds prints StoredKeybinds(…), a parse error is logged with its message and line only, and table_or_warn logs only the table name.
  4. Parity spot-checks (fork): defaults and the "no tray icon turns the three tray behaviours off" rule match fluxer_desktop/src/common/DesktopConfig.ts:110-128, 424-428. Wrong-type-means-default matches sanitizePersistedDesktopWindowBehaviorSettings (:130ff, typeof === 'boolean'). The action ids (voice_toggle_mute, voice_toggle_deafen, voice_push_to_talk) match fluxer_app/.../keybindings/KeybindScopeUtils.ts. The combo fields match KeyCombo in features/input/state/InputKeybind.ts:151-165 (mouseButton is written as mouse, as spec §5.4 says).
  5. Review Focus: no item belongs to Task 7. On item 1 (no key reaches a log), the grep of this diff for tracing:: near key data is clean.

Findings

  • minor — unread_badge is written in [shell], not under [notifications] as spec §5.4 lists it. It follows Task 6's ShellSettings and is declared. Nothing outside the client reads this file, so the effect is only a mismatch with the spec. Either the spec text or the shape should be changed later.
  • minor — Forward compatibility of combos. Combo fields this version does not know (e.g. a future gamepad) are dropped when the file is saved. A combo with a field of an unexpected type is dropped whole, and if every combo of an action is dropped the action is saved as [] (unbound) instead of keeping its defaults. A newer version's binding can therefore be lost after the older version saves. The spec only requires that the older version reads the file, so this is not blocking. Unknown action ids are kept, as they should be.
  • minor — One-crate rule: Task 7 is not on the plan's list of two-crate tasks (2, 4, 6, 32, 36, 42) but touches fluxer-core (persist.rs, shell/settings.rs). It is unavoidable while Tasks 11 and 14 have not landed, and it is declared. For Task 11 (same wave): Keybinds must read from or replace LocalSettings::keybinds: Box<StoredKeybinds>, and VoiceSettings::ptt_key must become the view of its first voice_push_to_talk combo. Until then a ptt_key changed after the migration is not mirrored into [keybinds], so a change made between the two merges would be overridden once Task 11 makes [keybinds] the source. For Task 14: read or replace StoredNotificationSounds.
  • minor (pre-existing, not this diff) — VoiceSettings derives Debug, which prints ptt_key (a key) inside LocalSettings's Debug. That contradicts spec §12 and belongs to Task 11 (it owns voice/settings.rs), so it should be tracked as a follow-up there.

Verdict: APPROVED — no blocking findings, local gate green.

## Independent review: Shell 7 (platform settings: `[shell]`, `[keybinds]`, `[notifications]`) Reviewed: `git diff 549892bc..origin/shell-7-platform-settings-shell-keybinds` (head `56062305`), limited to this task's files. **Gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree: **all steps passed** (`tests/settings_shell.rs`: 8/8). ### Checks 1. **Plan tests:** all 7 named tests exist and assert what the plan asks: `file_without_tables_loads_defaults`, `round_trip` (including saving again giving the same bytes, `[window]` unchanged), `bad_value_costs_only_itself`, `unknown_keys_ignored`, `previous_version_reads_new_file` (a faithful copy of `SettingsFile` at 549892bc, checked field by field), `ptt_key_migrated_once` (and no second copy after the user unbinds), `bindings_never_in_debug_or_error` (Debug, the parse-error log and the wrong-type logs). There is one extra test, `no_tray_icon_normalises_on_load`. 2. **Interfaces:** the Produces items are all met (value-by-value reading, absent tables load defaults, `[window]` untouched, a one-time `ptt_key` copy that is written back at once through `complete && !migrated`). Consumes: `Keybinds::stored` / `NotificationPrefs::stored` do not exist yet, so the branch adds the opaque carriers `StoredKeybinds` / `StoredNotificationSounds` and `LocalSettings::{keybinds, notification_sounds}` in fluxer-core, and this deviation is declared. 3. **Invariants:** the fluxer-core additions use only std, do no I/O and pull in no forbidden crates. No secrets or paths. Malformed data cannot panic: a wrong type, an out-of-range `mouse` value or a non-table value is dropped. Keys are not logged: `SettingsFile` lost `Debug`, `StoredKeybinds` prints `StoredKeybinds(…)`, a parse error is logged with its message and line only, and `table_or_warn` logs only the table name. 4. **Parity spot-checks** (fork): defaults and the "no tray icon turns the three tray behaviours off" rule match `fluxer_desktop/src/common/DesktopConfig.ts:110-128, 424-428`. Wrong-type-means-default matches `sanitizePersistedDesktopWindowBehaviorSettings` (`:130ff`, `typeof === 'boolean'`). The action ids (`voice_toggle_mute`, `voice_toggle_deafen`, `voice_push_to_talk`) match `fluxer_app/.../keybindings/KeybindScopeUtils.ts`. The combo fields match `KeyCombo` in `features/input/state/InputKeybind.ts:151-165` (`mouseButton` is written as `mouse`, as spec §5.4 says). 5. **Review Focus:** no item belongs to Task 7. On item 1 (no key reaches a log), the grep of this diff for `tracing::` near key data is clean. ### Findings - **minor** — `unread_badge` is written in `[shell]`, not under `[notifications]` as spec §5.4 lists it. It follows Task 6's `ShellSettings` and is declared. Nothing outside the client reads this file, so the effect is only a mismatch with the spec. Either the spec text or the shape should be changed later. - **minor** — Forward compatibility of combos. Combo fields this version does not know (e.g. a future `gamepad`) are dropped when the file is saved. A combo with a field of an unexpected type is dropped whole, and if every combo of an action is dropped the action is saved as `[]` (unbound) instead of keeping its defaults. A newer version's binding can therefore be lost after the older version saves. The spec only requires that the older version *reads* the file, so this is not blocking. Unknown action ids are kept, as they should be. - **minor** — One-crate rule: Task 7 is not on the plan's list of two-crate tasks (2, 4, 6, 32, 36, 42) but touches `fluxer-core` (`persist.rs`, `shell/settings.rs`). It is unavoidable while Tasks 11 and 14 have not landed, and it is declared. **For Task 11 (same wave):** `Keybinds` must read from or replace `LocalSettings::keybinds: Box<StoredKeybinds>`, and `VoiceSettings::ptt_key` must become the view of its first `voice_push_to_talk` combo. Until then a `ptt_key` changed after the migration is not mirrored into `[keybinds]`, so a change made between the two merges would be overridden once Task 11 makes `[keybinds]` the source. **For Task 14:** read or replace `StoredNotificationSounds`. - **minor (pre-existing, not this diff)** — `VoiceSettings` derives `Debug`, which prints `ptt_key` (a key) inside `LocalSettings`'s `Debug`. That contradicts spec §12 and belongs to Task 11 (it owns `voice/settings.rs`), so it should be tracked as a follow-up there. **Verdict: APPROVED** — no blocking findings, local gate green.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Merged into shell by hand (the merge API returns 405); the commits are in the branch.

Merged into `shell` by hand (the merge API returns 405); the commits are in the branch.
charles closed this pull request 2026-11-18 06:46:53 +00:00
Author
Owner

Independent review (re-run): Shell 7, platform settings [shell], [keybinds], [notifications]

Scope. The requested range c2bcf238..origin/shell-7-platform-settings-shell-keybinds is empty, because the branch head is c2bcf238 and is already on shell through merge 4189d7d6. So I reviewed what Task 7 actually brought in: git diff 4e19d854 4189d7d6 (commits 7919e03b, 0723d624 plus the shell merges). Forgejo marks this PR closed with merged=false because it was merged by hand (see the earlier comment).

Checks

  1. Plan tests: all seven named tests are in crates/fluxer-platform/tests/settings_shell.rs (file_without_tables_loads_defaults, round_trip including the byte-for-byte re-save, bad_value_costs_only_itself, unknown_keys_ignored, previous_version_reads_new_file against a copy of the previous SettingsFile, ptt_key_migrated_once, bindings_never_in_debug_or_error), plus no_tray_icon_normalises_on_load. Each asserts what the plan says.
  2. Interfaces: tables are read value by value, absent tables give defaults, [window] is unchanged, and the one-time ptt_key to voice_push_to_talk copy is written back at once. LocalSettings::{keybinds, notification_sounds} are consumed on shell by Task 11 (Keybinds), Task 14 (NotificationPrefs::from_stored) and the runtime, and they compile and pass together.
  3. Invariants: fluxer-core gets no I/O and no forbidden deps. SettingsFile lost Debug. StoredKeybinds Debug prints …. The parse-error log now carries only the line number and message. table_or_warn logs only the table name. A bad mouse (u8 try_from) or an over-long key drops that combo and cannot panic. No secrets or paths in the tests.
  4. Parity spot-checks against the fork: (a) KeyCombo fields match InputKeybind.ts:151-165 (key, code?, ctrl/alt/shift/meta, global, mouseButton, modifierOnly, bothSides); (b) the action ids voice_toggle_mute / voice_toggle_deafen / voice_push_to_talk match input_keybind/KeybindCommands.ts:65-66 and RuntimeKeybinds.ts:18-24; (c) the [shell] defaults written on a fresh profile (close_to_tray = true, autostart = false) match DC/DesktopConfig.ts:110-128 and spec §18 Q5.
  5. Review Focus: no item is specific to Task 7. Item 1 (no key reaches a log) holds for this code.
  6. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci on c2bcf238: all steps passed (exit 0, no failures).

Findings

  • minor: Task 7 also changed fluxer-core (persist.rs, shell/settings.rs: StoredKeybinds, StoredNotificationSounds), and the plan does not list Task 7 as a two-crate task. Neither Task 6 nor anything before Task 7 produced the Keybinds::stored / NotificationPrefs::stored the plan names, so this was needed. Tasks 11 and 14 now build on it. Process note only.
  • minor: Spec §5.4 puts unread_badge in [notifications], but it is stored in [shell] (through ShellSettings::stored), and a [notifications].unread_badge key is ignored. The value still round-trips, and no earlier file had it, so no data is lost. The spec text or the code should be brought into line.
  • minor: The migrated push-to-talk combo is in-window (global = false, key f for KeyF). Task 11's combo_from_ptt_name instead makes a global combo with key = code. Both match by code, and the in-window choice keeps today's behaviour, so nothing breaks. The two paths just produce different combos for the same key.

Verdict: approved. No blocking findings, and the local gate is green.

## Independent review (re-run): Shell 7, platform settings `[shell]`, `[keybinds]`, `[notifications]` **Scope.** The requested range `c2bcf238..origin/shell-7-platform-settings-shell-keybinds` is empty, because the branch head *is* c2bcf238 and is already on `shell` through merge 4189d7d6. So I reviewed what Task 7 actually brought in: `git diff 4e19d854 4189d7d6` (commits 7919e03b, 0723d624 plus the shell merges). Forgejo marks this PR closed with merged=false because it was merged by hand (see the earlier comment). **Checks** 1. Plan tests: all seven named tests are in `crates/fluxer-platform/tests/settings_shell.rs` (`file_without_tables_loads_defaults`, `round_trip` including the byte-for-byte re-save, `bad_value_costs_only_itself`, `unknown_keys_ignored`, `previous_version_reads_new_file` against a copy of the previous `SettingsFile`, `ptt_key_migrated_once`, `bindings_never_in_debug_or_error`), plus `no_tray_icon_normalises_on_load`. Each asserts what the plan says. 2. Interfaces: tables are read value by value, absent tables give defaults, `[window]` is unchanged, and the one-time `ptt_key` to `voice_push_to_talk` copy is written back at once. `LocalSettings::{keybinds, notification_sounds}` are consumed on `shell` by Task 11 (`Keybinds`), Task 14 (`NotificationPrefs::from_stored`) and the runtime, and they compile and pass together. 3. Invariants: fluxer-core gets no I/O and no forbidden deps. `SettingsFile` lost `Debug`. `StoredKeybinds` Debug prints `…`. The parse-error log now carries only the line number and message. `table_or_warn` logs only the table name. A bad `mouse` (u8 try_from) or an over-long key drops that combo and cannot panic. No secrets or paths in the tests. 4. Parity spot-checks against the fork: (a) `KeyCombo` fields match `InputKeybind.ts:151-165` (key, code?, ctrl/alt/shift/meta, global, mouseButton, modifierOnly, bothSides); (b) the action ids `voice_toggle_mute` / `voice_toggle_deafen` / `voice_push_to_talk` match `input_keybind/KeybindCommands.ts:65-66` and `RuntimeKeybinds.ts:18-24`; (c) the `[shell]` defaults written on a fresh profile (`close_to_tray = true`, `autostart = false`) match `DC/DesktopConfig.ts:110-128` and spec §18 Q5. 5. Review Focus: no item is specific to Task 7. Item 1 (no key reaches a log) holds for this code. 6. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` on c2bcf238: **all steps passed** (exit 0, no failures). **Findings** - *minor*: Task 7 also changed fluxer-core (`persist.rs`, `shell/settings.rs`: `StoredKeybinds`, `StoredNotificationSounds`), and the plan does not list Task 7 as a two-crate task. Neither Task 6 nor anything before Task 7 produced the `Keybinds::stored` / `NotificationPrefs::stored` the plan names, so this was needed. Tasks 11 and 14 now build on it. Process note only. - *minor*: Spec §5.4 puts `unread_badge` in `[notifications]`, but it is stored in `[shell]` (through `ShellSettings::stored`), and a `[notifications].unread_badge` key is ignored. The value still round-trips, and no earlier file had it, so no data is lost. The spec text or the code should be brought into line. - *minor*: The migrated push-to-talk combo is in-window (`global = false`, key `f` for `KeyF`). Task 11's `combo_from_ptt_name` instead makes a global combo with key = code. Both match by code, and the in-window choice keeps today's behaviour, so nothing breaks. The two paths just produce different combos for the same key. **Verdict: approved.** No blocking findings, and the local gate is green.

Pull request closed

Sign in to join this conversation.
No description provided.