Task 20: message_list virtualised widget, message rows, composer (#20) #61
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/20-ui-message-list-composer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this builds
The message view of the main screen (Foundation spec §5.2, plan Task 20).
widgets::message_list:MessageList, a custom iced widget overTimelineItems that builds and lays out only the rows that show (plus two either side). Rows are built duringlayout, their widget trees matched by message id. Row heights are an estimate (measure) until a row has been laid out, then the real height, cached per message and width. Pure rules, which the tests assert on:layout(heights, viewport, scroll) -> VisibleRange,anchor_at/scroll_for_anchor(the first visible message keeps its place when rows above are added or change height),ReachTop(on_reach_toponce per oldest row within 600 px; scrolling away re-arms it). At its end the list stays at its end; scrolled up, a new message shows the "Jump to present" pill (click: go to the end); a message the user sends goes to the end. Mouse wheel and a draggable scrollbar thumb.widgets::message_row: avatar 40 px, author in the colour of their highest coloured role,HH:MMwith the full date as tooltip, content throughrich_text, "(edited)", grouped rows with the time in the gutter on hover,Pendingat 50 % opacity,Failedwith red "Failed to send — Retry" (RetrySend { nonce }).widgets::day_separator,widgets::composer(multi-line, grows up to 50 % of the message view, Enter sends, Shift+Enter new line,DraftChangedon every edit, typing line below).screens::main::messages:State(composer text box, revealed spoilers, Markdown parsed once per message on the snapshot that brings it),model,update -> Vec<UserAction>,view. Wired intomain::viewand the shell.How it was tested
crates/fluxer-ui/tests/message_list.rs(15 tests). The four of the plan on the pure layout engine (only_visible_rows_are_laid_out,prepend_keeps_anchor_row_in_place,reach_top_fires_once_per_page,typing_summary_strings); model andupdatetests driven throughApp::applywith the fixtures (grouping, times with a UTC offset, edited, pending → failed → retry with the store's nonce, empty draft not sent, link clicks); and five headless widget tests that run the real message view through iced's widget protocol (layout, events, draw) with the software renderer, no window: fewer than 30 rows built for 50 messages, the list starts at its end, wheel scrolling,ReachedTopexactly once, the anchor row at the same y after an older page is prepended, the pill appearing and a click on it, sending while scrolled up, the composer growing by 22 px per line up to half of the view. WithFLUXER_UI_DUMP_DIR=<dir>these tests also write their frames as PNGs.fluxer --devserveron a private Xvfb display, driven with xdotool: opened#general, scrolled back through all 120 messages (three history pages load on the way, content does not jump), typed a two-line message with Shift+Enter, sent it with Enter; the echo appears and the list goes to its end. Result:docs/screenshots/main-messages.png. I could not capture the Electron side for a side-by-side.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciis green locally.Deviations from the plan
MessageList::newowns its inputs (Vec<TimelineItem>, boxedimpl Fn) instead of borrowing slices and&dyn Fn: views here return elements that outlive their inputs.fluxer_ui::viewandmain::viewnow tie the element to&'a App/&'a Local, andmain::viewtakes&Appas a third argument (the message view has no model of all messages, by design).main::MessagegainsMessages(messages::Message), so it is no longerCopy/Eq, andMessage::into_actionreturnsOption<UserAction>(NoneforMessages); the shell calls the newmain::update(&mut Local, message, &App).tests/main_model.rs(Task 18) is adjusted for theOption.rich_text::rich_text(nodes, ctx)(Task 19) no longer borrowsnodesandctxfor the element's lifetime; it never needed to (the span model is owned). Signature only.RollingTypingText.tsx,TypingTierText.ts): names for one, two and three people, "Several people are typing..." from four on, with.... The plan says "Several" from three and….rich_textreturns a finished element).AvatarSource, butfluxer_ui::runhas noImageLoaderyet, soRowCtx::imagesisNoneand authors get the bundled default avatar. Passing a loader intoruntouchesapps/fluxerand is not in this task's files.messages::State::utc_offsetis UTC until something provides the local offset (time'slocal-offsetfeature is not enabled; a view does not ask the OS). Times and day separators are therefore UTC for now.For the reviewer
message_list.rs:layout()builds children lazily and reconcilesTree::childrenby row key;diff()only diffs the pill. This is the part to read closely.MarkRead).Stacked on: task/18-ui-main-layout, task/19-ui-rich-text, task/21-ui-avatar-image-cache, task/10-core-messages-readstate
Closes #20
🤖 Generated with Claude Code
Independent review: Task 20 (ui-message-list-composer), commit
a1c70f1Reviewed
git diff 335350d..a1c70f1cold. Localcargo xtask ciin a fresh worktree with its own target dir: green (fmt, clippy, deny, tests incl. the 15 tests oftests/message_list.rs; screenshot step skipped becauseFLUXER_SCREENSHOT_TESTSwas not set in my run).Checks
only_visible_rows_are_laid_out,prepend_keeps_anchor_row_in_place,reach_top_fires_once_per_page,typing_summary_stringsall exist and assert on the pure layout engine (layout,anchor_at/scroll_for_anchor,ReachTop,REACH_TOP_DISTANCE= 600). See finding 1 for the typing strings.fluxer-ui; no network/file I/O added; no tokens or secrets in code or tests; server-controlled values (heights, NaN scroll, non-URL links, time formatting, offsets) go through clamps/checked_*/unwrap_or, no panicking path found in the diff.Findings
crates/fluxer-ui/src/widgets/composer.rs(typing_summary): the plan says "Several people are typing…" from 3 users; the code names three ("A, B and C are typing...") and says "Several" from four, with ASCII "...". I checked the fork (RollingTypingText.tsx,TYPING_ROLLING_MAX_NAMES = 3,TypingTierText.ts): the code matches the web app, so the plan is what is off. Note the web app shows other tier strings for 5+ typists in en-US/en-GB; here it is always "Several people are typing...". Plan text should be amended, or a follow-up opened.MessageList::newtakesVec<TimelineItem>andimpl Fnclosures (plus.key()/.on_reach_top()builders) instead of slices/&dyn Fn;composer::viewtakes a thirdtypingargument and an icedContent;main::viewtakes&Appas third argument;main::MessagelosesCopy/Eqandinto_actionreturnsOption<UserAction>. Tasks 22 and 24 must build against these, not the plan.crates/fluxer-ui/src/app.rs(now_unix): the shell readsSystemTime::now()on every snapshot. Not network or file I/O and it stays out of the views, but it is the first placefluxer-uireads the OS itself, and relative<t:…>timestamps only refresh when a snapshot arrives. Cleaner if the runtime supplied the time together with the local UTC offset that is already pending.crates/fluxer-ui/src/widgets/message_list.rs(layout): if row heights are still changing afterMAX_LAYOUT_PASSES(4), the rows of the final range that were not built in an earlier pass are not built, and nothing requests another layout, so a gap can show until the next event. Needs estimates that are badly off (very long messages on a first scroll); arequest_redraw/relayout on the unsettled case would close it.crates/fluxer-ui/src/widgets/message_list.rs(ReachTop/State::heights): a failed history fetch is only retried after scrolling beyond 600 px and back (documented in the test, but a list shorter than 600 px can never do that); the per-channel height cache is never pruned of deleted messages or replaced provisional ids (bounded by channel lifetime).ImageLoaderinrunyet) and times are UTC: all stated in the PR, each should have afollow-upissue linked before merge (only #60, MarkRead, exists as far as I can see).Read closely as requested: the lazy child building in
layout()keepsself.children,Tree::childrenand the layout node's children in the same order (pill first), reuses row trees byRowKeyacross rebuilds and relayouts, and resets on key or width change;operate/update/draw/overlayzip the three consistently. No defect found there beyond finding 4.Verdict: APPROVE (0 blocking, 6 minor; local ci green).
Windows CI failure (runs 89, 90:
message_list-*.exeexit code0xc0000135) diagnosed and fixed; head is now4febcd1, green on Linux and Windows for both push and pull_request.opengl32.dll. A test binary that builds aniced::Rendererlinks wgpu's GL backend and imports that DLL statically, so the loader kills it before any test runs.4febcd1): the five headless widget tests moved tocrates/fluxer-ui/tests/message_view.rs, which is#![cfg(not(windows))]; the ten layout, composer and model tests inmessage_list.rsstill run on Windows; shared helpers are intests/common. Linux still runs all fifteen. Using a tiny-skia-only renderer in the tests was not possible without making every view generic (fluxer_ui::Elementis fixed toiced::Renderer).5a7b2c3), kept: aName missing DLLsstep (tools/ci/missing-dlls.ps1) that runs only after a failed Windows job and names the unresolved DLLs of any executable that exited with0xc0000135.fluxer.exeprobably cannot start on this runner either, which matters for any future Windows smoke test.