Daily use 28: apps/fluxer daily-use runtime wiring (#517) #618

Closed
charles wants to merge 0 commits from dailyuse-28-app-dailyuse-runtime into dailyuse
Owner

What this builds

apps/fluxer now carries out everything the daily-use store asks for (Daily use 28, spec §9):

  • Requests (apps/fluxer/src/dailyuse_rt.rs, dailyuse_rt::perform). Every ApiRequest from Daily use 4 and 5 now goes through fluxer-api, so the 501 CLIENT_NOT_WIRED stubs are gone. That covers user guild settings (@me for DMs), relationships (every verb), invites (the GET is sent without the token), create and leave a guild or group DM, the report flow and its legacy fallback, notes, and DM pins.
  • AckReadStates sends POST /read-states/ack. On a 404 or 405 it falls back to one POST /channels/{c}/messages/{m}/ack per entry, as ReadStates.ts:369-384 does. Every entry is tried and the first failure is reported.
  • UpdateMemberVoice sends the member PATCH with only its voice fields. MemberVoiceChange becomes MemberVoicePatch through dailyuse_rt::member_voice_patch (#134).
  • Picked images. EditGroupDmIcon (#317) and CreateGuild with an icon read the picked image through the existing UploadReader, up to 10 MiB, and send it as a data: URI. Both exchanges already go through unobserved(), so --record and its redaction are unchanged and record.rs is not touched.
  • Idle. CoreEvent::Idle is sent every 15 s, starting at once. It comes from fluxer_platform::idle::system_idle; when that answers None, it comes from the time since the last input in the client's windows. fluxer_ui::app::window_event notes every key, mouse-button, wheel, pointer-move or touch event, whether a widget took it or not, in app::last_input() (spec §17 Q4). Tests inject their own probe and input clock with Runtime::with_idle(probe, input); with_idle_every is a hidden test knob.
  • Notifications.
    • Icons: the author's avatar is loaded through the image cache (Runtime::with_images, the window's ImageCache, 128 px PNG URL from the store). A default avatar uses the bundled PNG. Either way the icon is passed to Notifier::notify_with_icon (#54). Icons are fetched one after another, so notifications stay in order, and an icon that has not loaded after 3 s is left out.
    • Clicks become UserAction::NotificationClicked { channel_id, message_id }. The store raises the window and jumps to the message (#55). The runtime's old click_actions is gone; the runtime still sends CloseSettings first when the settings are open, as before.
  • Window. Effect::Window(Raise) goes to a new desktop_rt::WindowControl (Desktop::with_window). In the app, desktop_rt::window_commands() hands a receiver to fluxer_ui::run, which un-minimises and focuses the oldest window with iced's window::minimize(id, false) and window::gain_focus(id).
  • Copy image. Effect::Clipboard(Image) tries the URL, then each fallback in order, and converts the first image that decodes to PNG. If none can be copied, it copies the original's URL as text, as MediaMenuData.tsx:415-505 does.

How it was tested

  • New: apps/fluxer/tests/dailyuse_runtime.rs, 12 tests run against the in-process devserver (dailyuse, plus dailyuse_legacy_ack for the fallback), with fake notifier, window, clipboard, image loader and idle sources: server_mute_deafen_move_disconnect_reach_devserver, member_patch_failure_surfaces_modal, group_icon_patch_sent, mute_round_trip_through_gateway, status_change_sends_op3, idle_after_10_min_fake_clock, idle_falls_back_to_window_input_without_probe, relationship_accept_round_trip, invite_accept_selects_channel, legacy_ack_fallback, notification_click_raises_and_selects, copy_image_writes_png.
  • New: crates/fluxer-ui/tests/app.rs window_input_updates_last_input.
  • Updated the runtime's notify-worker unit tests to the new click payload. The click_actions tests were removed with the function; the core tests of Daily use 24 cover that behaviour.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci passes locally. No FLUXER_DESKTOP_TESTS=1 tests were run: the real idle probe and toast clicks are Task 27's and were not run here.

Deviations from the plan

  • New module. The new code is in a new module, apps/fluxer/src/dailyuse_rt.rs, registered in lib.rs, instead of being added to runtime.rs, which was already 3,100 lines.
  • Small changes outside the files list:
    • crates/fluxer-ui/src/message.rs: a UiMessage::WindowCommand variant.
    • crates/fluxer-ui/src/widgets/avatar.rs: DEFAULT_AVATARS is now pub, for default-avatar notification icons.
    • crates/fluxer-ui/README.md.
    • apps/fluxer/Cargo.toml: base64 added. It is already a workspace dependency used by four crates, so cargo deny is unchanged.
  • New fluxer_ui::run argument: window_commands: Option<UnboundedReceiver<WindowCommand>>.
  • New devserver test accessors: Handle::devserver_presence() and Handle::chat_script(), devserver feature only. Tests use them to read the recorded op 3s and to script a mention.
  • --devserver: with --devserver the system idle probe is not used (window input only), so fixture sessions do not depend on the machine.

Stacked on: origin/dailyuse-24-core-notification-icon-passive

Closes #517
Closes #134
Closes #317
Closes #372
Closes #397
Closes #54
Closes #55

🤖 Generated with Claude Code

## What this builds `apps/fluxer` now carries out everything the daily-use store asks for (Daily use 28, spec §9): - **Requests** (`apps/fluxer/src/dailyuse_rt.rs`, `dailyuse_rt::perform`). Every `ApiRequest` from Daily use 4 and 5 now goes through `fluxer-api`, so the 501 `CLIENT_NOT_WIRED` stubs are gone. That covers user guild settings (`@me` for DMs), relationships (every verb), invites (the `GET` is sent without the token), create and leave a guild or group DM, the report flow and its legacy fallback, notes, and DM pins. - **`AckReadStates`** sends `POST /read-states/ack`. On a 404 or 405 it falls back to one `POST /channels/{c}/messages/{m}/ack` per entry, as `ReadStates.ts:369-384` does. Every entry is tried and the first failure is reported. - **`UpdateMemberVoice`** sends the member PATCH with only its voice fields. `MemberVoiceChange` becomes `MemberVoicePatch` through `dailyuse_rt::member_voice_patch` (#134). - **Picked images.** `EditGroupDmIcon` (#317) and `CreateGuild` with an icon read the picked image through the existing `UploadReader`, up to 10 MiB, and send it as a `data:` URI. Both exchanges already go through `unobserved()`, so `--record` and its redaction are unchanged and `record.rs` is not touched. - **Idle.** `CoreEvent::Idle` is sent every 15 s, starting at once. It comes from `fluxer_platform::idle::system_idle`; when that answers `None`, it comes from the time since the last input in the client's windows. `fluxer_ui::app::window_event` notes every key, mouse-button, wheel, pointer-move or touch event, whether a widget took it or not, in `app::last_input()` (spec §17 Q4). Tests inject their own probe and input clock with `Runtime::with_idle(probe, input)`; `with_idle_every` is a hidden test knob. - **Notifications.** - Icons: the author's avatar is loaded through the image cache (`Runtime::with_images`, the window's `ImageCache`, 128 px PNG URL from the store). A default avatar uses the bundled PNG. Either way the icon is passed to `Notifier::notify_with_icon` (#54). Icons are fetched one after another, so notifications stay in order, and an icon that has not loaded after 3 s is left out. - Clicks become `UserAction::NotificationClicked { channel_id, message_id }`. The store raises the window and jumps to the message (#55). The runtime's old `click_actions` is gone; the runtime still sends `CloseSettings` first when the settings are open, as before. - **Window.** `Effect::Window(Raise)` goes to a new `desktop_rt::WindowControl` (`Desktop::with_window`). In the app, `desktop_rt::window_commands()` hands a receiver to `fluxer_ui::run`, which un-minimises and focuses the oldest window with iced's `window::minimize(id, false)` and `window::gain_focus(id)`. - **Copy image.** `Effect::Clipboard(Image)` tries the URL, then each fallback in order, and converts the first image that decodes to PNG. If none can be copied, it copies the original's URL as text, as `MediaMenuData.tsx:415-505` does. ## How it was tested - New: `apps/fluxer/tests/dailyuse_runtime.rs`, 12 tests run against the in-process devserver (`dailyuse`, plus `dailyuse_legacy_ack` for the fallback), with fake notifier, window, clipboard, image loader and idle sources: `server_mute_deafen_move_disconnect_reach_devserver`, `member_patch_failure_surfaces_modal`, `group_icon_patch_sent`, `mute_round_trip_through_gateway`, `status_change_sends_op3`, `idle_after_10_min_fake_clock`, `idle_falls_back_to_window_input_without_probe`, `relationship_accept_round_trip`, `invite_accept_selects_channel`, `legacy_ack_fallback`, `notification_click_raises_and_selects`, `copy_image_writes_png`. - New: `crates/fluxer-ui/tests/app.rs` `window_input_updates_last_input`. - Updated the runtime's notify-worker unit tests to the new click payload. The `click_actions` tests were removed with the function; the core tests of Daily use 24 cover that behaviour. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` passes locally. No `FLUXER_DESKTOP_TESTS=1` tests were run: the real idle probe and toast clicks are Task 27's and were not run here. ## Deviations from the plan - **New module.** The new code is in a new module, `apps/fluxer/src/dailyuse_rt.rs`, registered in `lib.rs`, instead of being added to `runtime.rs`, which was already 3,100 lines. - **Small changes outside the files list:** - `crates/fluxer-ui/src/message.rs`: a `UiMessage::WindowCommand` variant. - `crates/fluxer-ui/src/widgets/avatar.rs`: `DEFAULT_AVATARS` is now `pub`, for default-avatar notification icons. - `crates/fluxer-ui/README.md`. - `apps/fluxer/Cargo.toml`: `base64` added. It is already a workspace dependency used by four crates, so `cargo deny` is unchanged. - **New `fluxer_ui::run` argument:** `window_commands: Option<UnboundedReceiver<WindowCommand>>`. - **New devserver test accessors:** `Handle::devserver_presence()` and `Handle::chat_script()`, devserver feature only. Tests use them to read the recorded op 3s and to script a mention. - **`--devserver`:** with `--devserver` the system idle probe is not used (window input only), so fixture sessions do not depend on the machine. Stacked on: origin/dailyuse-24-core-notification-icon-passive Closes #517 Closes #134 Closes #317 Closes #372 Closes #397 Closes #54 Closes #55 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Executes every daily-use ApiRequest (guild settings, read-state acks with
the per-channel fallback on 404/405, relationships, invites, guilds,
member voice PATCH #134, group DM icon #317, reports, notes, DM pins),
sends CoreEvent::Idle every 15 s from the system idle probe or the
window's last input, loads notification icons through the image cache,
turns notification clicks into UserAction::NotificationClicked, raises
the window on Effect::Window(Raise) and copies images as PNG.

Refs #517

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The USER_GUILD_SETTINGS_UPDATE echo can reach the store before the PATCH
answer; the advisory applied channel is drained before each action.

Refs #517

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

Independent review: Daily use 28 (app-dailyuse-runtime), head 60023f03

Scope: git diff b15362fc..60023f03.

Central claim checked. Every daily-use ApiRequest from Task 11a (PatchUserGuildSettings, AckReadStates, every relationship, invite, guild, report, note and DM-pin request, plus UpdateMemberVoice #134 and EditGroupDmIcon #317) now goes to dailyuse_rt::perform. That function makes one fluxer-api call per request. None of them answers the 501 CLIENT_NOT_WIRED stub any more. The only 501s left are the catch-all arm, which is unreachable for these variants, not_a_chat_request, and DeleteRecentMention (#362, not in this task's scope).

Parity spot checks against the fork:

  • Member voice PATCH body matches VoiceParticipantMenuData.tsx:1194-1241 and MoveToChannelSubmenu.tsx:88. Mute is {mute}, deafen is {deaf}, move is {channel_id, connection_id}, disconnect is {channel_id: null, connection_id}.
  • Copy image matches MediaMenuData.tsx:415-505. It tries the URLs in this order: proxy as PNG, proxy, original. It converts the result to PNG. If none of them works, it copies the original URL as text.
  • The ack fallback triggers on the same 404/405 test as ReadStates.ts:996. For manual entries it sends POST /channels/{c}/messages/{m}/ack {manual, mention_count}, which matches. Automatic entries differ; see minor finding 1.
  • The group DM icon is sent as PATCH /channels/{id} {name, icon: dataURL}. edit_channel and create_guild stay unobserved, so the data URI never reaches --record.

Tests. Every test the plan names exists. That is all 12 in apps/fluxer/tests/dailyuse_runtime.rs and window_input_updates_last_input. Each one asserts what the plan describes.

Invariants. fluxer-core is untouched. The fluxer-ui additions do no I/O: they are an atomic last-input instant and a window-command subscription. Nothing logs a secret, a signed URL or a file path.

Findings

  1. minor, apps/fluxer/src/dailyuse_rt.rs (AckReadStates fallback): on 404/405, automatic entries (MarkGuildRead, manual: false) are sent one by one as POST /channels/{c}/messages/{m}/ack {}. The original's postLegacyAckEntries (ReadStates.ts:950-973) sends them in one POST /read-states/ack-bulk {read_states:[{channel_id,message_id}]} and acks only manual entries per message. The plan and the core doc both say "per entry", so this is not blocking. Still, an instance without /read-states/ack gets up to 100 sequential requests where the original sends one. Suggest a follow-up issue.
  2. minor, apps/fluxer/src/runtime.rs module doc: the new "daily-use requests" paragraph sits in the middle of the effect table, so the Media and Update rows now render outside it. Move the paragraph below the table.
  3. minor, file list: edits were made outside the plan's file list. They are fluxer-ui/src/message.rs (UiMessage::WindowCommand), the now-public widgets/avatar.rs::DEFAULT_AVATARS, a new fluxer_ui::run parameter, and the new module apps/fluxer/src/dailyuse_rt.rs. apps/fluxer also now depends on base64 (already a workspace dependency, and cargo deny is green). None of these files is owned by a concurrent task in the plan, so they are acceptable. They should be listed in the PR body.
  4. minor, crates/fluxer-ui/src/app.rs: Raise acts on window::oldest(). That is correct while the main window is the first one opened. If a pop-out could ever outlive the main window, a later window would be raised instead.

CI

FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in the review worktree: all steps passed. The dailyuse_runtime tests pass 12/12, and window_input_updates_last_input passes.

Verdict: approved (no blocking findings, CI green).

## Independent review: Daily use 28 (app-dailyuse-runtime), head 60023f03 Scope: `git diff b15362fc..60023f03`. **Central claim checked.** Every daily-use `ApiRequest` from Task 11a (`PatchUserGuildSettings`, `AckReadStates`, every relationship, invite, guild, report, note and DM-pin request, plus `UpdateMemberVoice` #134 and `EditGroupDmIcon` #317) now goes to `dailyuse_rt::perform`. That function makes one `fluxer-api` call per request. None of them answers the 501 `CLIENT_NOT_WIRED` stub any more. The only 501s left are the catch-all arm, which is unreachable for these variants, `not_a_chat_request`, and `DeleteRecentMention` (#362, not in this task's scope). **Parity spot checks against the fork:** - Member voice PATCH body matches `VoiceParticipantMenuData.tsx:1194-1241` and `MoveToChannelSubmenu.tsx:88`. Mute is `{mute}`, deafen is `{deaf}`, move is `{channel_id, connection_id}`, disconnect is `{channel_id: null, connection_id}`. - Copy image matches `MediaMenuData.tsx:415-505`. It tries the URLs in this order: proxy as PNG, proxy, original. It converts the result to PNG. If none of them works, it copies the original URL as text. - The ack fallback triggers on the same 404/405 test as `ReadStates.ts:996`. For manual entries it sends `POST /channels/{c}/messages/{m}/ack {manual, mention_count}`, which matches. Automatic entries differ; see minor finding 1. - The group DM icon is sent as `PATCH /channels/{id} {name, icon: dataURL}`. `edit_channel` and `create_guild` stay unobserved, so the data URI never reaches `--record`. **Tests.** Every test the plan names exists. That is all 12 in `apps/fluxer/tests/dailyuse_runtime.rs` and `window_input_updates_last_input`. Each one asserts what the plan describes. **Invariants.** `fluxer-core` is untouched. The `fluxer-ui` additions do no I/O: they are an atomic last-input instant and a window-command subscription. Nothing logs a secret, a signed URL or a file path. ### Findings 1. **minor**, `apps/fluxer/src/dailyuse_rt.rs` (AckReadStates fallback): on 404/405, automatic entries (`MarkGuildRead`, `manual: false`) are sent one by one as `POST /channels/{c}/messages/{m}/ack {}`. The original's `postLegacyAckEntries` (`ReadStates.ts:950-973`) sends them in one `POST /read-states/ack-bulk {read_states:[{channel_id,message_id}]}` and acks only manual entries per message. The plan and the core doc both say "per entry", so this is not blocking. Still, an instance without `/read-states/ack` gets up to 100 sequential requests where the original sends one. Suggest a follow-up issue. 2. **minor**, `apps/fluxer/src/runtime.rs` module doc: the new "daily-use requests" paragraph sits in the middle of the effect table, so the `Media` and `Update` rows now render outside it. Move the paragraph below the table. 3. **minor**, file list: edits were made outside the plan's file list. They are `fluxer-ui/src/message.rs` (`UiMessage::WindowCommand`), the now-public `widgets/avatar.rs::DEFAULT_AVATARS`, a new `fluxer_ui::run` parameter, and the new module `apps/fluxer/src/dailyuse_rt.rs`. `apps/fluxer` also now depends on `base64` (already a workspace dependency, and `cargo deny` is green). None of these files is owned by a concurrent task in the plan, so they are acceptable. They should be listed in the PR body. 4. **minor**, `crates/fluxer-ui/src/app.rs`: `Raise` acts on `window::oldest()`. That is correct while the main window is the first one opened. If a pop-out could ever outlive the main window, a later window would be raised instead. ### CI `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in the review worktree: **all steps passed**. The dailyuse_runtime tests pass 12/12, and `window_input_updates_last_input` passes. **Verdict: approved** (no blocking findings, CI green).
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:42 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.