Text chat 25: Rich composer and autocomplete (#275) #391

Manually merged
charles merged 2 commits from textchat-25-ui-composer into textchat 2026-11-13 02:55:49 +00:00
Owner

What this builds

The rich composer of spec §3.2 / §9.1, wired to the Text chat 11 and 14 core.

  • screens::main::composer (new): model(&App, channel, &ComposerOptions) -> ComposerView, State, update(.., now) -> Vec<UserAction>, view, popup, edit_box, with_plus_menu, wanted.
    • status_rail: typing on the left, slowmode on the right ("Slowmode is active (mm:ss)" / "Slowmode is enabled", clock icon, the original's tooltips), 1.5 rem above the box (InputWrapper.module.css .statusRail, SlowmodeIndicator.*).
    • reply_bar: "Replying to {name}" (click jumps), "@ ON/OFF" toggle with its tooltip (hidden for own messages and DMs), Cancel reply (ChannelReplyBar.*).
    • buttons: plus button, GIFs / Media / Stickers / Emojis / Send (2 rem, 1.375 rem Phosphor icons, tooltips), shown per the input-button settings, none without SEND_MESSAGES (TextareaButtons.tsx, TextareaButton.module.css).
    • plus_menu: "Upload file", "Upload your message as a file" (with text), "Customize" submenu toggling the five buttons (SetChatSetting); two presses of + within 500 ms open the file dialog (OpenFileDialog(Attach)).
    • autocomplete: the popup over the composer: headings (Members/Roles/Mentions, Channels, Emojis, Stickers, Media, Commands), dividers, rows with 24 px avatars (#211), 1.5 rem emoji (Text chat 8 emoji::view), 2 rem stickers, descriptions ("Default emoji", guild name, the @everyone/@here/role strings), selected row highlighted, max 30.625 rem; click selects.
    • highlighter: an iced Highlighter for the text box: bold/italic/code/heading/subtext/links/code fences across lines, the store's mention spans in --text-link.
    • edit: the inline edit box drawn in the message row with "Escape to cancel • Enter to save" (links do what the keys do) (EditingMessageInput.*).
    • Character counter over 80 % (number in the box corner, --status-danger under 50, tooltip "{n} characters left" / "Message is too long"); @everyone/@here confirm card (MentionEveryonePopout.*); placeholder "You can't send messages in this channel." without permission.
    • ComposerOptions { placeholder, send_on_enter, slash_commands, typing, draft_key } with today's behaviour as default (interface note for Text chat 44/46).
  • widgets::composer is now the text area only: binding(KeyPress, &KeyContext) (Enter / Shift+Enter, Enter is a newline inside a code fence and Ctrl+Enter sends, Ctrl+B/I/U/Shift+S wrap the selection, Up on empty → EditLastMessage, Escape, arrows/Enter/Tab in the popup), text_area(..), cursor ↔ byte offset helpers.
  • Escape ladder: plus menu → @everyone confirm → popup (ComposerAutocomplete(Dismiss)) → ComposerEscape(channel) (core: edit → sticker → attachments → reply); in the edit box → CancelEdit.
  • The text boxes stay in sync with the store's draft: a change the store makes (pick, send, edit start) reaches the box on the next snapshot, while snapshots that only echo what was typed (or arrive late) never take keystrokes back.
  • A printable key while nothing is focused types into the composer and focuses it (WindowEvent::Key gained text); opening an inline edit focuses its box, closing it returns to the composer; Escape at window level closes the plus menu.
  • media::wanted asks for the popup's emoji, sticker and avatar images.

How it was tested

  • crates/fluxer-ui/tests/composer.rs (no renderer, runs on every runner): placeholder_by_channel_kind, ctrl_b_wraps_selection, enter_in_fence_is_newline, up_on_empty_emits_edit_last, escape_ladder, popup_keyboard_navigation, counter_shown_over_80_percent, buttons_follow_settings, plus_double_press_opens_dialog, edit_box_save_and_cancel, plus printable_key_while_unfocused_types_into_the_composer. Unit tests for the highlighter and the slowmode strings.
  • Screenshots (Linux, lavapipe) against the devserver textchat scenario's READY: composer_reply, composer_autocomplete_mentions, composer_autocomplete_emoji, composer_edit_inline, composer_counter, documented in docs/screenshots/README.md. No Electron reference capture was possible from this agent (no access to a logged-in Electron app); dimensions come from the fork files named above and in each test's doc comment.
  • The 11 existing goldens that show the composer were regenerated (main-general, code_block_highlighted, incoming_call, profile_popout_*, sidebar_*, stream_hover_card, stream_pip, voice_panel_*): only the composer area changed (the box is now 3.625 rem with the plus button and the four buttons; the typing rail is above it).
  • Existing message view tests ported to the new messages (ComposerEdited, SendRichMessage).
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally. No desktop-only (FLUXER_DESKTOP_TESTS) tests in this task.

Deviations / for the reviewer

  • Sending now goes through the rich path (ComposerEdited + SendDraft → ApiRequest::SendRichMessage), no longer DraftChanged; Text chat 21's runtime (now on textchat) executes it.
  • Outside the Files list, kept minimal: widgets/message_row.rs (Message::Editor + view_editing, "(edited)" hidden while editing), screens/main/mod.rs (pub mod composer, plus menu drawn at screen level), app.rs + message.rs (printable key → composer, focus follows the inline edit, Escape closes the plus menu), tests/{message_list,message_view,screenshots}.rs, docs/screenshots/README.md, docs/parity/settings.toml (note on "Message input buttons").
  • The GIFs / Media / Stickers / Emojis buttons render but do nothing yet: the expression picker opens from them in Text chat 27. The edit box has no emoji button for the same reason.
  • iced's editor formats only colour and font: underline, strikethrough and spoilers keep their markers without a style, code has no background; mentions are coloured text, not pills (spec §15).
  • The plus menu rows have no icons (the shared context_menu has none); "Send voice message" (spec §1) and "Send gift" (not on this instance) are left out; "Upload file" is absent without ATTACH_FILES instead of shown disabled with a hint.
  • While a message is edited inline, typing in the main composer stays local and reaches the store with the next change after the edit (the store routes ComposerEdited to the edit while one is open). The autocomplete popup of an inline edit is drawn above the main composer.
  • The @everyone confirm counts the guild's member_count for both @everyone and @here (the original counts online members for @here).

Merge with textchat (Text chat 21–24)

origin/textchat (6113a8e) is merged into this branch. Conflicts resolved: widgets/message_row.rs (the inline edit box now replaces only the text in Text chat 24's row; attachments, embeds, stickers, forward and reactions stay below it; "(edited)" hidden while editing), screens/main/messages.rs (edit box plus the new row events), screens/main/media.rs (composer popup images plus attachments/embeds/lightbox), theme/icons.rs, the READMEs and tests/screenshots.rs (both sides' scenarios kept). The 13 goldens Text chat 22–24 added (attachment*, embed_*, message_*, reactors_modal) were regenerated on lavapipe (fluxer-native-shots:u2204 container): only the message list's position changed, because the composer box is taller. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green again after the merge.

Review findings 1–3 (draft echo race after Send, typing into the main box during an inline edit, update ignoring ComposerOptions) are not addressed here: follow-up #400.

Closes #275

🤖 Generated with Claude Code

## What this builds The rich composer of spec §3.2 / §9.1, wired to the Text chat 11 and 14 core. - `screens::main::composer` (new): `model(&App, channel, &ComposerOptions) -> ComposerView`, `State`, `update(.., now) -> Vec<UserAction>`, `view`, `popup`, `edit_box`, `with_plus_menu`, `wanted`. - `status_rail`: typing on the left, slowmode on the right ("Slowmode is active (mm:ss)" / "Slowmode is enabled", clock icon, the original's tooltips), 1.5 rem above the box (`InputWrapper.module.css .statusRail`, `SlowmodeIndicator.*`). - `reply_bar`: "Replying to **{name}**" (click jumps), "@ ON/OFF" toggle with its tooltip (hidden for own messages and DMs), Cancel reply (`ChannelReplyBar.*`). - `buttons`: plus button, GIFs / Media / Stickers / Emojis / Send (2 rem, 1.375 rem Phosphor icons, tooltips), shown per the input-button settings, none without SEND_MESSAGES (`TextareaButtons.tsx`, `TextareaButton.module.css`). - `plus_menu`: "Upload file", "Upload your message as a file" (with text), "Customize" submenu toggling the five buttons (`SetChatSetting`); two presses of + within 500 ms open the file dialog (`OpenFileDialog(Attach)`). - `autocomplete`: the popup over the composer: headings (Members/Roles/Mentions, Channels, Emojis, Stickers, Media, Commands), dividers, rows with 24 px avatars (#211), 1.5 rem emoji (Text chat 8 `emoji::view`), 2 rem stickers, descriptions ("Default emoji", guild name, the `@everyone`/`@here`/role strings), selected row highlighted, max 30.625 rem; click selects. - `highlighter`: an iced `Highlighter` for the text box: bold/italic/code/heading/subtext/links/code fences across lines, the store's mention spans in `--text-link`. - `edit`: the inline edit box drawn in the message row with "Escape to cancel • Enter to save" (links do what the keys do) (`EditingMessageInput.*`). - Character counter over 80 % (number in the box corner, `--status-danger` under 50, tooltip "{n} characters left" / "Message is too long"); `@everyone`/`@here` confirm card (`MentionEveryonePopout.*`); placeholder "You can't send messages in this channel." without permission. - `ComposerOptions { placeholder, send_on_enter, slash_commands, typing, draft_key }` with today's behaviour as default (interface note for Text chat 44/46). - `widgets::composer` is now the text area only: `binding(KeyPress, &KeyContext)` (Enter / Shift+Enter, Enter is a newline inside a code fence and Ctrl+Enter sends, Ctrl+B/I/U/Shift+S wrap the selection, Up on empty → `EditLastMessage`, Escape, arrows/Enter/Tab in the popup), `text_area(..)`, cursor ↔ byte offset helpers. - Escape ladder: plus menu → `@everyone` confirm → popup (`ComposerAutocomplete(Dismiss)`) → `ComposerEscape(channel)` (core: edit → sticker → attachments → reply); in the edit box → `CancelEdit`. - The text boxes stay in sync with the store's draft: a change the store makes (pick, send, edit start) reaches the box on the next snapshot, while snapshots that only echo what was typed (or arrive late) never take keystrokes back. - A printable key while nothing is focused types into the composer and focuses it (`WindowEvent::Key` gained `text`); opening an inline edit focuses its box, closing it returns to the composer; Escape at window level closes the plus menu. - `media::wanted` asks for the popup's emoji, sticker and avatar images. ## How it was tested - `crates/fluxer-ui/tests/composer.rs` (no renderer, runs on every runner): `placeholder_by_channel_kind`, `ctrl_b_wraps_selection`, `enter_in_fence_is_newline`, `up_on_empty_emits_edit_last`, `escape_ladder`, `popup_keyboard_navigation`, `counter_shown_over_80_percent`, `buttons_follow_settings`, `plus_double_press_opens_dialog`, `edit_box_save_and_cancel`, plus `printable_key_while_unfocused_types_into_the_composer`. Unit tests for the highlighter and the slowmode strings. - Screenshots (Linux, lavapipe) against the devserver `textchat` scenario's READY: `composer_reply`, `composer_autocomplete_mentions`, `composer_autocomplete_emoji`, `composer_edit_inline`, `composer_counter`, documented in `docs/screenshots/README.md`. No Electron reference capture was possible from this agent (no access to a logged-in Electron app); dimensions come from the fork files named above and in each test's doc comment. - The 11 existing goldens that show the composer were regenerated (`main-general`, `code_block_highlighted`, `incoming_call`, `profile_popout_*`, `sidebar_*`, `stream_hover_card`, `stream_pip`, `voice_panel_*`): only the composer area changed (the box is now 3.625 rem with the plus button and the four buttons; the typing rail is above it). - Existing message view tests ported to the new messages (`ComposerEdited`, `SendRichMessage`). - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. No desktop-only (`FLUXER_DESKTOP_TESTS`) tests in this task. ## Deviations / for the reviewer - **Sending now goes through the rich path** (`ComposerEdited` + `SendDraft` → `ApiRequest::SendRichMessage`), no longer `DraftChanged`; Text chat 21's runtime (now on `textchat`) executes it. - Outside the Files list, kept minimal: `widgets/message_row.rs` (`Message::Editor` + `view_editing`, "(edited)" hidden while editing), `screens/main/mod.rs` (`pub mod composer`, plus menu drawn at screen level), `app.rs` + `message.rs` (printable key → composer, focus follows the inline edit, Escape closes the plus menu), `tests/{message_list,message_view,screenshots}.rs`, `docs/screenshots/README.md`, `docs/parity/settings.toml` (note on "Message input buttons"). - The GIFs / Media / Stickers / Emojis buttons render but do nothing yet: the expression picker opens from them in Text chat 27. The edit box has no emoji button for the same reason. - iced's editor formats only colour and font: underline, strikethrough and spoilers keep their markers without a style, code has no background; mentions are coloured text, not pills (spec §15). - The plus menu rows have no icons (the shared `context_menu` has none); "Send voice message" (spec §1) and "Send gift" (not on this instance) are left out; "Upload file" is absent without ATTACH_FILES instead of shown disabled with a hint. - While a message is edited inline, typing in the main composer stays local and reaches the store with the next change after the edit (the store routes `ComposerEdited` to the edit while one is open). The autocomplete popup of an inline edit is drawn above the main composer. - The `@everyone` confirm counts the guild's `member_count` for both `@everyone` and `@here` (the original counts online members for `@here`). ## Merge with textchat (Text chat 21–24) `origin/textchat` (6113a8e) is merged into this branch. Conflicts resolved: `widgets/message_row.rs` (the inline edit box now replaces only the text in Text chat 24's row; attachments, embeds, stickers, forward and reactions stay below it; "(edited)" hidden while editing), `screens/main/messages.rs` (edit box plus the new row events), `screens/main/media.rs` (composer popup images plus attachments/embeds/lightbox), `theme/icons.rs`, the READMEs and `tests/screenshots.rs` (both sides' scenarios kept). The 13 goldens Text chat 22–24 added (`attachment*`, `embed_*`, `message_*`, `reactors_modal`) were regenerated on lavapipe (`fluxer-native-shots:u2204` container): only the message list's position changed, because the composer box is taller. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green again after the merge. Review findings 1–3 (draft echo race after Send, typing into the main box during an inline edit, `update` ignoring `ComposerOptions`) are not addressed here: follow-up #400. Closes #275 🤖 Generated with [Claude Code](https://claude.com/claude-code)
# Conflicts:
#	crates/fluxer-proto/README.md
#	crates/fluxer-proto/src/gateway/events.rs
#	crates/fluxer-proto/src/models/channel.rs
#	crates/fluxer-proto/src/models/mod.rs
#	crates/fluxer-proto/src/models/settings.rs
#	crates/fluxer-proto/tests/models_roundtrip.rs
Refs #264

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Guild emoji and stickers from READY / GUILD_CREATE and the update events;
usability as checkEmojiAvailability (own guild, USE_EXTERNAL_EMOJIS /
STICKERS plus feature_global_expressions); the emoji picker's sections
(Favorited, Frequently used 42, guild sections, Unicode categories) and
merged search; sticker, saved media and GIF picker selectors.

Frecency counted on picks (composer, reaction, sticker, saved media) and
on the emoji of sent messages. The picker data, skin tone, favourite GIFs
and soundboard favourites (#92) are read from synced_preferences and
written 1.5 s after the last change on top of the last snapshot, every
other field byte for byte; an unreadable snapshot is never written over.

GIF search debounced 350/1000 ms, suggestions 250/900 ms, skeleton after
800 ms, featured cached per session, register-share on pick, auto-send or
append with Shift. Stickers send alone or wait with text; saved media send
favorite_meme_id and come with READY.favorite_memes (shaped from
fluxer_api/src/api/rpc/RpcService.ts:1164, read in GatewayReady.ts:150).

Refs #264

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

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts:
#	crates/fluxer-proto/tests/models_roundtrip.rs
Review of #312: a soundboard star, a skin tone on its way, and a
settings update without synced_preferences.

Refs #264

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Each part of a snapshot replaces the local one only when another device
changed it; a pending local change otherwise survives and is written on
top. The soundboard no longer reads the settings itself: the expressions
decide and App applies their soundboard favourites after the text chat
reduces. Settings without synced_preferences change nothing.

Refs #264

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- The soundboard favourites adopted from a snapshot are saved to the local
  settings (persist saves any change of them, whatever the event), and the
  "local list meets an empty synced list" migration runs once: the local
  settings remember that the list has been in step with the account
  ([voice.soundboard] synced, in fluxer-platform's settings file).
- A write of the synced preferences is tracked until answered; when it
  fails its parts go back into the snapshot and are pending again, and a
  snapshot that still holds what a write was built on is not another
  device's change.
- READY no longer resets the sync state: a change waiting in the debounce
  survives a re-identify.

Refs #264

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts with Text chat 11 (composer), 12, 13, 15 and 18 resolved by keeping both sides.
The composer now inserts a picked emoji at the cursor itself, so the expressions only count
the pick (no second insertion); stickers and GIF links use the composer's Draft::new /
draft() and schedule the draft save. The 1500 ms prefs debounce test filters on its own timer,
since the pick also schedules the composer's 400 ms draft save.

Refs #264

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The composer of Text chat spec §3.2/§9.1 in `screens::main::composer`: status rail
(typing, slowmode), reply bar with the mention toggle, input row (plus button, text
area with Markdown/mention highlighting, GIFs/Media/Stickers/Emojis/Send by the
input-button settings), character counter, autocomplete popup (24 px avatars, #211),
`@everyone` confirm, plus menu with its Customize submenu (double press opens the file
dialog) and the inline edit box in the message row. `widgets::composer` is now the
text area with the original's key bindings. The composer talks to the store with
`ComposerEdited`, `SendDraft`, `ComposerAutocomplete`, `ComposerEscape`,
`EditLastMessage`, `SaveEdit`/`CancelEdit` and friends instead of `DraftChanged`.

Refs #275

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The plus menu's anchor is in window coordinates, so `main::view` draws it over the
screen rather than the message view. Opening an inline edit moves the keyboard focus
to its box, closing it back to the composer.

Refs #275

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Author
Owner

Independent review: Text chat 25 (ui-composer)

Reviewed git diff fec9421c..origin/textchat-25-ui-composer (ef9f693) cold.

Plan tests: all 10 named tests exist in crates/fluxer-ui/tests/composer.rs and assert the plan/spec behaviour: placeholders "Message #general" / "Message @Ada L." / "Message Weekend plans", the Ctrl+B/I/U/Ctrl+Shift+S wraps (Ctrl+S alone is not a wrap), Enter/Shift+Enter/fence/Ctrl+Enter, Up on an empty box → EditLastMessage, the Escape ladder (plus menu → popup → store ladder → inline edit), popup Down/Up/Enter/Tab, the counter (hidden at 1600/2000, "399 characters left" at 1601, danger under 50, "Message is too long" over the limit), the buttons following the settings plus the Customize toggle, the plus double press within 500 ms, and the edit box with "Escape to cancel • Enter to save". There is 1 extra test (printable key). All 5 composer_* screenshot goldens exist and pass.
Interfaces (spec §9.1): everything is present: highlighter (Markdown plus --text-link mentions), key bindings, popup (sections, 24 px avatars #211, emoji 24 / sticker 32, max height 490 px = 30.625 rem), reply bar with toggle and tooltips, inline edit, status rail with typing and slowmode "Slowmode is active (mm:ss)", counter, button row, plus menu with Customize, @everyone confirm, and a printable key focusing the composer.
Invariants: fluxer-ui gains no I/O path and has no new dependencies. fluxer-core is untouched. There are no new fixtures and no paths or secrets. Highlighter and autocomplete indexing runs only on local text or store spans (clamped, and only when they match the shown text), so server data cannot panic the client.
Local CI: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci → exit 0 (357 test binaries ok, composer goldens ran on Vulkan).

Findings

  1. minor (screens/main/composer/mod.rs, Mirror::sync): after expect_change() (Send, popup pick, @everyone confirm), any snapshot that differs from the box replaces it, and sent is cleared first. Example: the runtime is still behind (store at "hel" while the box shows "hello"), the user presses Enter, a late "hel" snapshot overwrites the box, and if the user types "x" before the clearing snapshot arrives, ComposerEdited("helx") lands after the send, so the next draft starts with stale text. It needs Enter within one snapshot latency of the last keystroke, so this is a narrow race. Suggest keeping sent across expect_change and treating a text found in sent as an echo even while expecting.
  2. minor (app.rs printable key / State::type_text, and update for TextArea(Edit) while editing): text typed into the main box during an inline edit is not told to the store (told is reset so that the next change tells it). The key handler also focuses EDITOR_ID rather than the edit box while editing. If the user then switches channel or presses Enter without another keystroke, those characters are dropped (Mirror::new from the store, or SendDraft of the store's older draft).
  3. minor (composer::update): it rebuilds the view with ComposerOptions::default() and always uses channel's draft, so send_on_enter / draft_key / slash_commands are not honoured on the update path. Text chat 44/46 will need update to take the options (or the ComposerView). The current interface does not break, but it is worth knowing before 46 starts.
  4. minor / note (known): sending now goes through SendDraft → SendRichMessage, which the runtime answers with "text chat requests are not wired yet (Text chat 21)". Until 21 merges, the app on textchat shows "Failed to send" for every message (the content stays in the failed pending row). The plan's ordering allows this; mention it in the merge notes.
  5. minor / note: 11 existing goldens were regenerated (composer area only, per the PR). Expect golden conflicts with Tasks 22–24; whoever merges second must regenerate.

None of these is blocking: no interface is broken, no invariant is violated and CI is green.

Verdict: APPROVE (0 blocking, 5 minor).

## Independent review: Text chat 25 (ui-composer) Reviewed `git diff fec9421c..origin/textchat-25-ui-composer` (ef9f693) cold. **Plan tests:** all 10 named tests exist in `crates/fluxer-ui/tests/composer.rs` and assert the plan/spec behaviour: placeholders "Message #general" / "Message @Ada L." / "Message Weekend plans", the Ctrl+B/I/U/Ctrl+Shift+S wraps (Ctrl+S alone is not a wrap), Enter/Shift+Enter/fence/Ctrl+Enter, Up on an empty box → `EditLastMessage`, the Escape ladder (plus menu → popup → store ladder → inline edit), popup Down/Up/Enter/Tab, the counter (hidden at 1600/2000, "399 characters left" at 1601, danger under 50, "Message is too long" over the limit), the buttons following the settings plus the Customize toggle, the plus double press within 500 ms, and the edit box with "Escape to cancel • Enter to save". There is 1 extra test (printable key). All 5 `composer_*` screenshot goldens exist and pass. **Interfaces (spec §9.1):** everything is present: highlighter (Markdown plus `--text-link` mentions), key bindings, popup (sections, 24 px avatars #211, emoji 24 / sticker 32, max height 490 px = 30.625 rem), reply bar with toggle and tooltips, inline edit, status rail with typing and slowmode "Slowmode is active (mm:ss)", counter, button row, plus menu with Customize, `@everyone` confirm, and a printable key focusing the composer. **Invariants:** fluxer-ui gains no I/O path and has no new dependencies. fluxer-core is untouched. There are no new fixtures and no paths or secrets. Highlighter and autocomplete indexing runs only on local text or store spans (clamped, and only when they match the shown text), so server data cannot panic the client. **Local CI:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` → exit 0 (357 test binaries ok, composer goldens ran on Vulkan). ### Findings 1. **minor** (`screens/main/composer/mod.rs`, `Mirror::sync`): after `expect_change()` (Send, popup pick, `@everyone` confirm), any snapshot that differs from the box replaces it, and `sent` is cleared first. Example: the runtime is still behind (store at "hel" while the box shows "hello"), the user presses Enter, a late "hel" snapshot overwrites the box, and if the user types "x" before the clearing snapshot arrives, `ComposerEdited("helx")` lands after the send, so the next draft starts with stale text. It needs Enter within one snapshot latency of the last keystroke, so this is a narrow race. Suggest keeping `sent` across `expect_change` and treating a text found in `sent` as an echo even while `expecting`. 2. **minor** (`app.rs` printable key / `State::type_text`, and `update` for `TextArea(Edit)` while editing): text typed into the main box during an inline edit is not told to the store (`told` is reset so that the *next* change tells it). The key handler also focuses `EDITOR_ID` rather than the edit box while editing. If the user then switches channel or presses Enter without another keystroke, those characters are dropped (`Mirror::new` from the store, or `SendDraft` of the store's older draft). 3. **minor** (`composer::update`): it rebuilds the view with `ComposerOptions::default()` and always uses `channel`'s draft, so `send_on_enter` / `draft_key` / `slash_commands` are not honoured on the update path. Text chat 44/46 will need `update` to take the options (or the `ComposerView`). The current interface does not break, but it is worth knowing before 46 starts. 4. **minor / note** (known): sending now goes through `SendDraft` → `SendRichMessage`, which the runtime answers with "text chat requests are not wired yet (Text chat 21)". Until 21 merges, the app on `textchat` shows "Failed to send" for every message (the content stays in the failed pending row). The plan's ordering allows this; mention it in the merge notes. 5. **minor / note**: 11 existing goldens were regenerated (composer area only, per the PR). Expect golden conflicts with Tasks 22–24; whoever merges second must regenerate. None of these is blocking: no interface is broken, no invariant is violated and CI is green. **Verdict: APPROVE** (0 blocking, 5 minor).
charles manually merged commit e0ea205e2c into textchat 2026-11-13 02:55:49 +00:00
Author
Owner

Independent review of Text chat 25 (rich composer), diff 6113a8e..e9a6952, read cold.

Note: this PR was already merged into textchat (220acce) before this review ran. The findings below apply to textchat as it stands now.

Checks

  1. Plan tests: all 10 named tests are in crates/fluxer-ui/tests/composer.rs, plus printable_key_while_unfocused_types_into_the_composer. They assert the values in spec §3.2: placeholders "Message #general", "Message @Ada L." and "Message Weekend plans"; Ctrl+B/I/U/Shift+S wrap and Ctrl+S alone does nothing; Enter in a fence makes a newline and Ctrl+Enter sends; Up on an empty box gives EditLastMessage; the counter is hidden at 1600 of 2000, shows "399 characters left" at 1601, turns danger under 50, and says "Message is too long" over the limit; a second plus press within 500 ms opens the dialog; the edit hint is "Escape to cancel • Enter to save". All 5 screenshot tests (composer_reply, composer_autocomplete_mentions, composer_autocomplete_emoji, composer_edit_inline, composer_counter) exist and are cfg(not(windows)).
  2. Interfaces: ComposerOptions { placeholder, send_on_enter, slash_commands, typing, draft_key: DraftKey } exists with today's behaviour as the defaults. It is taken by composer::model, and view draws the resulting ComposerView. Tasks 44 and 46 can use it this way (see minor 1).
  3. Invariants: the diff does not touch fluxer-core, fluxer-proto, fluxer-emoji, any Cargo.toml or Cargo.lock. It adds no I/O to fluxer-ui: the composer images go through media::wanted and the existing ImageLoader. No new fixtures. No secrets, URLs or paths. Every slice in the highlighter, position_of and key_context is clamped to a char boundary.
  4. Review Focus: none of the items is this task's. (Item 2, wire content, belongs to Text chat 11; the UI sends SendDraft and leaves the conversion to core.)
  5. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh worktree at e9a6952: exit 0, all steps passed. The screenshot tests ran on the host GPU.

Merge resolution (message_row::view_with): checked. The editor replaces only the text inside with_render_ctx. Attachments, embeds, stickers, the forward, reactions and the failed footer still draw below it, and "(edited)" is hidden while editing. When a message is being edited, the "[system message]" placeholder is skipped. A system row returns before the editor is drawn, which is harmless because core only starts an edit on own DEFAULT or REPLY messages. messages.rs sends Message::Editor to composer::Message::EditArea.

Findings

  • minor 1: composer::update still builds its view with ComposerOptions::default() and the channel draft, so send_on_enter, draft_key and slash_commands are ignored when updating. Tasks 44 and 46 have to fix this. Tracked in #400 (3).
  • minor 2: the draft echo race after Send, pick or confirm (Mirror::sync clears sent when expect_change is called) is still there. Tracked in #400 (1).
  • minor 3: text typed into the main box during an inline edit is not sent to the store until the next keystroke. A printable key while unfocused focuses EDITOR_ID, not the edit box. Tracked in #400 (2).
  • minor 4: highlighter::Settings::from_spans slices &text[..span.start] without checking is_char_boundary. Today it is safe because highlight() only passes spans when the store's text equals the box's text, and core keeps the spans on boundaries. A .filter(|s| text.is_char_boundary(s.start) && text.is_char_boundary(s.end)) would make it safe even if a corrupted persisted draft ever arrives.

Verdict: approve. 0 blocking, 4 minor (3 already tracked in #400). CI green locally.

Independent review of Text chat 25 (rich composer), diff `6113a8e..e9a6952`, read cold. Note: this PR was already merged into `textchat` (220acce) before this review ran. The findings below apply to `textchat` as it stands now. **Checks** 1. Plan tests: all 10 named tests are in `crates/fluxer-ui/tests/composer.rs`, plus `printable_key_while_unfocused_types_into_the_composer`. They assert the values in spec §3.2: placeholders "Message #general", "Message @Ada L." and "Message Weekend plans"; Ctrl+B/I/U/Shift+S wrap and Ctrl+S alone does nothing; Enter in a fence makes a newline and Ctrl+Enter sends; Up on an empty box gives `EditLastMessage`; the counter is hidden at 1600 of 2000, shows "399 characters left" at 1601, turns danger under 50, and says "Message is too long" over the limit; a second plus press within 500 ms opens the dialog; the edit hint is "Escape to cancel • Enter to save". All 5 screenshot tests (`composer_reply`, `composer_autocomplete_mentions`, `composer_autocomplete_emoji`, `composer_edit_inline`, `composer_counter`) exist and are `cfg(not(windows))`. 2. Interfaces: `ComposerOptions { placeholder, send_on_enter, slash_commands, typing, draft_key: DraftKey }` exists with today's behaviour as the defaults. It is taken by `composer::model`, and `view` draws the resulting `ComposerView`. Tasks 44 and 46 can use it this way (see minor 1). 3. Invariants: the diff does not touch `fluxer-core`, `fluxer-proto`, `fluxer-emoji`, any `Cargo.toml` or `Cargo.lock`. It adds no I/O to `fluxer-ui`: the composer images go through `media::wanted` and the existing ImageLoader. No new fixtures. No secrets, URLs or paths. Every slice in the highlighter, `position_of` and `key_context` is clamped to a char boundary. 4. Review Focus: none of the items is this task's. (Item 2, wire content, belongs to Text chat 11; the UI sends `SendDraft` and leaves the conversion to core.) 5. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh worktree at e9a6952: **exit 0, all steps passed**. The screenshot tests ran on the host GPU. **Merge resolution (`message_row::view_with`)**: checked. The editor replaces only the text inside `with_render_ctx`. Attachments, embeds, stickers, the forward, reactions and the failed footer still draw below it, and "(edited)" is hidden while editing. When a message is being edited, the "[system message]" placeholder is skipped. A system row returns before the editor is drawn, which is harmless because core only starts an edit on own DEFAULT or REPLY messages. `messages.rs` sends `Message::Editor` to `composer::Message::EditArea`. **Findings** - minor 1: `composer::update` still builds its view with `ComposerOptions::default()` and the `channel` draft, so `send_on_enter`, `draft_key` and `slash_commands` are ignored when updating. Tasks 44 and 46 have to fix this. Tracked in #400 (3). - minor 2: the draft echo race after Send, pick or confirm (`Mirror::sync` clears `sent` when `expect_change` is called) is still there. Tracked in #400 (1). - minor 3: text typed into the main box during an inline edit is not sent to the store until the next keystroke. A printable key while unfocused focuses `EDITOR_ID`, not the edit box. Tracked in #400 (2). - minor 4: `highlighter::Settings::from_spans` slices `&text[..span.start]` without checking `is_char_boundary`. Today it is safe because `highlight()` only passes spans when the store's text equals the box's text, and core keeps the spans on boundaries. A `.filter(|s| text.is_char_boundary(s.start) && text.is_char_boundary(s.end))` would make it safe even if a corrupted persisted draft ever arrives. Verdict: **approve**. 0 blocking, 4 minor (3 already tracked in #400). CI green locally.
Sign in to join this conversation.
No description provided.