Daily use 14: core status, custom status, idle and presence (#499) #566

Closed
charles wants to merge 0 commits from dailyuse-14-core-status-idle-presence into dailyuse
Owner

Stacked on: dailyuse-13-core-honour-mutes

What was built

  • fluxer-core::presence: the user's own presence from the user settings (READY, USER_SETTINGS_UPDATE, the PATCH answer). SetStatus writes only {status, status_resets_at, status_resets_to} (null/null, or now+d and "online"); SetCustomStatus writes only {custom_status} (text trimmed, cut to 128 chars; Unicode emoji in emoji_name, custom by emoji_id alone as toApiCustomStatusPayload; expires_at from Clear after; None or an empty draft sends null). Both optimistic, reverted on EffectFailed.
  • Reset timer at status_resets_at PATCHes {status: resets_to (online), null, null} itself; a reset already due when settings arrive is written at once (StatusExpiry.ts).
  • CoreEvent::Idle: idle after 10 min only over Online, afk after afk_timeout (default 600 s). Op 3 {status, afk, mobile: false, custom_status} via Effect::SendGateway whenever the computed frame differs from last_sent (connected or not); nothing before settings load (own_frame is invisible then); never re-sent by the core on resume / same-settings READY.
  • PresenceState::custom_by_user (from presences and member-list rows); selectors custom_status(app, user) -> Option<CustomStatusView> (expired hidden; own expiry timer re-renders and updates op 3), status_popout(app) -> StatusPopoutModel, custom_status_modal(app) -> CustomStatusModalModel, own_status, status_label. DmRowModel.custom_status (DMs) and ProfilePopout.custom_status added; status_of(me) is the sent status (idle while away) once settings load. README updated.

Tests

  • New crates/fluxer-core/tests/own_presence.rs (20 tests: all the plan's names plus READY op 3, invisible-before-load, due reset at READY, settings fixture, popout rows, rows' custom status, logout, malformed settings). Uses fixtures rest/user_settings_status.json and gateway/presence_update_custom_status.json (no new fixture: no new event or endpoint).
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally. No FLUXER_DESKTOP_TESTS tests apply.

Deviations / notes for review

  • READY now emits one op 3 (as the original after hydration), so four older test helpers that asserted no effects on dispatches (guilds_channels.rs, messages.rs, presence_ui.rs, dailyuse_ports.rs) now allow only the op 3; dailyuse_ports excludes SetStatus/SetCustomStatus/Idle from the "ignored" list and ignores last_sent in state_defaults.
  • The plan puts the "(today at 14:30)" suffix on the status popout's expiry submenu; the original (UserAreaPopout.tsx) shows plain "For 1 hour" there and the suffix only on the custom status modal's "Clear after" options, so that is where it is (custom_status_modal). Times are written as en-US ("6:15 PM", "Nov 17, 2026") like muted_text.
  • The store reads the time through app.notif_settings's Clock (one clock for the store) rather than adding a second one.
  • UserSettingsPatched carries no request id: it drops the oldest own write in flight (a chat-settings answer could do so first; harmless, the server's word is shown).
  • Member list rows keep their (GuildMember, UserStatus) shape; the UI asks custom_status(app, user) per row (avoids touching fluxer-ui here). Other users' expired custom statuses are hidden at read time; only the own one has a timer.

Closes #499

🤖 Generated with Claude Code

Stacked on: dailyuse-13-core-honour-mutes ## What was built - `fluxer-core::presence`: the user's own presence from the user settings (READY, USER_SETTINGS_UPDATE, the PATCH answer). `SetStatus` writes only `{status, status_resets_at, status_resets_to}` (null/null, or now+d and "online"); `SetCustomStatus` writes only `{custom_status}` (text trimmed, cut to 128 chars; Unicode emoji in `emoji_name`, custom by `emoji_id` alone as `toApiCustomStatusPayload`; `expires_at` from Clear after; `None` or an empty draft sends `null`). Both optimistic, reverted on `EffectFailed`. - Reset timer at `status_resets_at` PATCHes `{status: resets_to (online), null, null}` itself; a reset already due when settings arrive is written at once (`StatusExpiry.ts`). - `CoreEvent::Idle`: idle after 10 min only over Online, `afk` after `afk_timeout` (default 600 s). Op 3 `{status, afk, mobile: false, custom_status}` via `Effect::SendGateway` whenever the computed frame differs from `last_sent` (connected or not); nothing before settings load (`own_frame` is invisible then); never re-sent by the core on resume / same-settings READY. - `PresenceState::custom_by_user` (from presences and member-list rows); selectors `custom_status(app, user) -> Option<CustomStatusView>` (expired hidden; own expiry timer re-renders and updates op 3), `status_popout(app) -> StatusPopoutModel`, `custom_status_modal(app) -> CustomStatusModalModel`, `own_status`, `status_label`. `DmRowModel.custom_status` (DMs) and `ProfilePopout.custom_status` added; `status_of(me)` is the sent status (idle while away) once settings load. README updated. ## Tests - New `crates/fluxer-core/tests/own_presence.rs` (20 tests: all the plan's names plus READY op 3, invisible-before-load, due reset at READY, settings fixture, popout rows, rows' custom status, logout, malformed settings). Uses fixtures `rest/user_settings_status.json` and `gateway/presence_update_custom_status.json` (no new fixture: no new event or endpoint). - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. No FLUXER_DESKTOP_TESTS tests apply. ## Deviations / notes for review - READY now emits one op 3 (as the original after hydration), so four older test helpers that asserted *no* effects on dispatches (`guilds_channels.rs`, `messages.rs`, `presence_ui.rs`, `dailyuse_ports.rs`) now allow only the op 3; `dailyuse_ports` excludes SetStatus/SetCustomStatus/Idle from the "ignored" list and ignores `last_sent` in `state_defaults`. - The plan puts the "(today at 14:30)" suffix on the status popout's expiry submenu; the original (`UserAreaPopout.tsx`) shows plain "For 1 hour" there and the suffix only on the custom status modal's "Clear after" options, so that is where it is (`custom_status_modal`). Times are written as `en-US` ("6:15 PM", "Nov 17, 2026") like `muted_text`. - The store reads the time through `app.notif_settings`'s `Clock` (one clock for the store) rather than adding a second one. - `UserSettingsPatched` carries no request id: it drops the oldest own write in flight (a chat-settings answer could do so first; harmless, the server's word is shown). - Member list rows keep their `(GuildMember, UserStatus)` shape; the UI asks `custom_status(app, user)` per row (avoids touching `fluxer-ui` here). Other users' expired custom statuses are hidden at read time; only the own one has a timer. Closes #499 🤖 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 #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 #497

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>
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>
Author
Owner

Independent review: Daily use 14 (core status, custom status, idle, presence)

Reviewed 61e2eba2..88b2d2c cold. I checked the plan's test list, the Interfaces block, the invariants and parity against the fork, and ran CI locally.

Findings

[BLOCKING] A failed status reset is re-sent immediately, with no limit. crates/fluxer-core/src/presence.rs, in refresh.
When the reset write (resets_at <= now && !writing) fails, EffectFailed removes it from pending. refresh then runs in the same reduce_own call. It still sees the confirmed resets_at in the past, so it emits a new PatchUserSettings in the same batch of effects.

  • Repro (a scratch test, not committed): settings user_settings_status.json, clock 19:30Z, READY, then answer each reset PATCH with EffectFailed(Network). All 5 of 5 failures produced a new PATCH right away.
  • While offline, rate-limited (429) or rejected (4xx), this loops as fast as the runtime can fail requests. Every other event also retries it.
  • The original (StatusExpiry.ts handleExpiry) logs the error and does not retry. The timer is only rescheduled when the settings change.
  • Fix: after a reset write fails, do not write it again until new settings arrive (for example, remember the resets_at it was for). Add a test that a failed reset is not retried.

[minor] Any UserSettingsPatched drops the oldest status write in flight. This includes answers to the PATCHes of chat::expressions (synced preferences, sent 1.5 s after expression use) and chat::settings.

  • A stale answer arriving while a status write is pending shows the old status. It also sends an op 3 for it, then another for the new status when the real answer lands, so others see the status flap. It converges, so not blocking.
  • This matches how chat::settings treats answers today. A guard would help: drop a pending write only when the answer reflects it, or when its own id fails.

[minor] custom_status_in_rows checks the profile popout inside if let Some(popout). If profile::popout returns None, that assertion is skipped without a failure. Assert the popout exists.

[minor/info] Deviation from the plan, which I agree with. The "(today at …)" suffix is on the custom status modal's "Clear after" options, not on the popout's expiry submenu.

  • Spec §3.3 and the fork agree: UserAreaPopout.tsx:105-112 labels the submenu with STATUS_EXPIRY_LABEL_MESSAGES and adds no suffix.
  • The plan's Interfaces wording for Task 14/32 should be read that way. Task 32 should not add the suffix to the popout.

Checks

  1. Plan tests. All 11 named tests exist in tests/own_presence.rs, plus 10 more. They assert the spec's values:
    • DND for 1 h → {status:"dnd", status_resets_at:"…19:00Z", status_resets_to:"online"}.
    • Reset → {status:"online", null, null}.
    • Custom status: Unicode emoji in emoji_name; a custom emoji by emoji_id only.
    • Text cut to 128 characters.
    • The nine "Clear after" labels; 24 h is the default.
    • Idle at 600 s, only over Online; afk at afk_timeout.
    • No op 3 sent twice; nothing re-sent on resume.
    • Expired custom status hidden; a failed write reverts.
  2. Interfaces. All present, and selectors re-exports them: OwnPresence (unchanged), SetStatus/SetCustomStatus → PatchUserSettings with only their fields, op 3 through Effect::SendGateway(Envelope::presence_update), invisible until loaded, status_popout(&App) -> StatusPopoutModel, custom_status(&App, user) -> Option<CustomStatusView>. Added: DmRowModel.custom_status and ProfilePopout.custom_status. session.rs and identify are untouched.
  3. Invariants.
    • fluxer-core gains only time and tracing; no I/O.
    • No new fixtures. The tests use the existing user_settings_status.json and presence_update_custom_status.json.
    • No panics on server data: afk_timeout is clamped in proto; timestamps use saturating maths; month indexing is bounded. malformed_settings_never_panic covers bad settings.
    • No secrets.
  4. Parity, checked against the fork.
    • Idle.ts:7,132-133: idle at 10 min, afk at the threshold.
    • LocalPresence.ts: idle only over online, default afk_timeout 600, invisible until hydrated, expired custom status left out.
    • StatusExpiry.ts:66-139: the payloads match. The no-retry-on-failure behaviour does not (see the blocking finding).
    • CustomStatus.ts: toApiCustomStatusPayload sends a custom emoji by id only and a Unicode one by name; normalizeCustomStatus trims and cuts to 128, and returns null with neither text nor emoji.
    • UserAreaPopout.tsx:77-95: row order and descriptions match.
  5. Review Focus.
    • Item 1: the status and custom-status PATCHes carry only their own fields. Holds.
    • Item 3: op 3 goes out on every change, never twice the same, idle only over Online, and the core never re-sends it for a resume. Holds.
  6. Local CI. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree exited 0 (green).

Verdict: CHANGES REQUESTED. 1 blocking finding (unbounded retry of a failed status reset) and 3 minor ones. Local CI is green.

🤖 Generated with Claude Code

## Independent review: Daily use 14 (core status, custom status, idle, presence) Reviewed `61e2eba2..88b2d2c` cold. I checked the plan's test list, the Interfaces block, the invariants and parity against the fork, and ran CI locally. ### Findings **[BLOCKING] A failed status reset is re-sent immediately, with no limit.** `crates/fluxer-core/src/presence.rs`, in `refresh`. When the reset write (`resets_at <= now && !writing`) fails, `EffectFailed` removes it from `pending`. `refresh` then runs in the same `reduce_own` call. It still sees the confirmed `resets_at` in the past, so it emits a new `PatchUserSettings` in the same batch of effects. - Repro (a scratch test, not committed): settings `user_settings_status.json`, clock 19:30Z, `READY`, then answer each reset PATCH with `EffectFailed(Network)`. All 5 of 5 failures produced a new PATCH right away. - While offline, rate-limited (429) or rejected (4xx), this loops as fast as the runtime can fail requests. Every other event also retries it. - The original (`StatusExpiry.ts` `handleExpiry`) logs the error and does not retry. The timer is only rescheduled when the settings change. - Fix: after a reset write fails, do not write it again until new settings arrive (for example, remember the `resets_at` it was for). Add a test that a failed reset is not retried. **[minor] Any `UserSettingsPatched` drops the oldest status write in flight.** This includes answers to the PATCHes of `chat::expressions` (synced preferences, sent 1.5 s after expression use) and `chat::settings`. - A stale answer arriving while a status write is pending shows the old status. It also sends an op 3 for it, then another for the new status when the real answer lands, so others see the status flap. It converges, so not blocking. - This matches how `chat::settings` treats answers today. A guard would help: drop a pending write only when the answer reflects it, or when its own id fails. **[minor] `custom_status_in_rows` checks the profile popout inside `if let Some(popout)`.** If `profile::popout` returns `None`, that assertion is skipped without a failure. Assert the popout exists. **[minor/info] Deviation from the plan, which I agree with.** The "(today at …)" suffix is on the custom status modal's "Clear after" options, not on the popout's expiry submenu. - Spec §3.3 and the fork agree: `UserAreaPopout.tsx:105-112` labels the submenu with `STATUS_EXPIRY_LABEL_MESSAGES` and adds no suffix. - The plan's Interfaces wording for Task 14/32 should be read that way. Task 32 should not add the suffix to the popout. ### Checks 1. **Plan tests.** All 11 named tests exist in `tests/own_presence.rs`, plus 10 more. They assert the spec's values: - DND for 1 h → `{status:"dnd", status_resets_at:"…19:00Z", status_resets_to:"online"}`. - Reset → `{status:"online", null, null}`. - Custom status: Unicode emoji in `emoji_name`; a custom emoji by `emoji_id` only. - Text cut to 128 characters. - The nine "Clear after" labels; 24 h is the default. - Idle at 600 s, only over Online; `afk` at `afk_timeout`. - No op 3 sent twice; nothing re-sent on resume. - Expired custom status hidden; a failed write reverts. 2. **Interfaces.** All present, and `selectors` re-exports them: `OwnPresence` (unchanged), `SetStatus`/`SetCustomStatus` → `PatchUserSettings` with only their fields, op 3 through `Effect::SendGateway(Envelope::presence_update)`, `invisible` until loaded, `status_popout(&App) -> StatusPopoutModel`, `custom_status(&App, user) -> Option<CustomStatusView>`. Added: `DmRowModel.custom_status` and `ProfilePopout.custom_status`. `session.rs` and identify are untouched. 3. **Invariants.** - fluxer-core gains only `time` and `tracing`; no I/O. - No new fixtures. The tests use the existing `user_settings_status.json` and `presence_update_custom_status.json`. - No panics on server data: `afk_timeout` is clamped in proto; timestamps use saturating maths; month indexing is bounded. `malformed_settings_never_panic` covers bad settings. - No secrets. 4. **Parity, checked against the fork.** - `Idle.ts:7,132-133`: idle at 10 min, `afk` at the threshold. - `LocalPresence.ts`: idle only over online, default `afk_timeout` 600, `invisible` until hydrated, expired custom status left out. - `StatusExpiry.ts:66-139`: the payloads match. The no-retry-on-failure behaviour does not (see the blocking finding). - `CustomStatus.ts`: `toApiCustomStatusPayload` sends a custom emoji by id only and a Unicode one by name; `normalizeCustomStatus` trims and cuts to 128, and returns `null` with neither text nor emoji. - `UserAreaPopout.tsx:77-95`: row order and descriptions match. 5. **Review Focus.** - Item 1: the status and custom-status PATCHes carry only their own fields. Holds. - Item 3: op 3 goes out on every change, never twice the same, idle only over Online, and the core never re-sends it for a resume. Holds. 6. **Local CI.** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree exited 0 (green). **Verdict: CHANGES REQUESTED.** 1 blocking finding (unbounded retry of a failed status reset) and 3 minor ones. Local CI is green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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>
Author
Owner

Review round 1 addressed in fac6649 (local FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green):

  • Blocking (presence.rs, failed reset re-sent at once): fixed. OwnBook now remembers the reset write in flight (reset_write); when it fails, its resets_at is kept as failed_reset and refresh does not write that reset again until new settings arrive (take() on READY, USER_SETTINGS_UPDATE or a patch answer clears it). This matches StatusExpiry.handleExpiry, which logs and does not retry. New test failed_reset_is_not_rewritten_until_new_settings: a reset due at READY fails, five later events send no PATCH, and new settings send one again. README updated.
  • Minor (any UserSettingsPatched drops the oldest pending status write): deferred to #569. Matching answers to writes by content would leave a write pending forever if the server normalises a value, which is worse than the brief flap. The real fix is to give ApiResult the request's EffectId, which touches the event type and the runtime, so it needs its own task.
  • Minor (own_presence.rs, popout check inside if let): fixed. custom_status_in_rows now does profile::popout(&app).expect("profile popout") and asserts on it.
  • Minor (accepted deviation, "(today at …)" suffix): no code change. The suffix stays on the custom status modal's Clear after options only, as in spec §3.3 and UserAreaPopout.tsx:105-112. Task 32 should not add it to the popout's expiry submenu.

🤖 Generated with Claude Code

Review round 1 addressed in fac6649 (local `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green): - **Blocking (presence.rs, failed reset re-sent at once):** fixed. `OwnBook` now remembers the reset write in flight (`reset_write`); when it fails, its `resets_at` is kept as `failed_reset` and `refresh` does not write that reset again until new settings arrive (`take()` on `READY`, `USER_SETTINGS_UPDATE` or a patch answer clears it). This matches `StatusExpiry.handleExpiry`, which logs and does not retry. New test `failed_reset_is_not_rewritten_until_new_settings`: a reset due at `READY` fails, five later events send no PATCH, and new settings send one again. README updated. - **Minor (any `UserSettingsPatched` drops the oldest pending status write):** deferred to #569. Matching answers to writes by content would leave a write pending forever if the server normalises a value, which is worse than the brief flap. The real fix is to give `ApiResult` the request's `EffectId`, which touches the event type and the runtime, so it needs its own task. - **Minor (own_presence.rs, popout check inside `if let`):** fixed. `custom_status_in_rows` now does `profile::popout(&app).expect("profile popout")` and asserts on it. - **Minor (accepted deviation, "(today at …)" suffix):** no code change. The suffix stays on the custom status modal's Clear after options only, as in spec §3.3 and UserAreaPopout.tsx:105-112. Task 32 should not add it to the popout's expiry submenu. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Independent review (round 2): Daily use 14 (core status, custom status, idle, presence)

I reviewed 61e2eba2..fac6649 (origin/dailyuse-14-core-status-idle-presence) without relying on the earlier review or the implementer's notes.

Findings

[minor] The text clamp counts Unicode scalars, but the server counts UTF-16 units. See presence.rs from_draft and the proto clamp: .chars().take(CUSTOM_STATUS_TEXT_LIMIT).

  • The original cuts with text.slice(0, 128) in CustomStatus.ts:38. The server checks value.length in SchemaPrimitives.ts:164 (createStringType(1, 128)). Both count UTF-16 units.
  • Example: a text of 100 non-BMP emoji passes the clamp here, but it is 200 UTF-16 units. The server rejects it with a 400 and the client reverts it. No data is lost.
  • Task 32's input limit could hide this, or the clamp could count UTF-16 units.

[minor] failed_reset is cleared by any settings that arrive, including answers to other modules' PATCHes. These are the chat::expressions / chat::settings answers and the USER_SETTINGS_UPDATE that follows them.

  • Example: a reset the server rejects for good is written again once each time unrelated settings arrive.
  • This is bounded by user activity, so it is not a loop. The original's mobx reaction re-arms only when statusResetsAt/statusResetsTo/status actually change.
  • Fix: clear failed_reset only when the confirmed resets_at differs from it. This could fold into #569.

[minor] #569 also covers a second case. A foreign UserSettingsPatched can drop a reset write that is still in flight. refresh then sees !writing and sends the reset a second time. This is bounded at one duplicate per foreign answer. Please mention it in #569.

[info] selectors/members.rs does not add a custom status to member rows. The rows stay (GuildMember, UserStatus). The UI is expected to call presence::custom_status(app, user) for each row, as the README says. This is acceptable, but Task 32 (golden member_list_custom_status) needs to know.

[info] ProfilePopout.custom_status now exists. Task 23's Interfaces also says the popout "gains custom_status". Task 23 should reuse this field, not add a second one.

Checks

  1. Plan tests. All 11 named tests are in tests/own_presence.rs and assert the spec's values:
    • DND for 1 h → {status:"dnd", status_resets_at:"…19:00:00.000Z", status_resets_to:"online"}.
    • Reset → {status:"online", null, null}.
    • Unicode emoji with skin tone in emoji_name; a custom emoji by emoji_id alone.
    • Text cut to 128 characters.
    • The nine "Clear after" labels, with 24 h as the default.
    • Idle at 600 s, only over Online; afk at afk_timeout.
    • No op 3 sent twice; nothing re-sent on resume or on a READY with the same settings.
    • An expired custom status is hidden, and its timer re-renders it.
    • A failed write reverts.
      The round-1 fixes check out. failed_reset_is_not_rewritten_until_new_settings covers the blocking finding, and custom_status_in_rows now uses expect on the popout.
  2. Interfaces. OwnPresence (fields unchanged), SetStatus/SetCustomStatus → PatchUserSettings with only their fields, op 3 via Effect::SendGateway(Envelope::presence_update), invisible until loaded, status_popout(&App) -> StatusPopoutModel, and custom_status(&App, user) -> Option<CustomStatusView> all exist as written, re-exported from selectors. session.rs and the identify payload are untouched. The edits to existing tests only allow the op 3 that READY now produces; no assertion was weakened beyond that.
  3. Invariants.
    • No new dependencies or I/O in fluxer-core.
    • No new fixtures. The tests use Task 1's user_settings_status.json and presence_update_custom_status.json.
    • Server data cannot panic: maths saturates, the month index is bounded, and malformed_settings_never_panic covers bad settings.
    • No secrets.
  4. Parity, checked against the fork.
    • LocalPresence.ts: idle only over online, afk at afk_timeout (default 600), nothing sent before hydration.
    • Idle.ts: >= IDLE_DURATION_MS at 10 min.
    • StatusExpiry.ts: the payloads match, and handleExpiry does not retry.
    • CustomStatus.ts toApiCustomStatusPayload: id only for a custom emoji, name for a Unicode one.
    • TimeWindowPresets.ts: "Don't clear" first, the 60 s match tolerance, the fallback to the last preset, 24 h by default.
    • UserAreaPopout.tsx:77-95: row order and descriptions match.
    • Server UserRequestSchemas.ts:242-269: emoji_name is dropped when emoji_id is set.
  5. Review Focus.
    • Item 1: the status and custom-status PATCHes carry only their own fields. Holds.
    • Item 3: op 3 goes out on every change, never twice the same, idle only over Online, and the core never re-sends it for a resume. Holds.
  6. Local CI. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree finished with "all steps passed" (exit 0).

Verdict: APPROVED. 0 blocking findings, 3 minor findings (follow-ups optional), 2 notes for later tasks. Local CI is green.

🤖 Generated with Claude Code

## Independent review (round 2): Daily use 14 (core status, custom status, idle, presence) I reviewed `61e2eba2..fac6649` (`origin/dailyuse-14-core-status-idle-presence`) without relying on the earlier review or the implementer's notes. ### Findings **[minor] The text clamp counts Unicode scalars, but the server counts UTF-16 units.** See `presence.rs` `from_draft` and the proto clamp: `.chars().take(CUSTOM_STATUS_TEXT_LIMIT)`. - The original cuts with `text.slice(0, 128)` in `CustomStatus.ts:38`. The server checks `value.length` in `SchemaPrimitives.ts:164` (`createStringType(1, 128)`). Both count UTF-16 units. - Example: a text of 100 non-BMP emoji passes the clamp here, but it is 200 UTF-16 units. The server rejects it with a 400 and the client reverts it. No data is lost. - Task 32's input limit could hide this, or the clamp could count UTF-16 units. **[minor] `failed_reset` is cleared by any settings that arrive, including answers to other modules' PATCHes.** These are the `chat::expressions` / `chat::settings` answers and the `USER_SETTINGS_UPDATE` that follows them. - Example: a reset the server rejects for good is written again once each time unrelated settings arrive. - This is bounded by user activity, so it is not a loop. The original's mobx reaction re-arms only when `statusResetsAt`/`statusResetsTo`/`status` actually change. - Fix: clear `failed_reset` only when the confirmed `resets_at` differs from it. This could fold into #569. **[minor] #569 also covers a second case.** A foreign `UserSettingsPatched` can drop a reset write that is still in flight. `refresh` then sees `!writing` and sends the reset a second time. This is bounded at one duplicate per foreign answer. Please mention it in #569. **[info] `selectors/members.rs` does not add a custom status to member rows.** The rows stay `(GuildMember, UserStatus)`. The UI is expected to call `presence::custom_status(app, user)` for each row, as the README says. This is acceptable, but Task 32 (golden `member_list_custom_status`) needs to know. **[info] `ProfilePopout.custom_status` now exists.** Task 23's Interfaces also says the popout "gains `custom_status`". Task 23 should reuse this field, not add a second one. ### Checks 1. **Plan tests.** All 11 named tests are in `tests/own_presence.rs` and assert the spec's values: - DND for 1 h → `{status:"dnd", status_resets_at:"…19:00:00.000Z", status_resets_to:"online"}`. - Reset → `{status:"online", null, null}`. - Unicode emoji with skin tone in `emoji_name`; a custom emoji by `emoji_id` alone. - Text cut to 128 characters. - The nine "Clear after" labels, with 24 h as the default. - Idle at 600 s, only over Online; afk at `afk_timeout`. - No op 3 sent twice; nothing re-sent on resume or on a READY with the same settings. - An expired custom status is hidden, and its timer re-renders it. - A failed write reverts. The round-1 fixes check out. `failed_reset_is_not_rewritten_until_new_settings` covers the blocking finding, and `custom_status_in_rows` now uses `expect` on the popout. 2. **Interfaces.** `OwnPresence` (fields unchanged), `SetStatus`/`SetCustomStatus` → `PatchUserSettings` with only their fields, op 3 via `Effect::SendGateway(Envelope::presence_update)`, `invisible` until loaded, `status_popout(&App) -> StatusPopoutModel`, and `custom_status(&App, user) -> Option<CustomStatusView>` all exist as written, re-exported from `selectors`. `session.rs` and the identify payload are untouched. The edits to existing tests only allow the op 3 that READY now produces; no assertion was weakened beyond that. 3. **Invariants.** - No new dependencies or I/O in fluxer-core. - No new fixtures. The tests use Task 1's `user_settings_status.json` and `presence_update_custom_status.json`. - Server data cannot panic: maths saturates, the month index is bounded, and `malformed_settings_never_panic` covers bad settings. - No secrets. 4. **Parity, checked against the fork.** - `LocalPresence.ts`: idle only over online, `afk` at `afk_timeout` (default 600), nothing sent before hydration. - `Idle.ts`: `>= IDLE_DURATION_MS` at 10 min. - `StatusExpiry.ts`: the payloads match, and `handleExpiry` does not retry. - `CustomStatus.ts` `toApiCustomStatusPayload`: id only for a custom emoji, name for a Unicode one. - `TimeWindowPresets.ts`: "Don't clear" first, the 60 s match tolerance, the fallback to the last preset, 24 h by default. - `UserAreaPopout.tsx:77-95`: row order and descriptions match. - Server `UserRequestSchemas.ts:242-269`: `emoji_name` is dropped when `emoji_id` is set. 5. **Review Focus.** - Item 1: the status and custom-status PATCHes carry only their own fields. Holds. - Item 3: op 3 goes out on every change, never twice the same, idle only over Online, and the core never re-sends it for a resume. Holds. 6. **Local CI.** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree finished with "all steps passed" (exit 0). **Verdict: APPROVED.** 0 blocking findings, 3 minor findings (follow-ups optional), 2 notes for later tasks. Local CI is green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Independent review (round 3): Daily use 14, fac6649

Scope: git diff 61e2eba..fac6649 (presence.rs, selectors members/sidebar/profile/mod, app.rs, README, tests/own_presence.rs and four relaxed helpers).

Checks

  1. Plan tests: all 11 Step 1 tests exist in crates/fluxer-core/tests/own_presence.rs with the spec's values. They check the exact PATCH JSON ({status, status_resets_at: ISO(now+1h), status_resets_to: "online"} and null/null), the reset PATCH {status: online, null, null}, emoji_name with skin tone and emoji_id alone, the 128 clamp, the "Clear after" labels with the 24 h default, idle only over online, afk at afk_timeout, op 3 not sent twice, no resend on resume, the expired status hidden by a timer, and the revert on failure. There are 9 extra tests (popout rows, a reset already due at READY, failed reset, rows, logout, malformed settings).
  2. Interfaces: OwnPresence comes from READY / USER_SETTINGS_UPDATE / the patch answer. SetStatus, SetCustomStatus(Option<draft>), CoreEvent::Idle, op 3 through Effect::SendGateway, status_popout(&App) -> StatusPopoutModel, custom_status(&App, user) -> Option<CustomStatusView>, plus custom_status_modal and own_frame/own_status are all present. session.rs and the identify payload are untouched. Member list rows stay (GuildMember, UserStatus) and call the selector; the selector is the interface, so this is OK.
  3. Invariants: no I/O or forbidden crates in core. Server data cannot panic (saturating time math, month index from time::Month, a malformed-settings test). Status and custom-status PATCHes carry only their own fields (Review Focus 1, exact-JSON asserts). No secrets.
  4. Parity spot-checks against the fork. Idle.ts has idle at 600 s and afk at afk_timeout, independently: matches. LocalPresence.ts has idle only over ONLINE, afk default 600, invisible before hydration: matches. StatusExpiry.handleExpiry logs and does not retry, and with no resets_to it falls back to online: matches. UserAreaPopout.tsx has STATUS_ORDER and "Until I change it"/"For …" with no time suffix, and the (today at …) suffix is only in CustomStatusModal.tsx formatRelativeDayTimeLabel: the implementation's deviation from the plan's Interfaces wording is correct and matches spec §3.3.
  5. Review Focus 3: op 3 is sent on every change of the computed frame, never twice (last_sent), idle only over online, handed to the gateway while disconnected, and not resent by the core on RESUMED or a new READY. Tested.
  6. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree, cold target dir: all steps passed (livekit-interop skipped as usual).

Findings

  • [minor] from_draft clamps text to 128 Unicode scalars (chars().take). The original clamps at value.slice(0,128)/maxLength=128 and the server's zod .max(128) counts UTF-16 units, so a 128-emoji status is 256 units: the server answers 400 and the write is reverted. Clamp by UTF-16 units (Task 32's input should match). Already known from round 2; still open.
  • [minor] take() clears failed_reset on any settings arrival, including UserSettingsPatched from unrelated chat-settings or expressions writes, so a failed due reset is retried on unrelated updates. The original's reaction only re-fires when statusResetsAt/To change. This is bounded and not a storm. It can be folded into #569.
  • [minor] UserSettingsPatched drops the oldest presence write even when the answer belongs to a chat::settings or chat::expressions PATCH (those also send PatchUserSettings). The result is a transient wrong status and op 3 flicker, and a later failure of the dropped write is not reverted (the state still converges on the server's word). Tracked by #569.
  • [minor, outside this task] Before READY the core hands no op 3 to the gateway, so the first IDENTIFY carries presence: None. The original identifies with the pre-hydration presence (invisible, PooledGatewayConnection.ts:476-483). own_frame does return invisible, and the plan puts the identify payload outside this task, so it belongs to Task 6/28. Worth checking there.

No blocking findings.

Verdict: APPROVE (0 blocking, 4 minor; local CI green on fac6649)

## Independent review (round 3): Daily use 14, fac6649 Scope: `git diff 61e2eba..fac6649` (presence.rs, selectors members/sidebar/profile/mod, app.rs, README, tests/own_presence.rs and four relaxed helpers). **Checks** 1. Plan tests: all 11 Step 1 tests exist in `crates/fluxer-core/tests/own_presence.rs` with the spec's values. They check the exact PATCH JSON (`{status, status_resets_at: ISO(now+1h), status_resets_to: "online"}` and `null`/`null`), the reset PATCH `{status: online, null, null}`, emoji_name with skin tone and emoji_id alone, the 128 clamp, the "Clear after" labels with the 24 h default, idle only over online, afk at afk_timeout, op 3 not sent twice, no resend on resume, the expired status hidden by a timer, and the revert on failure. There are 9 extra tests (popout rows, a reset already due at READY, failed reset, rows, logout, malformed settings). 2. Interfaces: `OwnPresence` comes from READY / USER_SETTINGS_UPDATE / the patch answer. `SetStatus`, `SetCustomStatus(Option<draft>)`, `CoreEvent::Idle`, op 3 through `Effect::SendGateway`, `status_popout(&App) -> StatusPopoutModel`, `custom_status(&App, user) -> Option<CustomStatusView>`, plus `custom_status_modal` and `own_frame`/`own_status` are all present. `session.rs` and the identify payload are untouched. Member list rows stay `(GuildMember, UserStatus)` and call the selector; the selector is the interface, so this is OK. 3. Invariants: no I/O or forbidden crates in core. Server data cannot panic (saturating time math, month index from `time::Month`, a malformed-settings test). Status and custom-status PATCHes carry only their own fields (Review Focus 1, exact-JSON asserts). No secrets. 4. Parity spot-checks against the fork. `Idle.ts` has idle at 600 s and afk at `afk_timeout`, independently: matches. `LocalPresence.ts` has idle only over ONLINE, afk default 600, invisible before hydration: matches. `StatusExpiry.handleExpiry` logs and does not retry, and with no resets_to it falls back to online: matches. `UserAreaPopout.tsx` has STATUS_ORDER and "Until I change it"/"For …" with no time suffix, and the `(today at …)` suffix is only in `CustomStatusModal.tsx` `formatRelativeDayTimeLabel`: the implementation's deviation from the plan's Interfaces wording is correct and matches spec §3.3. 5. Review Focus 3: op 3 is sent on every change of the computed frame, never twice (`last_sent`), idle only over online, handed to the gateway while disconnected, and not resent by the core on RESUMED or a new READY. Tested. 6. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree, cold target dir: **all steps passed** (livekit-interop skipped as usual). **Findings** - [minor] `from_draft` clamps text to 128 Unicode scalars (`chars().take`). The original clamps at `value.slice(0,128)`/`maxLength=128` and the server's zod `.max(128)` counts UTF-16 units, so a 128-emoji status is 256 units: the server answers 400 and the write is reverted. Clamp by UTF-16 units (Task 32's input should match). Already known from round 2; still open. - [minor] `take()` clears `failed_reset` on any settings arrival, including `UserSettingsPatched` from unrelated chat-settings or expressions writes, so a failed due reset is retried on unrelated updates. The original's reaction only re-fires when `statusResetsAt/To` change. This is bounded and not a storm. It can be folded into #569. - [minor] `UserSettingsPatched` drops the oldest presence write even when the answer belongs to a `chat::settings` or `chat::expressions` PATCH (those also send `PatchUserSettings`). The result is a transient wrong status and op 3 flicker, and a later failure of the dropped write is not reverted (the state still converges on the server's word). Tracked by #569. - [minor, outside this task] Before READY the core hands no op 3 to the gateway, so the first IDENTIFY carries `presence: None`. The original identifies with the pre-hydration presence (`invisible`, `PooledGatewayConnection.ts:476-483`). `own_frame` does return `invisible`, and the plan puts the identify payload outside this task, so it belongs to Task 6/28. Worth checking there. No blocking findings. **Verdict: APPROVE** (0 blocking, 4 minor; local CI green on fac6649)
Author
Owner

Merged into dailyuse at f7972c3 (combined merge of 23 Daily use tasks plus textchat).

Merged into `dailyuse` at f7972c3 (combined merge of 23 Daily use tasks plus `textchat`).
charles closed this pull request 2026-11-15 06:08:47 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.