Daily use 24: core notification icon, click intent, passive updates (#512) #588

Closed
charles wants to merge 0 commits from dailyuse-24-core-notification-icon-passive into dailyuse
Owner

Daily use 24: notification icon, click intent, passive updates (fluxer-core).

What was built

  • Notification.icon is filled for every notification: the author's member avatar in the channel's guild, else the user avatar, else the default avatar, as a still PNG at 128 px (media_urls::notification_avatar, NOTIFICATION_ICON_SIZE; port of getNotificationIconURL / getGuildMemberNotificationAvatarURL / getUserNotificationAvatarURL, AvatarUtils.ts:237-302). AVATAR_UNSET gives the default avatar, an a_ hash its first frame, an invalid hash no URL (#54).
  • UserAction::NotificationClicked { channel_id, message_id } pushes Effect::Window(WindowCommand::Raise) and, while logged in, follow-ups SelectGuild (when the guild changes; None for a DM), SelectChannel, JumpToMessage, the same as the search "Jump" (NotificationsIpc.ts:175-183, #55).
  • PASSIVE_UPDATES: read_state::apply_passive raises last_message_id of each named known text-based channel or thread of that guild when the id is newer (Channels.handlePassiveLastMessageUpdates), so the unread and mute rules apply. voice_states go into app.voice.states, using the update's guild when a state has none (MediaEngine.handlePassiveVoiceStates) (#196).
  • Op 14 active: Text chat's member_list::subscribe already sends {active: true, sync: true} for the selected guild once per gateway session (and again after READY or RESUMED). The member list only opens for the selected guild, so nothing was missing. member_list.rs is unchanged; selected_guild_marked_active pins the behaviour.

Tests

  • New: tests/notification_icon.rs (icon_member_then_user_then_default_png_128, click_selects_jumps_and_raises, click_while_logged_out_only_raises) and tests/passive_updates.rs (passive_update_marks_unread, passive_update_ignores_other_guilds_and_non_text_channels, passive_update_on_muted_channel_not_unread, passive_voice_states_applied, selected_guild_marked_active). They use the existing fixtures/gateway/passive_updates.json (shape from gw/guild/guild_passive_sync.erl:211-217).
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally. No desktop tests apply to this task, and no screenshots changed.
  • apps/fluxer/tests/textchat_acceptance.rs textchat_session_end_to_end is flaky here (1 failure in 3 runs, MESSAGE_UPDATE after a pin). This branch does not touch that path; filed as #586.

Deviations from the plan

  • Notification.icon is now Option<AvatarSource>, not Option<Url>. The default avatar is a bundled image with no URL, and the plan (and spec §6.2, "icon: AvatarRef") wants it as the last fallback. The store always sets Some. Literals that set icon: None still compile, and nothing read the field yet, so Task 28 picks the PNG URL or the bundled default by index.
  • Outside the Files list: effect.rs (the field type), app.rs (two call sites: apply_passive after the channels reducer, on_click follow-ups), tests/notifications.rs (its expected icon is now the default avatar) and tests/dailyuse_ports.rs (NotificationClicked now has effects).
  • The self-hosted Fluxerbot branding avatar (getSystemUserBrandingAvatarURL) is not followed, because the client has no instance branding.

Stacked on: dailyuse-13-core-honour-mutes, dailyuse-17-core-channel-guild-menus, dailyuse-21-core-voice-refusals, dailyuse-22a-core-mark-unread-attachments

Closes #512
Refs #54, #55 (closed by Daily use 28)
Closes #196

🤖 Generated with Claude Code

Daily use 24: notification icon, click intent, passive updates (fluxer-core). **What was built** - `Notification.icon` is filled for every notification: the author's member avatar in the channel's guild, else the user avatar, else the default avatar, as a still PNG at 128 px (`media_urls::notification_avatar`, `NOTIFICATION_ICON_SIZE`; port of `getNotificationIconURL` / `getGuildMemberNotificationAvatarURL` / `getUserNotificationAvatarURL`, `AvatarUtils.ts:237-302`). `AVATAR_UNSET` gives the default avatar, an `a_` hash its first frame, an invalid hash no URL (#54). - `UserAction::NotificationClicked { channel_id, message_id }` pushes `Effect::Window(WindowCommand::Raise)` and, while logged in, follow-ups `SelectGuild` (when the guild changes; `None` for a DM), `SelectChannel`, `JumpToMessage`, the same as the search "Jump" (`NotificationsIpc.ts:175-183`, #55). - `PASSIVE_UPDATES`: `read_state::apply_passive` raises `last_message_id` of each named known text-based channel or thread of that guild when the id is newer (`Channels.handlePassiveLastMessageUpdates`), so the unread and mute rules apply. `voice_states` go into `app.voice.states`, using the update's guild when a state has none (`MediaEngine.handlePassiveVoiceStates`) (#196). - Op 14 active: Text chat's `member_list::subscribe` already sends `{active: true, sync: true}` for the selected guild once per gateway session (and again after READY or RESUMED). The member list only opens for the selected guild, so nothing was missing. `member_list.rs` is unchanged; `selected_guild_marked_active` pins the behaviour. **Tests** - New: `tests/notification_icon.rs` (`icon_member_then_user_then_default_png_128`, `click_selects_jumps_and_raises`, `click_while_logged_out_only_raises`) and `tests/passive_updates.rs` (`passive_update_marks_unread`, `passive_update_ignores_other_guilds_and_non_text_channels`, `passive_update_on_muted_channel_not_unread`, `passive_voice_states_applied`, `selected_guild_marked_active`). They use the existing `fixtures/gateway/passive_updates.json` (shape from `gw/guild/guild_passive_sync.erl:211-217`). - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally. No desktop tests apply to this task, and no screenshots changed. - `apps/fluxer/tests/textchat_acceptance.rs` `textchat_session_end_to_end` is flaky here (1 failure in 3 runs, MESSAGE_UPDATE after a pin). This branch does not touch that path; filed as #586. **Deviations from the plan** - `Notification.icon` is now `Option<AvatarSource>`, not `Option<Url>`. The default avatar is a bundled image with no URL, and the plan (and spec §6.2, "`icon: AvatarRef`") wants it as the last fallback. The store always sets `Some`. Literals that set `icon: None` still compile, and nothing read the field yet, so Task 28 picks the PNG URL or the bundled default by index. - Outside the Files list: `effect.rs` (the field type), `app.rs` (two call sites: `apply_passive` after the channels reducer, `on_click` follow-ups), `tests/notifications.rs` (its expected `icon` is now the default avatar) and `tests/dailyuse_ports.rs` (`NotificationClicked` now has effects). - The self-hosted Fluxerbot branding avatar (`getSystemUserBrandingAvatarURL`) is not followed, because the client has no instance branding. Stacked on: dailyuse-13-core-honour-mutes, dailyuse-17-core-channel-guild-menus, dailyuse-21-core-voice-refusals, dailyuse-22a-core-mark-unread-attachments Closes #512 Refs #54, #55 (closed by Daily use 28) Closes #196 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Refs #495

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every UserAction, CoreEvent, Effect, ApiRequest/ApiResult and chat::Confirm
variant of the Daily use plan (Task 11a), plus the menu types (menus::MenuModel,
MenuItem, MenuItemKind, MenuItemId, MenuModel::flatten). New actions and events
do nothing yet; the runtime answers each new request with 501 CLIENT_NOT_WIRED
and logs Effect::Window until Daily use 28. MessageUser and CloseDm take a
confirmed flag and act as before; Notification gains icon (always None).

Refs #495

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #507

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #496

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
New domains notif_settings, social, invites, switcher, keynav and report with
their state, Default and stub reducers wired into App::apply; stub menu
builders (channel, category, guild, user, dm, mute::item); OwnPresence, profile
notes and modal state. Relationships move from chat::dms to app.social and are
read through social::relationship.

Refs #496

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Refs #507

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #497

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixtures used: fixtures/rest/invite_guild.json, invite_group_dm.json (shaped as
fork:packages/schema/src/domains/invite/InviteSchemas.ts:42-91, Daily use 2).

Refs #501

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #501

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings from READY, USER_GUILD_SETTINGS_UPDATE and the patch answers;
immediate menu mutes (guild scalars, whole channel_overrides map for
channels, categories and DMs in @me), mute_config in ms, local expiry
timers, 3 s debounced modal changes, revert on failure, selectors
is_muted / muted_until / level / guild_settings_modal, and the shared
mute menu row (MuteTargetMenuItem.tsx, MuteOptions.ts,
UserGuildSettings.ts, UserGuildSettingsCommands.ts).

Refs #497

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
format_date_time shifted the end with to_offset, which panics when the
local date leaves year 9999 (a 9999-12-31T23:30Z end read east of UTC).
It now uses checked_to_offset and falls back to UTC. The
event_replaces_guild_settings test now checks the staff override is
really gone instead of an always-true assertion.

Refs #497

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Uses the existing server-shaped fixtures: rest/invite_metadata.json
(POST /channels/{id}/invites, S/invite/InviteSchemas.ts:42-91 plus the
metadata fields), rest/guild.json (POST /guilds, GuildResponse) and
gateway/guild_create.json.

Refs #502

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The invite modal (default invite at open, settings clamped to the
server's limits, link, expiry text, friends and group DMs with
Invite -> Sent through SendMessage), can_invite / invite_channel for the
menus, "Create or join a community" (name, static icon, create then
select the system channel once its GUILD_CREATE is in, join through the
accept flow), and "Leave community" (Confirm::LeaveGuild, no Shift
bypass, no delete_messages; hidden for the owner; on success the guild
goes as its GUILD_DELETE would, so a selected one leaves for the DMs).

Refs #502

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dailyuse_ports listed them among the stubs that do nothing.

Refs #502

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Table tests for the notification decision (Notification.ts:187-256) and
tests for mute consumers: unread, guild pill, hide muted channels, DM
mentions. Stubs for SidebarSection.{category_muted,muted} and
notif_settings::hides_muted_channels so the tests compile.

Refs #498

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- notif_settings::mentions_me as MessageUtils.isMentioned and
  Notification.isMessageMentionLike: blocked author no, user mention,
  @everyone unless suppressed or in an unjoined thread, own role unless
  suppressed, unmuted DM.
- notification_for follows Notification.ts:187-256: own, blocked, DND,
  SUPPRESS_NOTIFICATIONS, then thread levels (member level, parent level,
  forum new-post level, else only mentions) or mute at any level and the
  effective level.
- read_state::unread is false for a muted channel (mention counts kept);
  has_unread_messages keeps the raw answer for the new-messages bar and
  the thread menu's Mark as read.
- channel_tree: category_muted and muted rows; hide muted channels per
  guild (default_hide_muted_channels without an entry), unless selected,
  connected or with a mention; all-hidden categories hidden.
- DmRowModel.muted from the @me override; a thread is muted by its
  membership or its parent at any level.

Refs #498

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #499

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Own presence from the user settings; SetStatus / SetCustomStatus write only
their fields (optimistic, reverted on failure); reset timer; idle and afk
from CoreEvent::Idle; op 3 whenever the computed presence changes; status
popout, custom status modal and custom status selectors.

Refs #499

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
menus::{channel, category, guild} build the original's desktop menus
(AM/ChannelContextMenu.tsx, ChannelMenuData.tsx:429-632,
CategoryMenuData.tsx:263-339, GuildMenuData.tsx:314-497) with the "B"
rows of spec 3.2 (a)-(d). MarkCategoryRead and MarkGuildRead ack in
bulk through POST /read-states/ack; CopyId, CopyChannelLink and the
link channel's "Copy link" write the clipboard. Collapsed categories
are synced as the category override's `collapsed`
(UserGuildSettingsCommands.ts:198-246), written debounced 3 s with the
whole override map; "Hide muted channels" likewise. The sidebar reads
notif_settings::is_collapsed and emits UserAction::ToggleCategory
instead of keeping a local set.

New UserAction variants: CopyLinkChannelUrl, OpenNotificationSettings,
OpenFollowChannel (the last two open UI-owned modals).

Refs #503

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A failed reset PATCH was re-sent at once by the same refresh, with no
limit (a request storm while offline or on 4xx/429). Remember the reset
whose write failed and skip it until READY, USER_SETTINGS_UPDATE or a
patch answer brings new settings, as StatusExpiry.handleExpiry does not
retry. The custom status test now asserts the profile popout exists.

Refs #499

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Relationship fixtures are shaped like RelationshipResponse
(packages/schema/src/domains/user/UserResponseSchemas.ts:492 of the
fork): id, type, user, nickname (nullable, always sent),
share_voice_activity, friend_shares_voice_activity.

Refs #500

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #500

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	crates/fluxer-core/src/app.rs
Refs #504

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
menus::user and menus::dm with the rows of GuildMemberContextMenu,
UserContextMenu, DMContextMenu and GroupDMContextMenu that this client
builds; Mention into the composer; Pin DM; Close DM and Open DM (blocked)
confirms; Invite to community; Report message in the message menu.

Refs #504

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	crates/fluxer-core/README.md
#	crates/fluxer-core/src/app.rs
#	crates/fluxer-core/tests/dailyuse_ports.rs
Refs #508

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Nullish string, as packages/schema/src/domains/message/MessageResponseSchemas.ts:29
and EmbedSchemas.ts:33; saved media recognises an item by it
(FavoriteMemeUtils.isFavorited). The existing fixtures already carry it.

Refs #508

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Refs #508

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Failing tests for Daily use 24, driven with fixtures/gateway/passive_updates.json
(gw/guild/guild_passive_sync.erl:211-217).

Refs #512

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #512

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #512

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

Independent review: Daily use 24 (diff 68c3b53..7e59bd7)

Tests (plan Step 1): all six named tests exist and assert what the plan asks for: icon_member_then_user_then_default_png_128, click_selects_jumps_and_raises, passive_update_marks_unread, passive_update_on_muted_channel_not_unread, passive_voice_states_applied, selected_guild_marked_active. The extra tests (click_while_logged_out_only_raises, passive_update_ignores_other_guilds_and_non_text_channels) are useful additions.

Parity spot-checks against the fork (all match):

  • NotificationIconURL.ts + AvatarUtils.ts:170-216,237-302: order is AVATAR_UNSET → default, then member avatar (guilds/{g}/users/{u}/avatars/{hash}.png?size=128), then user avatar (avatars/{u}/{hash}.png?size=128), then default; an a_ hash is stripped for a still image; no proxy options. Matches.
  • Channels.handlePassiveLastMessageUpdates (Channels.ts:350-373): skips unknown channels, other guilds and types outside TEXT_BASED ∪ THREAD (ChannelConstants.ts, ThreadConstants.ts), and raises the id only when it is newer. takes_passive_updates is the same set. Matches.
  • MediaEngineFacade.handlePassiveVoiceStates:1742-1750: guild_id ?? update.guild_id, then the normal voice-state path. Matches.
  • NotificationsIpc.ts:175-183: restore/show/focus, then navigate. Raise is pushed before the SelectGuild/SelectChannel/JumpToMessage follow-ups. Matches.

Invariants: fluxer-core still does no I/O and pulls in no forbidden crates. Server data cannot cause a panic: hashes are validated before they go into a URL (a path-traversal hash falls back to the default avatar, and a test covers it), and passive updates for unknown channels or guilds are ignored. The passive fixture already existed (proto task). No secrets.

Op 14: I checked that member_list.rs already sends {active: true, sync: true} for the selected guild once per gateway session and again after READY. The test pins this behaviour, so leaving member_list.rs unchanged is correct.

Findings

  1. minor: Interface deviation: Notification.icon is Option<AvatarSource>, while Task 11a specifies Option<Url>. The change is justified. The original's default avatars are bundled assets (AvatarUtils.ts imports media/images/avatars/{0..5}.png), and fluxer-ui already bundles the same PNGs (widgets/avatar.rs:31). Nothing that has merged reads the field yet (Task 27 takes NotificationIcon PNG bytes). However, Task 28 must resolve AvatarSource::Default(i) to fluxer-ui/assets/avatars/{i}.png bytes, and Url through the image cache. The orchestrator should add a note to Task 28's brief.
  2. minor: The self-hosted Fluxerbot branding avatar (getSystemUserBrandingAvatarURL) is not followed. It is acceptable while the client has no branding config, and the PR documents it.
  3. minor: on_click for a channel not in channels.by_id (e.g. a deleted channel) still emits SelectChannel + JumpToMessage without a guild change. This is harmless: there is no panic, and it mirrors the original navigating to a stale URL.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh review worktree: all steps passed (exit 0).

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

🤖 Generated with Claude Code

## Independent review: Daily use 24 (diff 68c3b53..7e59bd7) **Tests (plan Step 1):** all six named tests exist and assert what the plan asks for: `icon_member_then_user_then_default_png_128`, `click_selects_jumps_and_raises`, `passive_update_marks_unread`, `passive_update_on_muted_channel_not_unread`, `passive_voice_states_applied`, `selected_guild_marked_active`. The extra tests (`click_while_logged_out_only_raises`, `passive_update_ignores_other_guilds_and_non_text_channels`) are useful additions. **Parity spot-checks against the fork (all match):** - `NotificationIconURL.ts` + `AvatarUtils.ts:170-216,237-302`: order is AVATAR_UNSET → default, then member avatar (`guilds/{g}/users/{u}/avatars/{hash}.png?size=128`), then user avatar (`avatars/{u}/{hash}.png?size=128`), then default; an `a_` hash is stripped for a still image; no proxy options. Matches. - `Channels.handlePassiveLastMessageUpdates` (`Channels.ts:350-373`): skips unknown channels, other guilds and types outside TEXT_BASED ∪ THREAD (`ChannelConstants.ts`, `ThreadConstants.ts`), and raises the id only when it is newer. `takes_passive_updates` is the same set. Matches. - `MediaEngineFacade.handlePassiveVoiceStates:1742-1750`: `guild_id ?? update.guild_id`, then the normal voice-state path. Matches. - `NotificationsIpc.ts:175-183`: restore/show/focus, then navigate. `Raise` is pushed before the SelectGuild/SelectChannel/JumpToMessage follow-ups. Matches. **Invariants:** fluxer-core still does no I/O and pulls in no forbidden crates. Server data cannot cause a panic: hashes are validated before they go into a URL (a path-traversal hash falls back to the default avatar, and a test covers it), and passive updates for unknown channels or guilds are ignored. The passive fixture already existed (proto task). No secrets. **Op 14:** I checked that `member_list.rs` already sends `{active: true, sync: true}` for the selected guild once per gateway session and again after READY. The test pins this behaviour, so leaving member_list.rs unchanged is correct. ### Findings 1. **minor**: Interface deviation: `Notification.icon` is `Option<AvatarSource>`, while Task 11a specifies `Option<Url>`. The change is justified. The original's default avatars are bundled assets (`AvatarUtils.ts` imports `media/images/avatars/{0..5}.png`), and fluxer-ui already bundles the same PNGs (`widgets/avatar.rs:31`). Nothing that has merged reads the field yet (Task 27 takes `NotificationIcon` PNG bytes). However, **Task 28 must resolve `AvatarSource::Default(i)` to `fluxer-ui/assets/avatars/{i}.png` bytes**, and `Url` through the image cache. The orchestrator should add a note to Task 28's brief. 2. **minor**: The self-hosted Fluxerbot branding avatar (`getSystemUserBrandingAvatarURL`) is not followed. It is acceptable while the client has no branding config, and the PR documents it. 3. **minor**: `on_click` for a channel not in `channels.by_id` (e.g. a deleted channel) still emits `SelectChannel` + `JumpToMessage` without a guild change. This is harmless: there is no panic, and it mirrors the original navigating to a stale URL. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh review worktree: **all steps passed** (exit 0). **Verdict: APPROVED.** No blocking findings, CI is green locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Owner

Merged into dailyuse and textchat at 1089e6a1 (combined merge).

Merged into `dailyuse` and `textchat` at 1089e6a1 (combined merge).
charles closed this pull request 2026-11-15 09:58:49 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.