Shell 14: core-notification-settings-inactive (#806) #860

Closed
charles wants to merge 0 commits from shell-14-core-notification-settings-inactive into shell
Owner

Stacked on: origin/shell-6-core-shell-ports-settings (already merged into shell; the merge was a no-op)

What this builds (plan Task 14, spec §9, §3 rows 57-59)

fluxer-core::shell::notif_prefs:

  • NotificationPrefs { master_volume: u8 (0-200, 100), all_disabled, disabled: BTreeSet<NotificationSound> } with apply, stored / apply_stored (value by value, out-of-range volume clamped as clampVolume). Not stored itself (since the join with Shell 7, below): a view of Shell 7's LocalSettings::notification_sounds: StoredNotificationSounds, the only stored form, read with NotificationPrefs::from_stored and changed with NotificationPrefsAction::apply_to, saved by persist on every sound change.
  • sound_volume(app, sound) -> Option<f32>: None when the sound is off, all sounds are off, or ShellState::sound_allowed is false; else the master gain. notif_prefs::follow runs once after the reducers (app.rs) and passes every AudioCommand::PlayChime through it: dropped, kept at 100 %, or rewritten to the new AudioCommand::PlayChimeAt { chime, gain } (the runtime multiplies it into the output volume). PreviewSound plays at the master volume, even with its own switch off, not while all sounds are off (as the original disables the button).
  • ShellAction::NotificationPrefs(NotificationPrefsAction) (appended): SetMasterVolume, SetAllSoundsDisabled, SetSoundEnabled, PreviewSound, SetAfkTimeout(seconds), SetMentionPreference(MentionPreference).
  • SetAfkTimeout: clamped to 60-600 s, an optimistic PATCH /users/@me/settings {afk_timeout} inside the presence's existing write list (shown at once, afk follows it, reverted on EffectFailed); PresenceState::afk_timeout().
  • SetMentionPreference: optimistic ApiRequest::PatchMe {mention_flags} answered with the existing ApiResult::Me (the session takes the user), reverted on failure; mention_preference(app).
  • notifications_page(app) -> NotificationsPageModel: General (desktop notifications, unread badge, inactive timeout 1-10 minutes), Mention preference (three radios), Sounds (master volume 0-200 with markers and reset, "Disable all notification sounds", a row per sound with "Preview sound" and the common/"Show more sound effects" split).

Step 0: the sounds the client plays today

All go through AudioCommand::PlayChime(Chime); their volume was decided only by the runtime (audio_rt.rs: output volume setting). Emitted by voice/connection.rs (mute, unmute, deafen, undeafen, user move, voice disconnect, own join), voice/live.rs (user join/leave), voice/stream/golive.rs (screen share start/stop), voice/stream/watch.rs (viewer join/leave), voice/calls.rs (incoming call). Soundboard and entrance clips (PlayClip) have their own volumes and are not notification sounds in the original either. No message sound is played by the client yet. Hence NotificationSound::ALL = Mute, Unmute, Deafen, Undeafen, UserJoin, UserLeave, UserMove, ViewerJoin, ViewerLeave, VoiceDisconnect, IncomingCall, ScreenShareStart, ScreenShareStop (one per Chime, mapping exhaustive both ways). The original's Message / DirectMessage / SameChannelMessage / CameraOn / CameraOff have no switch because nothing plays them.

Strings copied (fork ba98441b4)

Notifications.tsx: "Enable desktop notifications", "Uses the OS notification center. For per-channel/per-community controls, right-click a community icon and open notification settings."; UserMessageDescriptors.ts: "Enable unread message badge", "Push notification inactive timeout", "Preview sound"; PushSettings.tsx: "{productName} avoids sending push notifications ... before you receive push notifications." (productName = core's PRODUCT_NAME), "1 minute", "{n} minutes"; MentionPreferenceTab.tsx: "Reply mention preference", "No preference", "Prefer @mention", "Prefer no @mention" and their three descriptions; NotificationsTabSounds.tsx: "Master volume", "Sets the level for every sound effect. Per-sound overrides ignore this.", "Reset to default volume", "Disable all notification sounds", "Your existing notification sound settings will be preserved.", "Show more sound effects", "Show fewer sound effects"; section titles "General", "Mention preference", "Sounds"; sound labels from SoundLabels.ts.

Deviations from the plan (reviewer, please look)

  1. Mention preference is not a user-settings field. The plan says SetMentionPreference is an optimistic PatchUserSettings; the server has mention_flags only on the user (UserRequestSchemas.ts:108-111, PATCH /users/@me, UserAccountController.ts:134-160; the original calls UserCommands.update({mention_flags})). So this task touches, minimally: fluxer-proto (UserSettingsPatch::afk_timeout, UserPrivate::mention_flags, new UserPatch, AFK_TIMEOUT_MIN/MAX exported; spec contract and the user_me.json fixture gain mention_flags), fluxer-api (patch_me, wiremock test), fluxer-core::effect (ApiRequest::PatchMe, appended) and one routing arm in apps/fluxer/src/runtime.rs.
  2. AudioCommand::PlayChimeAt { chime, gain } appended (and one arm in apps/fluxer/src/audio_rt.rs, the chime playback moved into a helper) so the master volume reaches the engine without changing the shape of PlayChime, which ~20 existing voice tests assert. PlayChime is kept when the master volume is 100 %.
  3. app.rs: one call to shell::notif_prefs::follow right after effects.finish() (placed away from the line Shell 13 adds for its badge/sound gate). sound_volume also reads ShellState::sound_allowed, so Shell 13's gate and this one agree on PlayChimeAt too.
  4. Persistence of the sounds, joined with Shell 7 (#851) per the orchestrator's decision: one field, one on-disk owner. LocalSettings::notification_prefs is removed; Shell 7's LocalSettings::notification_sounds: Box<StoredNotificationSounds> is the only stored form of [notifications.sounds] and the only thing fluxer-platform reads and writes (unchanged). NotificationPrefs is a view: NotificationPrefs::from_stored(&StoredNotificationSounds) (unknown names ignored, the original's defaults for missing ones) and NotificationPrefs::apply_to(&self, &mut StoredNotificationSounds) (writes the known names, leaves the rest). A change goes through NotificationPrefsAction::apply_to(self, &mut StoredNotificationSounds) in persist::reduce (the same path as ShellSettingChange): it writes only the name it changes (master_volume, disabled or the sound's), so a newer version's names and values survive a load → change → save. sound_volume, follow and notifications_page read the view. The carrier needed nothing new (StoredValue::Int / Bool already cover the volume and the switches).
  5. The tests were written after the module in this run, not before (they passed on first run); the plan's six test names are all present (master_volume_scales_and_clamps, disable_all_and_per_sound, afk_timeout_patch_and_revert, mention_preference_patch_and_revert, page_model_strings, stored_round_trip) plus sound_changes_are_saved and all_arrays_are_exhaustive.

How it was tested

  • crates/fluxer-core/tests/shell_notif_prefs.rs (10 tests; since the join view_of_the_stored_table and a_change_writes_only_its_own_name: a change writes exactly one name into a table holding unknown names and values, and the preview / timeout / mention write none),
  • apps/fluxer/src/runtime.rs::tests::notification_sound_switch_reaches_the_settings_file: a file with a planted unknown sound and value, loaded through the runtime's persistence, a sound switched in the store, the store's SaveSettings executed: the file on disk holds mute = false and still the planted names, and the next load's view has the sound off, crates/fluxer-api/tests/guild_settings.rs::mention_preference_and_afk_timeout_patches (wiremock), proto contract/roundtrip tests.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally. No real-display tests apply (pure core; no UI change, so no screenshots). Nothing Windows-specific.

Closes #806
Closes #858

🤖 Generated with Claude Code

https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K

Stacked on: origin/shell-6-core-shell-ports-settings (already merged into `shell`; the merge was a no-op) ## What this builds (plan Task 14, spec §9, §3 rows 57-59) `fluxer-core::shell::notif_prefs`: - `NotificationPrefs { master_volume: u8 (0-200, 100), all_disabled, disabled: BTreeSet<NotificationSound> }` with `apply`, `stored` / `apply_stored` (value by value, out-of-range volume clamped as `clampVolume`). **Not stored itself** (since the join with Shell 7, below): a view of Shell 7's `LocalSettings::notification_sounds: StoredNotificationSounds`, the only stored form, read with `NotificationPrefs::from_stored` and changed with `NotificationPrefsAction::apply_to`, saved by `persist` on every sound change. - `sound_volume(app, sound) -> Option<f32>`: `None` when the sound is off, all sounds are off, or `ShellState::sound_allowed` is false; else the master gain. `notif_prefs::follow` runs once after the reducers (`app.rs`) and passes **every** `AudioCommand::PlayChime` through it: dropped, kept at 100 %, or rewritten to the new `AudioCommand::PlayChimeAt { chime, gain }` (the runtime multiplies it into the output volume). `PreviewSound` plays at the master volume, even with its own switch off, not while all sounds are off (as the original disables the button). - `ShellAction::NotificationPrefs(NotificationPrefsAction)` (appended): `SetMasterVolume`, `SetAllSoundsDisabled`, `SetSoundEnabled`, `PreviewSound`, `SetAfkTimeout(seconds)`, `SetMentionPreference(MentionPreference)`. - `SetAfkTimeout`: clamped to 60-600 s, an optimistic `PATCH /users/@me/settings {afk_timeout}` inside the presence's existing write list (shown at once, `afk` follows it, reverted on `EffectFailed`); `PresenceState::afk_timeout()`. - `SetMentionPreference`: optimistic `ApiRequest::PatchMe {mention_flags}` answered with the existing `ApiResult::Me` (the session takes the user), reverted on failure; `mention_preference(app)`. - `notifications_page(app) -> NotificationsPageModel`: General (desktop notifications, unread badge, inactive timeout 1-10 minutes), Mention preference (three radios), Sounds (master volume 0-200 with markers and reset, "Disable all notification sounds", a row per sound with "Preview sound" and the common/"Show more sound effects" split). ### Step 0: the sounds the client plays today All go through `AudioCommand::PlayChime(Chime)`; their volume was decided only by the runtime (`audio_rt.rs`: output volume setting). Emitted by `voice/connection.rs` (mute, unmute, deafen, undeafen, user move, voice disconnect, own join), `voice/live.rs` (user join/leave), `voice/stream/golive.rs` (screen share start/stop), `voice/stream/watch.rs` (viewer join/leave), `voice/calls.rs` (incoming call). Soundboard and entrance clips (`PlayClip`) have their own volumes and are not notification sounds in the original either. No message sound is played by the client yet. Hence `NotificationSound::ALL` = Mute, Unmute, Deafen, Undeafen, UserJoin, UserLeave, UserMove, ViewerJoin, ViewerLeave, VoiceDisconnect, IncomingCall, ScreenShareStart, ScreenShareStop (one per `Chime`, mapping exhaustive both ways). The original's Message / DirectMessage / SameChannelMessage / CameraOn / CameraOff have no switch because nothing plays them. ### Strings copied (fork `ba98441b4`) `Notifications.tsx`: "Enable desktop notifications", "Uses the OS notification center. For per-channel/per-community controls, right-click a community icon and open notification settings."; `UserMessageDescriptors.ts`: "Enable unread message badge", "Push notification inactive timeout", "Preview sound"; `PushSettings.tsx`: "{productName} avoids sending push notifications ... before you receive push notifications." (productName = core's `PRODUCT_NAME`), "1 minute", "{n} minutes"; `MentionPreferenceTab.tsx`: "Reply mention preference", "No preference", "Prefer @mention", "Prefer no @mention" and their three descriptions; `NotificationsTabSounds.tsx`: "Master volume", "Sets the level for every sound effect. Per-sound overrides ignore this.", "Reset to default volume", "Disable all notification sounds", "Your existing notification sound settings will be preserved.", "Show more sound effects", "Show fewer sound effects"; section titles "General", "Mention preference", "Sounds"; sound labels from `SoundLabels.ts`. ## Deviations from the plan (reviewer, please look) 1. **Mention preference is not a user-settings field.** The plan says `SetMentionPreference` is an optimistic `PatchUserSettings`; the server has `mention_flags` only on the user (`UserRequestSchemas.ts:108-111`, `PATCH /users/@me`, `UserAccountController.ts:134-160`; the original calls `UserCommands.update({mention_flags})`). So this task touches, minimally: `fluxer-proto` (`UserSettingsPatch::afk_timeout`, `UserPrivate::mention_flags`, new `UserPatch`, `AFK_TIMEOUT_MIN/MAX` exported; spec contract and the `user_me.json` fixture gain `mention_flags`), `fluxer-api` (`patch_me`, wiremock test), `fluxer-core::effect` (`ApiRequest::PatchMe`, appended) and one routing arm in `apps/fluxer/src/runtime.rs`. 2. **`AudioCommand::PlayChimeAt { chime, gain }` appended** (and one arm in `apps/fluxer/src/audio_rt.rs`, the chime playback moved into a helper) so the master volume reaches the engine without changing the shape of `PlayChime`, which ~20 existing voice tests assert. `PlayChime` is kept when the master volume is 100 %. 3. **`app.rs`**: one call to `shell::notif_prefs::follow` right after `effects.finish()` (placed away from the line Shell 13 adds for its badge/sound gate). `sound_volume` also reads `ShellState::sound_allowed`, so Shell 13's gate and this one agree on `PlayChimeAt` too. 4. **Persistence of the sounds, joined with Shell 7 (#851) per the orchestrator's decision: one field, one on-disk owner.** `LocalSettings::notification_prefs` is removed; Shell 7's `LocalSettings::notification_sounds: Box<StoredNotificationSounds>` is the only stored form of `[notifications.sounds]` and the only thing `fluxer-platform` reads and writes (unchanged). `NotificationPrefs` is a view: `NotificationPrefs::from_stored(&StoredNotificationSounds)` (unknown names ignored, the original's defaults for missing ones) and `NotificationPrefs::apply_to(&self, &mut StoredNotificationSounds)` (writes the known names, leaves the rest). A change goes through `NotificationPrefsAction::apply_to(self, &mut StoredNotificationSounds)` in `persist::reduce` (the same path as `ShellSettingChange`): it writes only the name it changes (`master_volume`, `disabled` or the sound's), so a newer version's names and values survive a load → change → save. `sound_volume`, `follow` and `notifications_page` read the view. The carrier needed nothing new (`StoredValue::Int` / `Bool` already cover the volume and the switches). 5. The tests were written after the module in this run, not before (they passed on first run); the plan's six test names are all present (`master_volume_scales_and_clamps`, `disable_all_and_per_sound`, `afk_timeout_patch_and_revert`, `mention_preference_patch_and_revert`, `page_model_strings`, `stored_round_trip`) plus `sound_changes_are_saved` and `all_arrays_are_exhaustive`. ## How it was tested - `crates/fluxer-core/tests/shell_notif_prefs.rs` (10 tests; since the join `view_of_the_stored_table` and `a_change_writes_only_its_own_name`: a change writes exactly one name into a table holding unknown names and values, and the preview / timeout / mention write none), - `apps/fluxer/src/runtime.rs::tests::notification_sound_switch_reaches_the_settings_file`: a file with a planted unknown sound and value, loaded through the runtime's persistence, a sound switched in the store, the store's `SaveSettings` executed: the file on disk holds `mute = false` and still the planted names, and the next load's view has the sound off, `crates/fluxer-api/tests/guild_settings.rs::mention_preference_and_afk_timeout_patches` (wiremock), proto contract/roundtrip tests. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. No real-display tests apply (pure core; no UI change, so no screenshots). Nothing Windows-specific. Closes #806 Closes #858 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
The notification settings write the inactive timeout through
PATCH /users/@me/settings (`afk_timeout`, UserRequestSchemas.ts:380) and the
reply mention preference through PATCH /users/@me (`mention_flags`,
UserRequestSchemas.ts:108-111, UserAccountController.ts:134-160), whose
answer is the private user carrying `mention_flags`
(UserResponseSchemas.ts:68-72). The user_me.json fixture gains
`"mention_flags": 1` as that schema has it (an optional integer).

Refs #806

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
shell::notif_prefs: the notification sounds' master volume (0-200 %),
"Disable all notification sounds" and a switch per sound the client plays
(NotificationSound::ALL, one per bundled Chime), applied to every PlayChime
after the reducers (dropped when off or when the system disallows sounds,
PlayChimeAt at the master volume otherwise) and the preview; the inactive
timeout (PATCH /users/@me/settings {afk_timeout}) and the reply mention
preference (PATCH /users/@me {mention_flags}), both shown at once and put
back when the write fails; notifications_page with the original's strings
(notifications_tab/*.tsx, SoundLabels.ts).

Refs #806

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

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

Independent review: Shell 14 (notification settings), head 3b79e2c7

Reviewed git diff 158c90dd..origin/shell-14-core-notification-settings-inactive cold.

Gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh review worktree: all steps passed.

Checks

  1. Plan tests: all six named tests exist (master_volume_scales_and_clamps, disable_all_and_per_sound, afk_timeout_patch_and_revert, mention_preference_patch_and_revert, page_model_strings, stored_round_trip), plus sound_changes_are_saved and all_arrays_are_exhaustive. They assert the spec's values: 0–200 % master volume with a default of 100, a 60–600 s timeout shown as 1–10 minutes, and flags 0/1/2. The revert tests drive EffectFailed.
  2. Interfaces: NotificationPrefs { master_volume: u8, all_disabled, disabled: BTreeSet<NotificationSound> } with stored/apply_stored, NotificationSound::ALL (append-only, with an exhaustiveness test), sound_volume(app, sound) -> Option<f32> and notifications_page(app) -> NotificationsPageModel all exist. ShellAction::NotificationPrefs, ApiRequest::PatchMe and AudioCommand::PlayChimeAt are appended, and no existing variant changed shape.
  3. Invariants: fluxer-core imports no iced/wgpu/winit/reqwest/tungstenite and does no I/O. UserPrivate.mention_flags and UserPatch match UserResponseSchemas.ts:68-72 and UserRequestSchemas.ts:108, and UserSettingsPatch.afk_timeout matches :380. The new fields are optional and skipped when unset, so the round-trip and spec-contract tests pass. No path panics on server data: from_flags maps any value, and timeout_minutes saturates. No secrets appear in the code or fixtures.
  4. Parity, spot-checked against the fork:
    • Sound names (deaf, undeaf, incoming-ring, …) match SoundUtils.ts:31-48.
    • The sound labels and their order match SoundLabels.ts.
    • COMMON_SOUND_TYPES matches NotificationsTabSounds.tsx:115.
    • The preview plays at the master volume even when the sound's own switch is off, and is disabled while all sounds are off. This matches Sound.ts:329 previewSound and NotificationsTabSounds.tsx:186.
    • The master multiplier matches getEffectiveMultiplier.
    • The timeout is rounded to minutes with Math.max(1, Math.min(10, Math.round(s/60))), and the write is afkTimeout: value*60, as in Notifications.tsx:116.
    • The mention preference is written with PATCH /users/@me, as in MentionPreferenceTab.tsx (UserCommands.update). The PR's deviation from the plan is therefore correct.
  5. Review Focus 7: NotificationSound::ALL is append-only and has its exhaustiveness test. of_chime is an exhaustive match, so a new Chime will not compile until it has a sound.

Findings

  • minor (process): The task modifies fluxer-proto, fluxer-api and apps/fluxer as well as fluxer-core. The plan names only fluxer-core, and CLAUDE.md says protocol changes start in fluxer-proto as their own task. The deviation is justified (the original writes mention_flags on the user, not in user settings) and is documented in the PR. The orchestrator should acknowledge it before merging.
  • minor (process): The PR expects a conflict with Shell 7 in crates/fluxer-core/src/persist.rs. That file is not a registration file, and Global Constraints say such a conflict goes to the orchestrator rather than being resolved by keeping both sides. Please flag it when merging. #858 tracks the wiring.
  • minor (behaviour, tracked): Until #858 lands, the sound settings live only in memory and are lost on restart. This is accepted as a follow-up; it does not corrupt existing data.
  • minor (interface): The plan writes SetMentionPreference(flags); the code takes a MentionPreference enum, with flags()/from_flags(). Task 39 reads it through the page model, so nothing breaks.
  • minor (robustness): notif_prefs::reduce settles the oldest pending mention write on any ApiResult::Me, because the answer carries no request id. An unrelated Me, today only the restore path, could settle a write early. The effect is cosmetic: the session's user is then shown.

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

## Independent review: Shell 14 (notification settings), head 3b79e2c7 Reviewed `git diff 158c90dd..origin/shell-14-core-notification-settings-inactive` cold. **Gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh review worktree: **all steps passed**. ### Checks 1. **Plan tests:** all six named tests exist (`master_volume_scales_and_clamps`, `disable_all_and_per_sound`, `afk_timeout_patch_and_revert`, `mention_preference_patch_and_revert`, `page_model_strings`, `stored_round_trip`), plus `sound_changes_are_saved` and `all_arrays_are_exhaustive`. They assert the spec's values: 0–200 % master volume with a default of 100, a 60–600 s timeout shown as 1–10 minutes, and flags 0/1/2. The revert tests drive `EffectFailed`. 2. **Interfaces:** `NotificationPrefs { master_volume: u8, all_disabled, disabled: BTreeSet<NotificationSound> }` with `stored`/`apply_stored`, `NotificationSound::ALL` (append-only, with an exhaustiveness test), `sound_volume(app, sound) -> Option<f32>` and `notifications_page(app) -> NotificationsPageModel` all exist. `ShellAction::NotificationPrefs`, `ApiRequest::PatchMe` and `AudioCommand::PlayChimeAt` are appended, and no existing variant changed shape. 3. **Invariants:** fluxer-core imports no iced/wgpu/winit/reqwest/tungstenite and does no I/O. `UserPrivate.mention_flags` and `UserPatch` match `UserResponseSchemas.ts:68-72` and `UserRequestSchemas.ts:108`, and `UserSettingsPatch.afk_timeout` matches `:380`. The new fields are optional and skipped when unset, so the round-trip and spec-contract tests pass. No path panics on server data: `from_flags` maps any value, and `timeout_minutes` saturates. No secrets appear in the code or fixtures. 4. **Parity, spot-checked against the fork:** - Sound names (`deaf`, `undeaf`, `incoming-ring`, …) match `SoundUtils.ts:31-48`. - The sound labels and their order match `SoundLabels.ts`. - `COMMON_SOUND_TYPES` matches `NotificationsTabSounds.tsx:115`. - The preview plays at the master volume even when the sound's own switch is off, and is disabled while all sounds are off. This matches `Sound.ts:329` `previewSound` and `NotificationsTabSounds.tsx:186`. - The master multiplier matches `getEffectiveMultiplier`. - The timeout is rounded to minutes with `Math.max(1, Math.min(10, Math.round(s/60)))`, and the write is `afkTimeout: value*60`, as in `Notifications.tsx:116`. - The mention preference is written with `PATCH /users/@me`, as in `MentionPreferenceTab.tsx` (`UserCommands.update`). The PR's deviation from the plan is therefore correct. 5. **Review Focus 7:** `NotificationSound::ALL` is append-only and has its exhaustiveness test. `of_chime` is an exhaustive match, so a new `Chime` will not compile until it has a sound. ### Findings - **minor (process):** The task modifies fluxer-proto, fluxer-api and apps/fluxer as well as fluxer-core. The plan names only fluxer-core, and CLAUDE.md says protocol changes start in fluxer-proto as their own task. The deviation is justified (the original writes `mention_flags` on the user, not in user settings) and is documented in the PR. The orchestrator should acknowledge it before merging. - **minor (process):** The PR expects a conflict with Shell 7 in `crates/fluxer-core/src/persist.rs`. That file is not a registration file, and Global Constraints say such a conflict goes to the orchestrator rather than being resolved by keeping both sides. Please flag it when merging. #858 tracks the wiring. - **minor (behaviour, tracked):** Until #858 lands, the sound settings live only in memory and are lost on restart. This is accepted as a follow-up; it does not corrupt existing data. - **minor (interface):** The plan writes `SetMentionPreference(flags)`; the code takes a `MentionPreference` enum, with `flags()`/`from_flags()`. Task 39 reads it through the page model, so nothing breaks. - **minor (robustness):** `notif_prefs::reduce` settles the oldest pending mention write on any `ApiResult::Me`, because the answer carries no request id. An unrelated `Me`, today only the restore path, could settle a write early. The effect is cosmetic: the session's user is then shown. **Verdict: approved.** No blocking findings, and the gate is green.
One field, one on-disk owner. LocalSettings::notification_sounds (Task 7's
StoredNotificationSounds) is the only stored form of [notifications.sounds];
Task 14's notification_prefs field is gone. NotificationPrefs is a view:
NotificationPrefs::from_stored (unknown names ignored, the original's
defaults for missing ones) and apply_to. persist::reduce writes a change
through NotificationPrefsAction::apply_to, which sets only the name the
change touches, so a newer version's names survive a load, change and save.

Tests: shell_notif_prefs view_of_the_stored_table and
a_change_writes_only_its_own_name; runtime
notification_sound_switch_reaches_the_settings_file (switch -> file on disk
holds the change and a planted unknown name -> reload sees it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Joined with Task 7 per the orchestrator's decision: one field, one on-disk owner. LocalSettings::notification_prefs is removed; Task 7's LocalSettings::notification_sounds: StoredNotificationSounds is the only stored form of [notifications.sounds] and the only thing fluxer-platform reads and writes (unchanged). NotificationPrefs is now a view in fluxer-core: NotificationPrefs::from_stored (unknown names ignored, the original's defaults for missing ones) and apply_to; persist::reduce writes each change with NotificationPrefsAction::apply_to, which sets only the name the change touches (master_volume, disabled or the sound's), so unknown names and values survive load → change → save. sound_volume, follow and notifications_page read the view. The carrier needed no extension. New tests: shell_notif_prefs::{view_of_the_stored_table, a_change_writes_only_its_own_name} and runtime::tests::notification_sound_switch_reaches_the_settings_file (switch in the store → the runtime's save → the file has mute = false and still the planted future-sound / message_volume; the next load sees it). Merge commit cda9f301; full gate (FLUXER_SCREENSHOT_TESTS=1 dbus-run-session -- cargo xtask ci): all steps passed. Closes #858.

Joined with Task 7 per the orchestrator's decision: one field, one on-disk owner. `LocalSettings::notification_prefs` is removed; Task 7's `LocalSettings::notification_sounds: StoredNotificationSounds` is the only stored form of `[notifications.sounds]` and the only thing fluxer-platform reads and writes (unchanged). `NotificationPrefs` is now a view in fluxer-core: `NotificationPrefs::from_stored` (unknown names ignored, the original's defaults for missing ones) and `apply_to`; `persist::reduce` writes each change with `NotificationPrefsAction::apply_to`, which sets only the name the change touches (`master_volume`, `disabled` or the sound's), so unknown names and values survive load → change → save. `sound_volume`, `follow` and `notifications_page` read the view. The carrier needed no extension. New tests: `shell_notif_prefs::{view_of_the_stored_table, a_change_writes_only_its_own_name}` and `runtime::tests::notification_sound_switch_reaches_the_settings_file` (switch in the store → the runtime's save → the file has `mute = false` and still the planted `future-sound` / `message_volume`; the next load sees it). Merge commit cda9f301; full gate (`FLUXER_SCREENSHOT_TESTS=1 dbus-run-session -- cargo xtask ci`): all steps passed. Closes #858.
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 08:01:36 +00:00
Author
Owner

Independent review: Shell 14 (core-notification-settings-inactive), head cda9f301c

Reviewed git diff a68e4701d..origin/shell-14-core-notification-settings-inactive from scratch. The branch is already an ancestor of origin/shell, so this review checks the code after the merge.

Gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh worktree at cda9f301c: all steps passed (exit 0).

Checks

  1. Plan tests: all six exist in crates/fluxer-core/tests/shell_notif_prefs.rs (master_volume_scales_and_clamps, disable_all_and_per_sound, afk_timeout_patch_and_revert, mention_preference_patch_and_revert, page_model_strings, stored_round_trip). They check the spec values: 0–200 % with a default of 100, a timeout of 60–600 s offered as 1–10 minutes, mention_flags 0/1/2, and the strings. Extra tests cover saving, the view of the stored table, writes that change only one name, and ALL exhaustiveness. The runtime test notification_sound_switch_reaches_the_settings_file shows that names written by a newer version survive a save.
  2. Interfaces: NotificationPrefs { master_volume: u8, all_disabled, disabled: BTreeSet<NotificationSound> } with stored is present, and so are sound_volume(app, sound) -> Option<f32>, NotificationSound::ALL, notifications_page(app) -> NotificationsPageModel (General / Mention preference / Sounds), SetAfkTimeout(seconds) and SetMentionPreference. ShellAction::NotificationPrefs and AudioCommand::PlayChimeAt are appended at the end.
  3. Invariants: fluxer-core does no I/O and has no forbidden imports. Server data cannot panic the client: afk_timeout and the volume are clamped, try_from has a fallback, and an unknown mention_flags value reads as no preference. Unknown names in [notifications.sounds] are kept. There are no secrets, and the only log lines are the setting name and the error. The fixture user_me.json gains mention_flags, as in UserResponseSchemas.ts. The proto change is checked against the OpenAPI document (spec_contract).
  4. Parity, checked against the fork: the timeout rounding matches Math.max(1, Math.min(10, Math.round(afkTimeout/60))) (PushSettings.tsx). The mention preference is UserCommands.update({mention_flags}), i.e. PATCH /users/@me, and flagToValue matches (MentionPreferenceTab.tsx). DEFAULT_MASTER_VOLUME = 100, MAX_VOLUME_PERCENT = 200 and clampVolume match Sound.ts. Preview is disabled while all sounds are off, and the order of the common sounds matches (NotificationsTabSounds.tsx). Labels match SoundLabels.ts. Sound names match SoundUtils.ts (deaf, incoming-ring, ...). The only sound the original disables by default (SameChannelMessage) is not one this client plays, so the defaults agree.
  5. Review Focus 7: both registries (NotificationSound::ALL, MentionPreference::ALL) are append-only and have exhaustiveness tests. of_chime is an exhaustive match, so a new Chime will not compile without its sound.

Findings

  • minor: the task touches fluxer-proto, fluxer-api and apps/fluxer as well as fluxer-core. Task 14 is not on the plan's list of tasks allowed to touch two crates. The extra changes are needed (there was no PATCH /users/@me and no afk_timeout in the patch type) and they are small, so this is a process note only.
  • minor: notif_prefs::reduce treats any ApiResult::Me as the reply to the oldest pending mention write. A Me from another request, such as a profile edit, can therefore pop that write early. The page then shows the server's value until the real reply arrives. This is only a brief visual effect and loses no data.
  • minor: sound_volume builds NotificationPrefs::from_stored from the table on every chime and every call to the page model. This is cheap at 15 entries, but a cached view would be tidier.

Verdict: APPROVED. No blocking findings, and CI is green locally.

## Independent review: Shell 14 (core-notification-settings-inactive), head cda9f301c Reviewed `git diff a68e4701d..origin/shell-14-core-notification-settings-inactive` from scratch. The branch is already an ancestor of `origin/shell`, so this review checks the code after the merge. **Gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh worktree at cda9f301c: **all steps passed** (exit 0). ### Checks 1. **Plan tests:** all six exist in `crates/fluxer-core/tests/shell_notif_prefs.rs` (`master_volume_scales_and_clamps`, `disable_all_and_per_sound`, `afk_timeout_patch_and_revert`, `mention_preference_patch_and_revert`, `page_model_strings`, `stored_round_trip`). They check the spec values: 0–200 % with a default of 100, a timeout of 60–600 s offered as 1–10 minutes, `mention_flags` 0/1/2, and the strings. Extra tests cover saving, the view of the stored table, writes that change only one name, and `ALL` exhaustiveness. The runtime test `notification_sound_switch_reaches_the_settings_file` shows that names written by a newer version survive a save. 2. **Interfaces:** `NotificationPrefs { master_volume: u8, all_disabled, disabled: BTreeSet<NotificationSound> }` with `stored` is present, and so are `sound_volume(app, sound) -> Option<f32>`, `NotificationSound::ALL`, `notifications_page(app) -> NotificationsPageModel` (General / Mention preference / Sounds), `SetAfkTimeout(seconds)` and `SetMentionPreference`. `ShellAction::NotificationPrefs` and `AudioCommand::PlayChimeAt` are appended at the end. 3. **Invariants:** fluxer-core does no I/O and has no forbidden imports. Server data cannot panic the client: `afk_timeout` and the volume are clamped, `try_from` has a fallback, and an unknown `mention_flags` value reads as no preference. Unknown names in `[notifications.sounds]` are kept. There are no secrets, and the only log lines are the setting name and the error. The fixture `user_me.json` gains `mention_flags`, as in `UserResponseSchemas.ts`. The proto change is checked against the OpenAPI document (`spec_contract`). 4. **Parity, checked against the fork:** the timeout rounding matches `Math.max(1, Math.min(10, Math.round(afkTimeout/60)))` (`PushSettings.tsx`). The mention preference is `UserCommands.update({mention_flags})`, i.e. `PATCH /users/@me`, and `flagToValue` matches (`MentionPreferenceTab.tsx`). `DEFAULT_MASTER_VOLUME = 100`, `MAX_VOLUME_PERCENT = 200` and `clampVolume` match `Sound.ts`. Preview is disabled while all sounds are off, and the order of the common sounds matches (`NotificationsTabSounds.tsx`). Labels match `SoundLabels.ts`. Sound names match `SoundUtils.ts` (`deaf`, `incoming-ring`, ...). The only sound the original disables by default (`SameChannelMessage`) is not one this client plays, so the defaults agree. 5. **Review Focus 7:** both registries (`NotificationSound::ALL`, `MentionPreference::ALL`) are append-only and have exhaustiveness tests. `of_chime` is an exhaustive match, so a new `Chime` will not compile without its sound. ### Findings - **minor:** the task touches fluxer-proto, fluxer-api and apps/fluxer as well as fluxer-core. Task 14 is not on the plan's list of tasks allowed to touch two crates. The extra changes are needed (there was no `PATCH /users/@me` and no `afk_timeout` in the patch type) and they are small, so this is a process note only. - **minor:** `notif_prefs::reduce` treats any `ApiResult::Me` as the reply to the oldest pending mention write. A `Me` from another request, such as a profile edit, can therefore pop that write early. The page then shows the server's value until the real reply arrives. This is only a brief visual effect and loses no data. - **minor:** `sound_volume` builds `NotificationPrefs::from_stored` from the table on every chime and every call to the page model. This is cheap at 15 entries, but a cached view would be tidier. **Verdict: APPROVED.** No blocking findings, and CI is green locally.

Pull request closed

Sign in to join this conversation.
No description provided.