Text chat 41: fluxer-devserver channel types (#326) #430

Manually merged
charles merged 0 commits from textchat-41-devserver-channel-types into textchat 2026-11-13 10:57:59 +00:00
Owner

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

What this builds (Task 41, spec §18.6)

The textchat devserver scenario gains every channel type and the endpoints and gateway frames around them:

  • Fixtures (fixtures/textchat/{forum_posts,media_posts,channel_types}.json, appended to textchat_ready.json): forum #ideas (guidelines in topic, REQUIRE_TAG, 4 tags with "Announcement" moderated, 👍 default reaction) with 30 posts: 1 pinned, 3 followed (READY acks their 3rd message, so 3 unread each), 19 other active, 7 archived; starters with and without pictures. Media #gallery (HIDE_MEDIA_DOWNLOAD_OPTIONS, 8 picture/clip posts). Announcement #releases (one published, one unpublished message of the user's) and its thread "1.4 feedback". Link channel "Docs" (url on an untrusted host). Voice channel "Hangout" with 3 messages. Private thread "Moderators only". Personal notes (type 999, id = the user's) with 4 messages. A generator script made the post files; every thread/message is shaped like the server's (sources cited in the fixtures commit).
  • READY lists only the active threads the user joined; "Old bikeshed" (archived, not joined) moved out of READY.
  • Gateway: op 14 threads: true → THREAD_LIST_SYNC of every active thread of a thread-enabled guild (the gateway's store holds active threads only) plus the user's memberships; op 14 thread_member_lists → THREAD_MEMBER_LIST_UPDATE per thread (≤10); op 28 → FORUM_UNREADS (missing without an ack, else the count after it, capped at 25; posts of other channels left out), as guild_request_forum_unreads.erl.
  • REST (forums.rs, thread search in search.rs): GET /channels/{id}; forum/media posts via POST /channels/{forum}/threads (JSON and multipart; ForumTagRules.ts validation: UNKNOWN_FORUM_TAG, moderated tags, FORUM_TAG_REQUIRED, ≤5 tags, title length, empty starter; starter id = post id; THREAD_CREATE with newly_created then MESSAGE_CREATE; a refused starter discards the post); thread search (202 SEARCH_INDEX_NOT_READY on the first call per channel, then name/tag/tag_setting/archived/sort/limit/offset with first_messages and member_ids_preview); post-data; the three archived lists; PATCH /channels/{thread} (+THREAD_UPDATE, one pinned post per forum) and DELETE (+THREAD_DELETE); thread members list/get/add/remove (+THREAD_MEMBERS_UPDATE) and @me/settings (+THREAD_MEMBER_UPDATE); crosspost (+MESSAGE_UPDATE with CROSSPOSTED, copies to followers) and crosspost-source; followers (+CHANNEL_FOLLOW_ADD notice "Forked #releases" in the target); notes purge (own notes only, MESSAGE_DELETE_BULK). Messages of forum/media/link/category channels are INVALID_CHANNEL_TYPE.
  • Gating: every thread/forum route (new and existing) answers the API's 404 NOT_FOUND without X-Fluxer-Features: channel_threads or on a DM (ChannelThreadsRouteGuard); threads, forums and media channels are UNKNOWN_CHANNEL to such a client via GET|PATCH|DELETE /channels/{id}. Scenario flag thread_search = false (new textchat_no_thread_search.toml) makes search a 404.

Testing

  • crates/fluxer-devserver/tests/channel_types.rs: the 17 tests of the plan, written first and seen failing, all passing.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally (base green before any change, at the merge commit).

Deviations / notes for the reviewer

  • "the forum and media channels ... appear only via THREAD_LIST_SYNC" is read as their posts: the forum and media channels themselves are READY guild channels, as the gateway sends them to a capable session (guild_thread_view.erl:125 hides them only for non-viewers).
  • 30 posts = 1 pinned + 3 joined + 19 other active + 7 archived (the plan's 1/3/20/7 sums to 31).
  • Outside the Files list: fixtures/scenarios/textchat_no_thread_search.toml (needed for thread_search_disabled_flag); tests/textchat.rs now sends the feature header like fluxer-api and expects the new READY thread set; Moderators gain MANAGE_WEBHOOKS in textchat_ready.json so following works.
  • THREAD_MEMBER_LIST_UPDATE presences are online for the user and offline for others (the devserver's presences are private to member_list.rs, which this task does not touch).
  • GET /guilds/{id}/threads/active is bot-only on the real server; the devserver keeps serving it (now behind the feature header) since existing tests use it.

Closes #326

🤖 Generated with Claude Code

Stacked on: textchat-36-proto-channel-types ## What this builds (Task 41, spec §18.6) The `textchat` devserver scenario gains every channel type and the endpoints and gateway frames around them: - **Fixtures** (`fixtures/textchat/{forum_posts,media_posts,channel_types}.json`, appended to `textchat_ready.json`): forum `#ideas` (guidelines in `topic`, REQUIRE_TAG, 4 tags with "Announcement" moderated, 👍 default reaction) with 30 posts: 1 pinned, 3 followed (READY acks their 3rd message, so 3 unread each), 19 other active, 7 archived; starters with and without pictures. Media `#gallery` (HIDE_MEDIA_DOWNLOAD_OPTIONS, 8 picture/clip posts). Announcement `#releases` (one published, one unpublished message of the user's) and its thread "1.4 feedback". Link channel "Docs" (`url` on an untrusted host). Voice channel "Hangout" with 3 messages. Private thread "Moderators only". Personal notes (type 999, id = the user's) with 4 messages. A generator script made the post files; every thread/message is shaped like the server's (sources cited in the fixtures commit). - **READY** lists only the active threads the user joined; "Old bikeshed" (archived, not joined) moved out of READY. - **Gateway**: op 14 `threads: true` → `THREAD_LIST_SYNC` of every active thread of a thread-enabled guild (the gateway's store holds active threads only) plus the user's memberships; op 14 `thread_member_lists` → `THREAD_MEMBER_LIST_UPDATE` per thread (≤10); op 28 → `FORUM_UNREADS` (`missing` without an ack, else the count after it, capped at 25; posts of other channels left out), as `guild_request_forum_unreads.erl`. - **REST** (`forums.rs`, thread search in `search.rs`): `GET /channels/{id}`; forum/media posts via `POST /channels/{forum}/threads` (JSON and multipart; `ForumTagRules.ts` validation: UNKNOWN_FORUM_TAG, moderated tags, FORUM_TAG_REQUIRED, ≤5 tags, title length, empty starter; starter id = post id; `THREAD_CREATE` with `newly_created` then `MESSAGE_CREATE`; a refused starter discards the post); thread search (202 `SEARCH_INDEX_NOT_READY` on the first call per channel, then name/tag/tag_setting/archived/sort/limit/offset with `first_messages` and `member_ids_preview`); `post-data`; the three archived lists; `PATCH /channels/{thread}` (+`THREAD_UPDATE`, one pinned post per forum) and `DELETE` (+`THREAD_DELETE`); thread members list/get/add/remove (+`THREAD_MEMBERS_UPDATE`) and `@me/settings` (+`THREAD_MEMBER_UPDATE`); crosspost (+`MESSAGE_UPDATE` with CROSSPOSTED, copies to followers) and crosspost-source; followers (+`CHANNEL_FOLLOW_ADD` notice "Forked #releases" in the target); notes purge (own notes only, `MESSAGE_DELETE_BULK`). Messages of forum/media/link/category channels are `INVALID_CHANNEL_TYPE`. - **Gating**: every thread/forum route (new and existing) answers the API's 404 `NOT_FOUND` without `X-Fluxer-Features: channel_threads` or on a DM (`ChannelThreadsRouteGuard`); threads, forums and media channels are `UNKNOWN_CHANNEL` to such a client via `GET|PATCH|DELETE /channels/{id}`. Scenario flag `thread_search = false` (new `textchat_no_thread_search.toml`) makes search a 404. ## Testing - `crates/fluxer-devserver/tests/channel_types.rs`: the 17 tests of the plan, written first and seen failing, all passing. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally (base green before any change, at the merge commit). ## Deviations / notes for the reviewer - "the forum and media channels ... appear only via THREAD_LIST_SYNC" is read as their *posts*: the forum and media channels themselves are READY guild channels, as the gateway sends them to a capable session (`guild_thread_view.erl:125` hides them only for non-viewers). - 30 posts = 1 pinned + 3 joined + 19 other active + 7 archived (the plan's 1/3/20/7 sums to 31). - Outside the Files list: `fixtures/scenarios/textchat_no_thread_search.toml` (needed for `thread_search_disabled_flag`); `tests/textchat.rs` now sends the feature header like `fluxer-api` and expects the new READY thread set; Moderators gain MANAGE_WEBHOOKS in `textchat_ready.json` so following works. - `THREAD_MEMBER_LIST_UPDATE` presences are online for the user and offline for others (the devserver's presences are private to `member_list.rs`, which this task does not touch). - `GET /guilds/{id}/threads/active` is bot-only on the real server; the devserver keeps serving it (now behind the feature header) since existing tests use it. Closes #326 🤖 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
The forum #ideas (30 posts), the media channel #gallery (8 posts), the
announcement channel #releases and its thread, the link channel "Docs", the
voice channel "Hangout", the private thread "Moderators only" and the
personal notes, appended to textchat_ready.json; READY's `threads` keeps
only the active threads the user joined, "Old bikeshed" moves to
textchat/channel_types.json. Moderators gain MANAGE_WEBHOOKS (follow).

Shapes follow the server source (fork ba98441b4):
- threads: mapThreadToResponse, api/channel/services/thread/ThreadMappers.ts,
  as in THREAD_CREATE (ThreadDispatch.ts:26-39); private thread metadata
  with `invitable` (S/channel/ThreadSchemas.ts:20-29)
- forum and media parents: ThreadParentSettings.ts:180-222 (flags,
  available_tags, default_* fields); link channel `url`
- forum/media fields and flags: C/ThreadConstants.ts:44-48, 94-148
- personal notes: id equal to the user's (isPersonalNotesChannelId,
  MessageDeleteService.ts:247), type 999
- messages: MessageResponseSchema as in textchat/history.json; the
  published message carries CROSSPOSTED (C/ChannelConstants.ts:117)

Refs #326

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The textchat scenario serves the channel types of spec §18.6: READY lists
only the joined active threads; op 14 `threads: true` answers with a
THREAD_LIST_SYNC of the guild and `thread_member_lists` with
THREAD_MEMBER_LIST_UPDATE; op 28 answers FORUM_UNREADS. REST: GET
/channels/{id}, forum and media posts (JSON and multipart, tag rules,
starter id = post id, THREAD_CREATE then MESSAGE_CREATE), thread search
(202 on the first call per channel, then filtered, sorted and paged, with
first_messages), post-data, the archived lists, PATCH/DELETE of threads,
thread members and member settings, crosspost and crosspost-source,
followers (CHANNEL_FOLLOW_ADD notice) and the personal notes purge. Thread
and forum routes are a 404 without X-Fluxer-Features: channel_threads;
`thread_search = false` turns the search off.

Refs #326

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

Independent review: Text chat 41 (devserver channel types)

Reviewed dafdbd5..origin/textchat-41-devserver-channel-types (0fae995) cold.

Checks

  1. Plan tests: all 17 named tests exist in crates/fluxer-devserver/tests/channel_types.rs and assert the spec §18.6 values: 30 posts (1 pinned, 3 joined, 7 archived), 4 tags with 1 moderated, REQUIRE_TAG, HIDE_MEDIA_DOWNLOAD_OPTIONS, 8 media posts, the 202 on the first search then 200, starter id = post id, THREAD_CREATE (newly_created) before MESSAGE_CREATE, CROSSPOSTED, CHANNEL_FOLLOW_ADD, purge only on own notes, the 404s without X-Fluxer-Features: channel_threads, and thread_search = false.
  2. Interfaces: every §18.3 route, op 14 threads/thread_member_lists and op 28 are served. The devserver is consumed through the existing scenario and proto types (no new public API). fluxer-api already sends channel_threads, so the new 404 gating does not break the runtime.
  3. Invariants: the diff touches only fluxer-devserver and fixtures. No core, UI or emoji change. Fixture attachment URLs are plain unsigned /media/attachments/... paths, and there are no tokens or file paths. FORUM_UNREADS shape (missing: true with no count, cap 25, batch 40) matches guild_request_forum_unreads.erl. The fixture commit names the server files it was shaped from.
  4. Review Focus: none of the seven items belongs to Task 41.
  5. cargo xtask ci in the review worktree: green (all steps passed). Also ran FLUXER_SCREENSHOT_TESTS=1 cargo test -p fluxer-ui --test screenshots -- --include-ignored against the changed READY: 51/51 pass.

Findings

  • minor: fixtures/scenarios/textchat.toml header says "Old bikeshed" (archived) arrives with op 14's THREAD_LIST_SYNC "or the REST lists". thread_list_sync filters archived threads out, as the test asserts, so in practice it comes only from the REST archived list. The comment wording is misleading.
  • minor (accepted deviation): spec §18.6 says "1 pinned, 3 joined, 20 active, 7 archived", which adds up to 31. The fixture uses 19 other active posts so the total stays at the spec's 30. This is reasonable. Task 34/35 acceptance should use the same count.
  • minor (accepted deviation): the plan's Interfaces line says forum/media channels appear "only via THREAD_LIST_SYNC". The branch keeps the forum and media channels in READY's guild channels and sends their posts via sync. That matches how the server treats a capable session, so the reading is correct. Worth noting for Task 42.
  • minor: THREAD_MEMBER_LIST_UPDATE presences are hardcoded: the signed-in user is online and everyone else offline, ignoring scenario presences. This is fine for a devserver, but UI screenshots of the member list will show ada offline.
  • minor: GET /guilds/{id}/threads/active is bot-only on the real server but is still served here (behind the header) for existing tests. This is a known divergence and should not be relied on by the client.

Verdict: APPROVED. No blocking findings; CI green locally.

## Independent review: Text chat 41 (devserver channel types) Reviewed `dafdbd5..origin/textchat-41-devserver-channel-types` (0fae995) cold. **Checks** 1. Plan tests: all 17 named tests exist in `crates/fluxer-devserver/tests/channel_types.rs` and assert the spec §18.6 values: 30 posts (1 pinned, 3 joined, 7 archived), 4 tags with 1 moderated, REQUIRE_TAG, HIDE_MEDIA_DOWNLOAD_OPTIONS, 8 media posts, the 202 on the first search then 200, starter id = post id, THREAD_CREATE (`newly_created`) before MESSAGE_CREATE, CROSSPOSTED, CHANNEL_FOLLOW_ADD, purge only on own notes, the 404s without `X-Fluxer-Features: channel_threads`, and `thread_search = false`. 2. Interfaces: every §18.3 route, op 14 `threads`/`thread_member_lists` and op 28 are served. The devserver is consumed through the existing scenario and proto types (no new public API). `fluxer-api` already sends `channel_threads`, so the new 404 gating does not break the runtime. 3. Invariants: the diff touches only `fluxer-devserver` and fixtures. No core, UI or emoji change. Fixture attachment URLs are plain unsigned `/media/attachments/...` paths, and there are no tokens or file paths. FORUM_UNREADS shape (`missing: true` with no count, cap 25, batch 40) matches `guild_request_forum_unreads.erl`. The fixture commit names the server files it was shaped from. 4. Review Focus: none of the seven items belongs to Task 41. 5. `cargo xtask ci` in the review worktree: **green** (all steps passed). Also ran `FLUXER_SCREENSHOT_TESTS=1 cargo test -p fluxer-ui --test screenshots -- --include-ignored` against the changed READY: 51/51 pass. **Findings** - minor: `fixtures/scenarios/textchat.toml` header says "Old bikeshed" (archived) arrives with op 14's `THREAD_LIST_SYNC` "or the REST lists". `thread_list_sync` filters archived threads out, as the test asserts, so in practice it comes only from the REST archived list. The comment wording is misleading. - minor (accepted deviation): spec §18.6 says "1 pinned, 3 joined, 20 active, 7 archived", which adds up to 31. The fixture uses 19 other active posts so the total stays at the spec's 30. This is reasonable. Task 34/35 acceptance should use the same count. - minor (accepted deviation): the plan's Interfaces line says forum/media channels appear "only via THREAD_LIST_SYNC". The branch keeps the forum and media channels in READY's guild channels and sends their posts via sync. That matches how the server treats a capable session, so the reading is correct. Worth noting for Task 42. - minor: THREAD_MEMBER_LIST_UPDATE presences are hardcoded: the signed-in user is online and everyone else offline, ignoring scenario presences. This is fine for a devserver, but UI screenshots of the member list will show ada offline. - minor: `GET /guilds/{id}/threads/active` is bot-only on the real server but is still served here (behind the header) for existing tests. This is a known divergence and should not be relied on by the client. **Verdict: APPROVED.** No blocking findings; CI green locally.
charles manually merged commit 9cf9a6825c into textchat 2026-11-13 10:57:59 +00:00
Sign in to join this conversation.
No description provided.