Text chat 38: core-channel-routing (#323) #440

Manually merged
charles merged 5 commits from textchat-38-core-channel-routing into textchat 2026-11-13 12:28:22 +00:00
Owner

Stacked on: origin/textchat-36-proto-channel-types

What

Task 38 (spec §18.1, §18.2 table, §18.4 first three bullets) in fluxer-core:

  • chat::channel_kinds::view_of -> ChannelView::{Messages, Forum, Media, Link, None}; Messages never fetches history for forum, media, link channels or categories.
  • selectors::sidebar::{row_icon, row_click, personal_notes}, with ChannelIcon (every icon of the §18.2 table, rules of ChannelUtils.tsx:109-189 and ChannelItem.tsx:415-428, 636-641: mature, then the @everyone lock, then plain; voice no-connect and the e2ee call as computeChannelE2EEStatus) and RowClick::{Select, JoinVoice, OpenLink, ToggleCategory}. dm_list leaves personal notes out (dm_row/dm_welcome still accept them).
  • Thread subscription (ThreadSubscriptions.ts): op 14 {threads: true, thread_member_lists} for the selected thread-enabled guild, once per session and selection, again after every READY; {threads: false, thread_member_lists: []} when the subscribed guild loses the threads key (not when the guild is left). threads.members_open feeds thread_member_lists (set by Task 44).
  • Opening any thread: OpenThread/OpenThreadFull of an unknown thread, SelectChannel of an unknown channel while a thread-enabled guild is selected, and JumpToMessage into an unknown channel send FetchChannel; threads.pending_open holds (id, ThreadOpenMode); ApiResult::Channel upserts it through Task 18's upsert and opens it via follow-up events (OpenThread, or SelectGuild + SelectChannel); the fetch's EffectFailed clears it.
  • Links: OpenExternal/ConfirmExternal/CancelExternal, chat.link_warning, the original's trust rules (built-in hosts, instance hosts, user patterns with *.domain, * = trust all). LocalChatSettings.{trusted_domains, hide_crosspost_nudge} added and persisted.
  • All Phase 5 ports (UserAction, ApiRequest, ApiResult, UploadCommand::StartForumPost(ForumPostUploadSpec), UploadEvent::ForumPostDone) and stub state/reducers in chat/{forums,announcements,thread_admin}.rs.

Tests

crates/fluxer-core/tests/chat_channel_kinds.rs: the 19 tests named in the plan. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally (Linux).

Deviations / for the reviewer

  • Outside the Files list, minimally: apps/fluxer/src/{runtime.rs,upload_rt.rs} (Task 21 had merged, so the new requests fail as CLIENT_NOT_WIRED and forum-post jobs report UploadEvent::Failed until Task 42), chat/settings.rs (the two new LocalChatSettings fields), chat/uploads.rs (ignores ForumPostDone until Task 39), app.rs (load the new local settings, collect thread follow-ups, pass &Chat to persist).
  • Extra ApiResult variants not named in the plan: ChannelDeleted, ThreadMemberAdded, ThreadMemberRemoved, ThreadMemberSettingsPatched. ApiRequest::ArchivedThreads.before is Option<ArchivedBefore::{Archived(Timestamp), Thread(Snowflake)}> (the user's own private list pages by id). CreateForumPost.request is boxed.
  • "Trust all external links" is the original's * entry in the trusted domains, not a separate setting; its settings toggle is UI work.
  • SelectChannel of an unknown id fetches only when the selected guild has threads (a broader rule fetched every unknown selection, which existing tests and DM flows hit). JumpToMessage into an unknown thread opens it in full view.
  • Existing tests adjusted: member_list.rs helper ignores thread-only frames; chat_ports.rs no longer treats OpenThread as a stub.
  • The new tests were written before the code but first run after it (they could not compile before the ports existed).

Closes #323

🤖 Generated with Claude Code

Stacked on: origin/textchat-36-proto-channel-types ## What Task 38 (spec §18.1, §18.2 table, §18.4 first three bullets) in `fluxer-core`: - `chat::channel_kinds::view_of` -> `ChannelView::{Messages, Forum, Media, Link, None}`; `Messages` never fetches history for forum, media, link channels or categories. - `selectors::sidebar::{row_icon, row_click, personal_notes}`, with `ChannelIcon` (every icon of the §18.2 table, rules of `ChannelUtils.tsx:109-189` and `ChannelItem.tsx:415-428, 636-641`: mature, then the `@everyone` lock, then plain; voice no-connect and the e2ee call as `computeChannelE2EEStatus`) and `RowClick::{Select, JoinVoice, OpenLink, ToggleCategory}`. `dm_list` leaves personal notes out (`dm_row`/`dm_welcome` still accept them). - Thread subscription (`ThreadSubscriptions.ts`): op 14 `{threads: true, thread_member_lists}` for the selected thread-enabled guild, once per session and selection, again after every READY; `{threads: false, thread_member_lists: []}` when the subscribed guild loses the `threads` key (not when the guild is left). `threads.members_open` feeds `thread_member_lists` (set by Task 44). - Opening any thread: `OpenThread`/`OpenThreadFull` of an unknown thread, `SelectChannel` of an unknown channel while a thread-enabled guild is selected, and `JumpToMessage` into an unknown channel send `FetchChannel`; `threads.pending_open` holds `(id, ThreadOpenMode)`; `ApiResult::Channel` upserts it through Task 18's upsert and opens it via follow-up events (`OpenThread`, or `SelectGuild` + `SelectChannel`); the fetch's `EffectFailed` clears it. - Links: `OpenExternal`/`ConfirmExternal`/`CancelExternal`, `chat.link_warning`, the original's trust rules (built-in hosts, instance hosts, user patterns with `*.domain`, `*` = trust all). `LocalChatSettings.{trusted_domains, hide_crosspost_nudge}` added and persisted. - All Phase 5 ports (UserAction, ApiRequest, ApiResult, `UploadCommand::StartForumPost(ForumPostUploadSpec)`, `UploadEvent::ForumPostDone`) and stub state/reducers in `chat/{forums,announcements,thread_admin}.rs`. ## Tests `crates/fluxer-core/tests/chat_channel_kinds.rs`: the 19 tests named in the plan. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally (Linux). ## Deviations / for the reviewer - Outside the Files list, minimally: `apps/fluxer/src/{runtime.rs,upload_rt.rs}` (Task 21 had merged, so the new requests fail as `CLIENT_NOT_WIRED` and forum-post jobs report `UploadEvent::Failed` until Task 42), `chat/settings.rs` (the two new `LocalChatSettings` fields), `chat/uploads.rs` (ignores `ForumPostDone` until Task 39), `app.rs` (load the new local settings, collect thread follow-ups, pass `&Chat` to persist). - Extra `ApiResult` variants not named in the plan: `ChannelDeleted`, `ThreadMemberAdded`, `ThreadMemberRemoved`, `ThreadMemberSettingsPatched`. `ApiRequest::ArchivedThreads.before` is `Option<ArchivedBefore::{Archived(Timestamp), Thread(Snowflake)}>` (the user's own private list pages by id). `CreateForumPost.request` is boxed. - "Trust all external links" is the original's `*` entry in the trusted domains, not a separate setting; its settings toggle is UI work. - `SelectChannel` of an unknown id fetches only when the selected guild has threads (a broader rule fetched every unknown selection, which existing tests and DM flows hit). `JumpToMessage` into an unknown thread opens it in full view. - Existing tests adjusted: `member_list.rs` helper ignores thread-only frames; `chat_ports.rs` no longer treats `OpenThread` as a stub. - The new tests were written before the code but first run after it (they could not compile before the ports existed). Closes #323 🤖 Generated with [Claude Code](https://claude.com/claude-code)
REST fixtures, each shaped from the fork's server source (ba98441b4):
- channel_forum/media/announcement/link/personal_notes.json:
  fluxer_api/src/api/channel/ChannelMappers.ts:96-172 (serializeThreadOnlyChannel,
  serializeGuildTextChannel, serializeGuildLinkChannel, serializeDMPersonalNotesChannel)
  plus services/thread/ThreadParentSettings.ts:180-222 (mapThreadParentFields: forum and
  media always carry flags, available_tags, default_tag_setting; media lacks
  default_forum_layout; text parents only the set default_*)
- thread_private/thread_announcement.json, forum_post_created.json:
  services/thread/ThreadMappers.ts:58-92 (invitable only on private threads; posts carry
  applied_tags and member_ids_preview) and ThreadCreationService.ts:292
  ({...mapThreadToResponse(view), message}), schema ForumRequestSchemas.ts:168-173
- thread_search.json, thread_search_not_ready.json: ForumRequestSchemas.ts:242-276,
  services/thread/ThreadForumService.ts:110-195 and
  packages/errors/src/domains/channel/SearchIndexNotReadyError.ts (202,
  {code, message, documents_indexed, retry_after}; FluxerError.toJSON)
- post_data.json: ForumRequestSchemas.ts:181-206, ThreadForumService.ts:60-100
- archived_threads.json: S/channel/ThreadRequestSchemas.ts:109-118
- followed_channel.json: S/channel/ChannelFollowSchemas.ts:12-15
- crosspost_source.json: S/message/CrosspostSourceSchemas.ts
- crosspost_message.json: services/message/CrosspostDeliveryService.ts:384-420 and the
  webhook author of fluxer_messages/src/shard_impl.rs:1456-1470
- purge_notes.json: api/channel/controllers/MessageController.ts:414-427

Gateway fixtures:
- forum_unreads.json: fluxer_gateway/src/guild/guild_request_forum_unreads.erl:207-285
- thread_member_list_update.json: guild_thread_subscriptions.erl:535-578
- thread_create_forum_post.json: services/thread/ThreadDispatch.ts:26-39 as forwarded by
  guild_thread_dispatch.erl:467-471 (public_payload drops member_ids_preview)
- lazy_request_threads.json: guild_unified_subscriptions.erl:140-165

Refs #321

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Channel parent fields (tags, default reaction, sort order, layout, tag
setting, defaults), channel flags, forum post create/search/post-data,
archived threads, thread edit and member settings, follow/crosspost,
purge result, lazy request thread fields, op 28 RequestForumUnreads and
the FORUM_UNREADS / THREAD_MEMBER_LIST_UPDATE dispatches (spec 18.3).

Refs #321

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Task 18's channel_of builds a Channel literal; Task 36 adds forum/thread
fields to Channel, so the merge needs them set (flags from the thread).

Refs #321

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	crates/fluxer-proto/src/lib.rs
#	crates/fluxer-proto/tests/models_roundtrip.rs
#	crates/fluxer-proto/tests/spec_contract.rs
Refs #323

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

Independent review: Text chat 38 (core-channel-routing), commit 5df8a83

Scope: git diff 2af31fa..origin/textchat-38-core-channel-routing.

Checked

  1. Planned tests: all 19 are in crates/fluxer-core/tests/chat_channel_kinds.rs and assert what the plan asks for. The icon table matches getIcon (ChannelUtils.tsx:109-189) exactly: mature, then locked, then plain; for voice the order is e2ee, then mature, then no-connect, then locked. Forum has no mature icon, and media, threads and notes have no variants. I also checked the op 14 frames against guild_unified_subscriptions.erl:140-165. The server reads each field only when it is present, so the separate threads-only frames do not clobber the member-list subscription.
  2. Interfaces: every name in the Task 38 block exists as written. These are the UserAction, ApiRequest and ApiResult variants, ForumAction, ThreadBrowserAction, ThreadEdit, ThreadNotifyLevel, ThreadOpenMode, ArchivedKind, UploadCommand::StartForumPost(ForumPostUploadSpec), UploadEvent::ForumPostDone, view_of and ChannelView, row_icon, row_click and RowClick, the 20 ChannelIcon variants, personal_notes, threads.pending_open, chat.link_warning, LocalChatSettings.{trusted_domains, hide_crosspost_nudge}. The additions are compatible with the plan. ArchivedThreads.before: Option<ArchivedBefore> is needed because the "mine" list pages by snowflake. The boxed CreateForumPost.request only means Tasks 39 and 42 must box it.
  3. Invariants: no new dependency and no Cargo or fixture changes. The core holds no I/O, file bytes or URLs of uploads. The new code has no unwrap, expect or indexing on server data. Logs carry ids only: the external-link code never logs the URL. --record is untouched.
  4. Review Focus: none of the items belongs to this task.
  5. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in the review worktree: green (exit 0), with chat_channel_kinds 19/19.

Findings

  • minor: trusted_domains and hide_crosspost_nudge only live in the in-memory LocalSettings. fluxer-platform/src/settings.rs writes no [chat] section at all. This gap is already in the base and tracked by #371. Until #371 is fixed, "Always trust" is lost on restart. When #371 is done, it should include these two fields.
  • minor: dm_list no longer lists personal notes. Until Task 43 draws the fixed "Personal notes" entry, the current UI no longer shows the notes channel. This matches the plan's note for Task 32.
  • minor: thread subscription differs from ThreadSubscriptions.ts. When you leave guild A, its sent state is forgotten. If A then loses its threads key while another guild is selected, no threads:false is sent, whereas the original's handleActiveGuildsChanged also only covers guilds still in sent, so the effect is about the same. Separately, a member-list clear that was due while the connection was down is dropped, not deferred. Neither is user-visible today.
  • minor: JumpToMessage into any unknown channel sends FetchChannel, even outside a thread-enabled guild. The result is ignored when the channel is not a thread, so the only cost is one extra request.

Verdict: approved. No blocking findings and local CI is green.

## Independent review: Text chat 38 (core-channel-routing), commit 5df8a83 Scope: `git diff 2af31fa..origin/textchat-38-core-channel-routing`. **Checked** 1. Planned tests: all 19 are in `crates/fluxer-core/tests/chat_channel_kinds.rs` and assert what the plan asks for. The icon table matches `getIcon` (`ChannelUtils.tsx:109-189`) exactly: mature, then locked, then plain; for voice the order is e2ee, then mature, then no-connect, then locked. Forum has no mature icon, and media, threads and notes have no variants. I also checked the op 14 frames against `guild_unified_subscriptions.erl:140-165`. The server reads each field only when it is present, so the separate threads-only frames do not clobber the member-list subscription. 2. Interfaces: every name in the Task 38 block exists as written. These are the `UserAction`, `ApiRequest` and `ApiResult` variants, `ForumAction`, `ThreadBrowserAction`, `ThreadEdit`, `ThreadNotifyLevel`, `ThreadOpenMode`, `ArchivedKind`, `UploadCommand::StartForumPost(ForumPostUploadSpec)`, `UploadEvent::ForumPostDone`, `view_of` and `ChannelView`, `row_icon`, `row_click` and `RowClick`, the 20 `ChannelIcon` variants, `personal_notes`, `threads.pending_open`, `chat.link_warning`, `LocalChatSettings.{trusted_domains, hide_crosspost_nudge}`. The additions are compatible with the plan. `ArchivedThreads.before: Option<ArchivedBefore>` is needed because the "mine" list pages by snowflake. The boxed `CreateForumPost.request` only means Tasks 39 and 42 must box it. 3. Invariants: no new dependency and no Cargo or fixture changes. The core holds no I/O, file bytes or URLs of uploads. The new code has no `unwrap`, `expect` or indexing on server data. Logs carry ids only: the external-link code never logs the URL. `--record` is untouched. 4. Review Focus: none of the items belongs to this task. 5. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in the review worktree: **green** (exit 0), with `chat_channel_kinds` 19/19. **Findings** - *minor*: `trusted_domains` and `hide_crosspost_nudge` only live in the in-memory `LocalSettings`. `fluxer-platform/src/settings.rs` writes no `[chat]` section at all. This gap is already in the base and tracked by #371. Until #371 is fixed, "Always trust" is lost on restart. When #371 is done, it should include these two fields. - *minor*: `dm_list` no longer lists personal notes. Until Task 43 draws the fixed "Personal notes" entry, the current UI no longer shows the notes channel. This matches the plan's note for Task 32. - *minor*: thread subscription differs from `ThreadSubscriptions.ts`. When you leave guild A, its `sent` state is forgotten. If A then loses its `threads` key while another guild is selected, no `threads:false` is sent, whereas the original's `handleActiveGuildsChanged` also only covers guilds still in `sent`, so the effect is about the same. Separately, a member-list clear that was due while the connection was down is dropped, not deferred. Neither is user-visible today. - *minor*: `JumpToMessage` into any unknown channel sends `FetchChannel`, even outside a thread-enabled guild. The result is ignored when the channel is not a thread, so the only cost is one extra request. **Verdict: approved.** No blocking findings and local CI is green.
Author
Owner

Independent review: Text chat 38 (core-channel-routing), after the merge of textchat 9cf9a68

What I reviewed: git diff 9cf9a68..af07278, the implementer's local merge of origin/textchat into this branch. At review time the remote branch was still at e957923, which does not contain 9cf9a68, so the diff against the remote head would have reverted 79 textchat commits. This verdict covers af07278 only.

Tests (plan step 1): all 19 named tests are in crates/fluxer-core/tests/chat_channel_kinds.rs and assert what the plan says:

  • the view of every channel type, plus the server-shaped fixtures
  • the row_icon table for every type, plain, mature and locked, plus no-CONNECT and the encrypted call
  • row_click, personal notes and dm_list
  • the op 14 threads: true / false subscription, including re-sending after READY and the disabled guild
  • FetchChannel, then the thread opens in the panel or the full view, or from a jump; a 404 clears pending_open
  • trusted, untrusted, *. and * links, and the persisted trusted domains
  • old settings files still load
  • the Phase 5 stubs emit nothing

Interfaces: every variant and name in the Interfaces block exists: the UserAction, ApiRequest, ApiResult, UploadCommand::StartForumPost(ForumPostUploadSpec) and UploadEvent::ForumPostDone variants, plus view_of, ChannelIcon, RowClick, personal_notes, pending_open: Option<(Snowflake, ThreadOpenMode)>, link_warning, trusted_domains and hide_crosspost_nudge. Two small differences, both compatible with what the plan says:

  • CreateForumPost.request is Box<StartForumPost>.
  • ArchivedThreads.before is Option<ArchivedBefore>.

Merge resolution (app.rs, chat/state.rs, effect.rs, event.rs, messages.rs, persist.rs): correct.

  • Startup now calls load_local and then video.load_volume.
  • clear_account keeps the chat settings, the links, hide_nudge and the media volume.
  • ForumPostDone is folded into the no-op arms next to Media.
  • The runtime and upload_rt fail the new requests and forum-post jobs cleanly until Task 42, with no todo!().

Invariants: no new dependency in fluxer-core, and no iced, wgpu, winit, reqwest or tungstenite. No file bytes or upload URLs. Links that are not web links (javascript:, file:) are neither opened nor warned about, and no panic paths on server data. No secrets.

CI: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci on af07278: all steps passed (exit 0).

Findings

  • minor (process): PR #440's head is still e957923, which conflicts with textchat. Push af07278 (a fast-forward of the branch) before merge. This approval applies to af07278.
  • minor: crates/fluxer-core/tests/member_list.rs: lazy_requests now has two doc lines; the old first line was left above the new one.
  • minor (already deferred by the implementer): chat settings are not persisted (#371). dm_list hides personal notes, and they only come back as a fixed entry with Task 43.

Verdict: approve (no blocking findings; local CI green on af07278).

## Independent review: Text chat 38 (core-channel-routing), after the merge of textchat 9cf9a68 **What I reviewed:** `git diff 9cf9a68..af07278`, the implementer's local merge of `origin/textchat` into this branch. At review time the remote branch was still at `e957923`, which does not contain `9cf9a68`, so the diff against the remote head would have reverted 79 textchat commits. This verdict covers `af07278` only. **Tests (plan step 1):** all 19 named tests are in `crates/fluxer-core/tests/chat_channel_kinds.rs` and assert what the plan says: - the view of every channel type, plus the server-shaped fixtures - the `row_icon` table for every type, plain, mature and locked, plus no-CONNECT and the encrypted call - `row_click`, personal notes and `dm_list` - the op 14 `threads: true` / `false` subscription, including re-sending after READY and the disabled guild - `FetchChannel`, then the thread opens in the panel or the full view, or from a jump; a 404 clears `pending_open` - trusted, untrusted, `*.` and `*` links, and the persisted trusted domains - old settings files still load - the Phase 5 stubs emit nothing **Interfaces:** every variant and name in the Interfaces block exists: the `UserAction`, `ApiRequest`, `ApiResult`, `UploadCommand::StartForumPost(ForumPostUploadSpec)` and `UploadEvent::ForumPostDone` variants, plus `view_of`, `ChannelIcon`, `RowClick`, `personal_notes`, `pending_open: Option<(Snowflake, ThreadOpenMode)>`, `link_warning`, `trusted_domains` and `hide_crosspost_nudge`. Two small differences, both compatible with what the plan says: - `CreateForumPost.request` is `Box<StartForumPost>`. - `ArchivedThreads.before` is `Option<ArchivedBefore>`. **Merge resolution** (app.rs, chat/state.rs, effect.rs, event.rs, messages.rs, persist.rs): correct. - Startup now calls `load_local` and then `video.load_volume`. - `clear_account` keeps the chat settings, the links, `hide_nudge` and the media volume. - `ForumPostDone` is folded into the no-op arms next to `Media`. - The runtime and `upload_rt` fail the new requests and forum-post jobs cleanly until Task 42, with no `todo!()`. **Invariants:** no new dependency in fluxer-core, and no iced, wgpu, winit, reqwest or tungstenite. No file bytes or upload URLs. Links that are not web links (`javascript:`, `file:`) are neither opened nor warned about, and no panic paths on server data. No secrets. **CI:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` on `af07278`: all steps passed (exit 0). ### Findings - **minor (process):** PR #440's head is still `e957923`, which conflicts with textchat. Push `af07278` (a fast-forward of the branch) before merge. This approval applies to `af07278`. - **minor:** `crates/fluxer-core/tests/member_list.rs`: `lazy_requests` now has two doc lines; the old first line was left above the new one. - **minor (already deferred by the implementer):** chat settings are not persisted (#371). `dm_list` hides personal notes, and they only come back as a fixed entry with Task 43. **Verdict: approve** (no blocking findings; local CI green on `af07278`).
# Conflicts:
#	crates/fluxer-core/src/app.rs
#	crates/fluxer-core/src/chat/state.rs
#	crates/fluxer-core/src/effect.rs
#	crates/fluxer-core/src/event.rs
#	crates/fluxer-core/src/messages.rs
#	crates/fluxer-core/src/persist.rs
charles manually merged commit ba7cf9d2ec into textchat 2026-11-13 12:28:17 +00:00
Sign in to join this conversation.
No description provided.