Text chat 37: fluxer-api channel-type endpoints (#322) #429

Manually merged
charles merged 10 commits from textchat-37-api-channel-types into textchat 2026-11-13 10:57:58 +00:00
Owner

What

Task 37 of the Text chat plan: the fluxer-api channel-type endpoints of spec §18.3, built against Task 36's proto types.

  • forums.rs (new): create_forum_post (JSON, also the presigned path with upload_filename in message.attachments), create_forum_post_with_files (multipart payload_json + files[n], message.attachments[i].id = i, not observed), search_threads (HTTP 202 -> ThreadSearchResponse::NotReady), post_data (chunks of 100, merged; no request for an empty list).
  • announcements.rs (new): crosspost, crosspost_source, follow_channel.
  • threads.rs: archived_public_threads, archived_private_threads (timestamp before), my_archived_private_threads(channel, before: Option<Snowflake>, limit) (snowflake before, limit clamped 2-100), edit_thread, add_thread_member, remove_thread_member, patch_thread_member_settings.
  • dms.rs: get_channel, delete_channel. messages.rs: purge_personal_notes.
  • uploads.rs: the multipart builder moved into a shared post_multipart + attachments_for; send_message_with_files behaves exactly as before (its tests unchanged and passing).
  • README updated.

Routes checked against the fork: ThreadController.ts, ForumController.ts, ThreadMemberSettingsController.ts, ChannelFollowController.ts, MessageController.ts:414-560, ChannelController.ts:209; the multipart forum body against ThreadController.ts:113-131 and feat/forum/commands/ForumCommands.ts:58-91.

Tests

crates/fluxer-api/tests/channel_types.rs (wiremock, Task 36 fixtures): every test the plan names, plus create_forum_post_presigned_sends_upload_filename_in_json, delete_channel_path and thread_member_settings_200_with_member_is_ok. Seen failing (no methods) before the implementation, passing after. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally.

Deviations / choices

  • The plan does not give return types for the thread member calls: add_thread_member, remove_thread_member and patch_thread_member_settings return Result<()> (settings answers 200 with the member or 204; the change also arrives as THREAD_MEMBER_UPDATE).
  • delete_channel sends the same DELETE /channels/{id} as the existing close_channel (no sudo body; the server only needs one with delete_messages on a group DM).

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

Closes #322

🤖 Generated with Claude Code

## What Task 37 of the Text chat plan: the `fluxer-api` channel-type endpoints of spec §18.3, built against Task 36's proto types. - `forums.rs` (new): `create_forum_post` (JSON, also the presigned path with `upload_filename` in `message.attachments`), `create_forum_post_with_files` (multipart `payload_json` + `files[n]`, `message.attachments[i].id = i`, not observed), `search_threads` (HTTP 202 -> `ThreadSearchResponse::NotReady`), `post_data` (chunks of 100, merged; no request for an empty list). - `announcements.rs` (new): `crosspost`, `crosspost_source`, `follow_channel`. - `threads.rs`: `archived_public_threads`, `archived_private_threads` (timestamp `before`), `my_archived_private_threads(channel, before: Option<Snowflake>, limit)` (snowflake `before`, limit clamped 2-100), `edit_thread`, `add_thread_member`, `remove_thread_member`, `patch_thread_member_settings`. - `dms.rs`: `get_channel`, `delete_channel`. `messages.rs`: `purge_personal_notes`. - `uploads.rs`: the multipart builder moved into a shared `post_multipart` + `attachments_for`; `send_message_with_files` behaves exactly as before (its tests unchanged and passing). - README updated. Routes checked against the fork: `ThreadController.ts`, `ForumController.ts`, `ThreadMemberSettingsController.ts`, `ChannelFollowController.ts`, `MessageController.ts:414-560`, `ChannelController.ts:209`; the multipart forum body against `ThreadController.ts:113-131` and `feat/forum/commands/ForumCommands.ts:58-91`. ## Tests `crates/fluxer-api/tests/channel_types.rs` (wiremock, Task 36 fixtures): every test the plan names, plus `create_forum_post_presigned_sends_upload_filename_in_json`, `delete_channel_path` and `thread_member_settings_200_with_member_is_ok`. Seen failing (no methods) before the implementation, passing after. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. ## Deviations / choices - The plan does not give return types for the thread member calls: `add_thread_member`, `remove_thread_member` and `patch_thread_member_settings` return `Result<()>` (settings answers 200 with the member or 204; the change also arrives as `THREAD_MEMBER_UPDATE`). - `delete_channel` sends the same `DELETE /channels/{id}` as the existing `close_channel` (no sudo body; the server only needs one with `delete_messages` on a group DM). Stacked on: textchat-36-proto-channel-types Closes #322 🤖 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 #322

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

Independent review: Text chat 37 (api-channel-types), commit 8bf7e40

Reviewed only git diff 6bca3ed..origin/textchat-37-api-channel-types.

1. Plan tests: all 12 named tests exist in crates/fluxer-api/tests/channel_types.rs and assert what the plan says. That covers:

  • the JSON and multipart bodies (payload_json, then files[0], files[1], with attachments[i].id = "i")
  • the 202 answer as NotReady { retry_after_s: 2.0 }
  • the 100 + 50 split for post-data, with no request for an empty list
  • the timestamp before on the archived lists, and the snowflake before on the user's own list (limit clamped 250 -> 100)
  • the PATCH body, the member paths, crosspost and follow, and purge
  • channel_threads in X-Fluxer-Features on 8 routes

There are 3 extra tests: the presigned upload_filename, the delete path, and a settings call answered 200 with a body.

2. Interfaces: every signature in the Interfaces block exists as written. The open choices are reasonable: the thread-member calls return Result<()>, and delete_channel delegates to close_channel.

3. Invariants: only fluxer-api changed, with no new dependencies and no changes to core, UI or fixtures. The only panics are in tests. The upload still goes through unobserved(). No secrets or URLs are added: the upload_filename in a test is a mock key. I checked the routes and verbs against the fork's controllers (ThreadController, ForumController, ChannelFollowController, MessageController:415/499/529, ThreadMemberSettingsController) and they match.

4. Review Focus #4 (uploads): post_multipart/attachments_for is a behaviour-preserving extraction. send_message_with_files builds the same form, with the same timeout, Retry::Never and progress counter. The forum post reuses the same builder.

5. Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh review worktree: all steps passed (exit 0). channel_types: 15 passed.

Findings: none (no blocking, no minor).

Verdict: APPROVED

## Independent review: Text chat 37 (api-channel-types), commit 8bf7e40 Reviewed only `git diff 6bca3ed..origin/textchat-37-api-channel-types`. **1. Plan tests:** all 12 named tests exist in `crates/fluxer-api/tests/channel_types.rs` and assert what the plan says. That covers: - the JSON and multipart bodies (`payload_json`, then `files[0]`, `files[1]`, with `attachments[i].id = "i"`) - the 202 answer as `NotReady { retry_after_s: 2.0 }` - the 100 + 50 split for post-data, with no request for an empty list - the timestamp `before` on the archived lists, and the snowflake `before` on the user's own list (limit clamped 250 -> 100) - the PATCH body, the member paths, crosspost and follow, and purge - `channel_threads` in `X-Fluxer-Features` on 8 routes There are 3 extra tests: the presigned `upload_filename`, the delete path, and a settings call answered 200 with a body. **2. Interfaces:** every signature in the Interfaces block exists as written. The open choices are reasonable: the thread-member calls return `Result<()>`, and `delete_channel` delegates to `close_channel`. **3. Invariants:** only `fluxer-api` changed, with no new dependencies and no changes to core, UI or fixtures. The only panics are in tests. The upload still goes through `unobserved()`. No secrets or URLs are added: the `upload_filename` in a test is a mock key. I checked the routes and verbs against the fork's controllers (ThreadController, ForumController, ChannelFollowController, MessageController:415/499/529, ThreadMemberSettingsController) and they match. **4. Review Focus #4 (uploads):** `post_multipart`/`attachments_for` is a behaviour-preserving extraction. `send_message_with_files` builds the same form, with the same timeout, `Retry::Never` and progress counter. The forum post reuses the same builder. **5. Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh review worktree: **all steps passed (exit 0)**. channel_types: 15 passed. Findings: none (no blocking, no minor). **Verdict: APPROVED**
charles manually merged commit 9cf9a6825c into textchat 2026-11-13 10:57:52 +00:00
Sign in to join this conversation.
No description provided.