Text chat 39: fluxer-core forums and media channels (#324) #449
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-39-core-forums"
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?
Stacked on: textchat-38-core-channel-routing
What this builds
fluxer-core::chat::forums(spec §18.2.1, §18.2.2, §18.4 "chat::forums"), filling Task 38's stub:Threads;selectors::forum_view(&App, forum) -> ForumViewModelsplits them asbuildForumPostListdoes (one pinned active post first, active posts, then "Older posts"), sorts by post id ("Date posted") or last activity, filters by tags (match_some/match_all), and gives the guidelines, search box, sort & layout (session overrides per forum, kept acrossREADY; media always a gallery, no "View as"), tag pills, list state (Loading/Ready/Empty/EmptySearch/Failed/Indexing), "Load older posts" and the composer model.ApiRequest::SearchThreads(archived=true, offset paging of 25; text searchname=+sort_by=relevance, debounced 300 ms). The first archived page is loaded when the forum is on screen and has fewer than 25 current posts, like the original. HTTP 202 is retried afterretry_afters, doubling, at most 6 times (ForumPosts.scheduleRetry); 403FEATURE_TEMPORARILY_DISABLEDswitches search off and falls back toArchivedThreads { kind: Public, before: <archive_timestamp> }.selectors::post_card(&App, post) -> PostCardModel(name, pinned, "New" badge from the forum's read-marker snapshot, ≤3 tags + "+N", author, preview Text/Deleted/Loading from the notification text, first image/video skipping spoiler/NSFW/expired, default reaction, message count, unread label, last activity, open). First messages come from search results,ForumPostCreated,MESSAGE_CREATEin the post (id == post id), andPostDataforForumAction::Visibleposts (each once, ≤100 per call); updates, deletes and reactions on starters are applied.FORUM_UNREADScounts kept only while the ack id matches and the user is not a member.Composers::by_channel[forum], equivalent to the draft keyforum-post:{forum}), so the editor, attachments and draft persistence are Text chat 11/12's. Submit →ApiRequest::CreateForumPostor, with files,UploadCommand::StartForumPost(multipart/presigned payloads from the composer'sattachment_payload); job inchat.uploads.forum_posts; failure puts the draft back and sets the toast "Couldn't create the post: {detail}"; success closes the composer, drops the draft, and opens the post (follow-upOpenThread).message_id == post id) with an optimistic change undone on failure and echo-safe (applyReactionsemantics), disabled when locked/archived; follow =JoinThread/LeaveThread; pin/unpin (EditThread { flags }, moderators, one pinned post per forum); edit tags (EditThread { applied_tags }, owner or moderator, ≤5, moderated tags only for moderators); copy post link{webapp}/channels/{guild}/{post}(buildChannelLink, verified inForumPostActions.tsx) with the toast "Post link copied".Tests
crates/fluxer-core/tests/chat_forums.rs: the 26 tests of the plan pluscopy_post_link(27), against the Task 36 fixtures (channel_forum.json,channel_media.json,thread_search.json,thread_search_not_ready.json,post_data.json,forum_post_created.json,archived_threads.json,forum_unreads.json,thread_create_forum_post.json).FLUXER_SCREENSHOT_TESTS=1 cargo xtask cigreen locally. No desktop tests apply.Deviations / outside the Files list
default_thread_rate_limit_per_user; the server enforces the forum's ownrate_limit_per_useron thread creation (ThreadCreationService.ts:407-421) and the original starts the cooldown withforum.rateLimitPerUser(ForumPostComposer.tsx,ThreadPanel.startCreateCooldown);default_thread_rate_limit_per_useris the new post's own slowmode. Built like the server/original; BYPASS_SLOWMODE skips it.MaxPinnedThreadsInForumError,ThreadModifyService.ts:145-148).chat/mod.rs(forums reducer gets the composer env,Threads,Composers,Uploads; re-exports),app.rs(forum follow-ups),chat/threads.rs(upserts threads fromForumPostCreated,UploadEvent::ForumPostDone, thread search results and archived pages, with membership frommembers, so cards open without a fetch — Task 40 may want the same for the thread browser),chat/composer.rs(attachment_payloadpub(crate); no typing announced in forum/media composers,typingEnabled={false}),notifications.rs(bodypub(crate) for card previews),read_state.rs(last_readpub(crate)),selectors/mod.rs(re-exports), README.UserAction::PickMemeinto a forum sets the "Saved media cannot start a post" error; the expressions reducer still tries its own send for it, so Task 46 should not route saved media to the forum composer.CopyPostLinkonly acts on posts (threads of a forum or media channel); the Task 38 stub test sends it for a text-channel thread and stays green.REQUIRE_TAGwith no tags (no post could pass the server); the tests use onlyHIDE_MEDIA_DOWNLOAD_OPTIONSfor it.Closes #324
🤖 Generated with Claude Code
Independent review: Text chat 39 (core-forums)
Reviewed
fad0d46d..origin/textchat-39-core-forums(commit90b90ea) cold.(1) Plan tests: all 26 tests named in Step 1 exist in
crates/fluxer-core/tests/chat_forums.rs(pluscopy_post_link). They assert the spec values: offset paging 25, 300 ms debounce withRelevance, 202 retry afterretry_afterand doubling up to 6 attempts then Failed, 403FEATURE_TEMPORARILY_DISABLEDfalls back toArchivedThreads { Public }withbeforepaging, post data each post once in chunks of 100, op 28 batches of 40 with 4 per 5 s, composer strings, the JSON body without files, thefiles[n]ids for the upload job, and the draft coming back on failure.(2) Interfaces:
ForumViewModel,SearchBoxModel,TagPill,PostSection,ListState::{Loading, Ready, Empty, EmptySearch, Failed, Indexing},ForumComposerModel,PostCardModel,PostPreview::{Text, Deleted, Loading},CardMedia { attachment, video },DefaultReactionModel { emoji, count, me, enabled },UnreadLabel::{Count(u32), Some}, andselectors::{forum_view, post_card}all exist as the Interfaces block writes them.UploadCommand::StartForumPostis used as Text chat 10 stubbed it.(3) Invariants: fluxer-core's Cargo.toml is unchanged and has no new deps. The core holds only
FileRefs. There are no new fixtures (it reuses existing server-shaped ones). The newtracinglines log ids and errors only, with no URLs or paths.retry_delayhandles NaN, negative and infiniteretry_after_s. There is nounwrapor indexing on server data.(4) Review Focus: item 1 (reactions converge) applies to the default reaction. The optimistic toggle followed by its echo (single or ADD_MANY) does not double-count (
apply_reactionignores the user's own change when it is already there), and a failure reverts it.Deviations checked against the source:
rate_limit_per_userinstead ofdefault_thread_rate_limit_per_user: correct. The server'sThreadCreationService.enforceCreateSlowmode(407-421) andForumPostComposer.tsx:106both use the forum'srateLimitPerUser.{webapp}/channels/{guild|@me}/{post}: matchesbuildChannelLinkinMessageLinkUtils.ts:42-45.Findings
chat/forums.rson_post_data):ApiResult::PostDatacarries no effect id, so a response is matched to its request by the ids it contains. If two chunks for the same forum are in flight (more than 100 visible posts) and one answer comes back with an emptythreadsmap, the code takes the oldest pending chunk. That can be the wrong one, and its posts are then markedSome(None), shown as "Original message was deleted" until the next READY. The cards show the wrong thing, but no user data is lost. Possible fixes: carry the ids or the effect id inApiResult::PostData, or don't mark posts deleted from an empty answer when the match is ambiguous.PickMemeinto a forum composer sets theSavedMediaerror, but the expressions reducer still sends the meme to the forum channel. Text chat 46 must not route saved media to the forum composer. This should be tracked as a follow-up.Local CI
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciwas run twice in the review worktree:fluxerapp lib passed (65), then the test binary crashed with SIGSEGV at teardown. This task does not touch that crate. 3 reruns ofcargo test -p fluxer --libpassed.Verdict: approve. No blocking findings and local CI is green.
Review of Text chat 39 (independent reviewer). Scope: fad0d46..origin/textchat-39-core-forums (
90b90ea).Checked:
Findings:
CI: I started FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in the review worktree. It was still compiling when I had to report, so I have no local result. The implementer did not confirm it either.
Verdict: no blocking code findings. Not approved yet, because CI is not confirmed green. Approve once cargo xtask ci is green.
Independent review: Text chat 39 (core forums), head
90b90eaReviewed
git diff fad0d46..origin/textchat-39-core-forumscold. Note: this PR shows as merged at90b90ea; the implementer's fix commitab4c919(CancelUpload) is not on the branch, so the first finding below applies to what was merged.Checks
crates/fluxer-core/tests/chat_forums.rs(pluscopy_post_link) and assert the spec's values: offset paging 25, 300 ms debounce withsort_by=relevance, 202 retry afterretry_after(2 s, then 4 s, failing after six attempts), 403 fallback toArchivedThreads { kind: Public }, PostData once per post in chunks of 100, op 28 frames of 40 with 4 per 5 s and a 15 s reply timeout, the composer's exact error strings, title cut to 100, tags ≤5,REQUIRE_TAG, moderated tags, the media-file rule, JSON vsUploadCommand::StartForumPost, one pinned post per forum, and the{webapp}/channels/{guild}/{post}link (matchesForumPostActions.tsxbuildChannelLink).selectors::{forum_view, post_card},ForumViewModel,ForumKind,SearchBoxModel,TagPill,PostSection,ListState::{Loading, Ready, Empty, EmptySearch, Failed, Indexing},ForumComposerModel,PostCardModel,PostPreview::{Text, Deleted, Loading},CardMedia,DefaultReactionModel,UnreadLabel::{Count, Some}exist with the plan's fields. Task 38's ports are consumed unchanged.FileRefs; the new log lines carry ids and errors, never URLs or paths; no new fixtures; flag edits usefrom_bits_retain, so unknown bits survive; no panic paths on server data (saturating counts,try_from_secs_f64, non-finiteretry_afterhandled).cargo xtask ciin the review worktree: green (all steps passed, exit 0).Findings
crates/fluxer-core/src/chat/forums.rs/uploads.rs:UserAction::CancelUploadof a forum-post job puts the draft back (uploads.rs) butForumsnever clearscomposer.pending == Upload(nonce). The composer stayssubmittingfor good: "Post" does nothing andCloseComposerrefuses. The title and tags are lost if the user opens a composer in another forum. The fix (ab4c919, with the testcancelled_forum_post_upload_reopens_composer) is local only and was not pushed. It needs a follow-up PR.crates/fluxer-core/src/chat/forums.rs:325withexpressions.rs::pick_meme:forums.rssets theSavedMediaerror onPickMemefor the forum's composer, butExpressions::pick_memestill records frecency and sendsSendRichMessage { favorite_meme_id }to the forum channel itself, which the server refuses. The same applies to an auto-sent GIF. Either the forum composer should never emit these actions (Task 46), or the core should skip the send forForum/Mediachannels.forum-post:{forum}. The module doc says so. It is the same behaviour, so this is not a finding.Verdict: approved (no blocking findings, local ci green). The CancelUpload fix should be pushed as a follow-up.