Text chat 6: api-chat-endpoints (#256) #300

Manually merged
charles merged 7 commits from textchat-6-api-chat-endpoints into textchat 2026-11-12 16:52:55 +00:00
Owner

What this builds

Text chat Task 6: the chat endpoints of spec §3.1 on ApiClient (crates/fluxer-api/src/{reactions,pins,search,saved,dms,expressions,threads,settings}.rs):

  • Reactions: add_reaction, remove_own_reaction, remove_user_reaction, remove_emoji_reactions, remove_all_reactions, reaction_users(channel, message, &emoji, after, limit) -> ReactionUsersPage. The emoji path segment is ReactionEmoji::path_segment().
  • Pins: pins(channel, &PinsQuery) -> PinsPage, pin, unpin, ack_pins.
  • search_messages(&SearchRequest) -> SearchResponse (HTTP 200 {indexing: true} reads as Indexing).
  • Bookmarks and mentions: saved_messages(limit, before), save_message, unsave_message, recent_mentions(&MentionsQuery).
  • DMs: create_group_dm, add_recipient, remove_recipient, edit_channel (icon as a data URI or null), close_channel, relationships().
  • patch_user_settings(&UserSettingsPatch) -> UserSettings. It is never retried, so a SYNCED_PREFERENCES_CONFLICT comes back as it is.
  • GIFs: gifs_featured/trending(locale), gifs_search/suggest(q, locale), gif_register_share(id, q, locale). The query and body match the original's localizedQuery / gifShareBody.
  • Saved media: memes(), save_meme_from_message(channel, message, &SaveMemeRequest), delete_meme(id). Guild expressions: guild_emojis(guild), guild_stickers(guild).
  • Threads: create_thread_from_message, create_thread, active_threads(guild) -> ActiveThreads, join_thread, leave_thread.
  • ack(channel, message, manual: bool): {"manual": true} when manual, otherwise {} as before.

Retry policy follows the crate's rule: only GETs are sent again after a 429. Everything else surfaces RateLimited.

How it was tested

  • crates/fluxer-api/tests/chat.rs (13 tests) and tests/expressions.rs (3 tests) run against wiremock with the REST fixtures from Text chat 2/3: reaction_path_encodes_unicode_and_custom, reaction_users_paging, pins_query_and_page, search_indexing_then_results, group_dm_create_and_recipients, edit_channel_icon_data_uri, patch_user_settings_only_set_fields, gif_endpoints_send_locale, thread_create_from_message, manual_ack_body. There are also tests for saved messages and mentions, active threads, memes, guild emoji and stickers, the settings conflict and a 429 on a reaction.
  • I watched the new tests fail (compile errors for the missing methods) before writing the code.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally. No desktop tests apply.

Deviations from the plan

  • fluxer-proto gained two small types the Interfaces block uses but no earlier task defines, plus one contract check:
    • SaveMemeRequest (CreateFavoriteMemeBodySchema), checked against the vendored OpenAPI in spec_contract.rs.
    • ActiveThreads (ActiveThreadsResponse).
  • ack gained the manual argument, so its three callers now pass false: apps/fluxer/src/runtime.rs, crates/fluxer-devserver/tests/scenario.rs and crates/fluxer-api/tests/messages.rs. The manual body is {"manual": true} as the plan says. The original also sends mention_count: 0, which the server treats as optional.
  • active_threads has no new fixture: its test builds {threads, members} from fixtures/rest/thread_created.json, so models_roundtrip's fixture registry stays untouched.
  • Merging the two stacked branches gave non-mechanical conflicts in fluxer-proto: events.rs variants/imports and dispatch-name counts (now 60 typed + 24 untyped = 84), channel.rs fields, settings.rs accessors, models_roundtrip.rs lists, README. I resolved them by keeping both sides. Please look at the merge commit.

Stacked on: textchat-2-proto-chat-requests-events, textchat-3-proto-expressions-threads-prefs

Closes #256

🤖 Generated with Claude Code

## What this builds Text chat Task 6: the chat endpoints of spec §3.1 on `ApiClient` (`crates/fluxer-api/src/{reactions,pins,search,saved,dms,expressions,threads,settings}.rs`): - Reactions: `add_reaction`, `remove_own_reaction`, `remove_user_reaction`, `remove_emoji_reactions`, `remove_all_reactions`, `reaction_users(channel, message, &emoji, after, limit) -> ReactionUsersPage`. The emoji path segment is `ReactionEmoji::path_segment()`. - Pins: `pins(channel, &PinsQuery) -> PinsPage`, `pin`, `unpin`, `ack_pins`. - `search_messages(&SearchRequest) -> SearchResponse` (HTTP 200 `{indexing: true}` reads as `Indexing`). - Bookmarks and mentions: `saved_messages(limit, before)`, `save_message`, `unsave_message`, `recent_mentions(&MentionsQuery)`. - DMs: `create_group_dm`, `add_recipient`, `remove_recipient`, `edit_channel` (icon as a data URI or `null`), `close_channel`, `relationships()`. - `patch_user_settings(&UserSettingsPatch) -> UserSettings`. It is never retried, so a `SYNCED_PREFERENCES_CONFLICT` comes back as it is. - GIFs: `gifs_featured/trending(locale)`, `gifs_search/suggest(q, locale)`, `gif_register_share(id, q, locale)`. The query and body match the original's `localizedQuery` / `gifShareBody`. - Saved media: `memes()`, `save_meme_from_message(channel, message, &SaveMemeRequest)`, `delete_meme(id)`. Guild expressions: `guild_emojis(guild)`, `guild_stickers(guild)`. - Threads: `create_thread_from_message`, `create_thread`, `active_threads(guild) -> ActiveThreads`, `join_thread`, `leave_thread`. - `ack(channel, message, manual: bool)`: `{"manual": true}` when manual, otherwise `{}` as before. Retry policy follows the crate's rule: only `GET`s are sent again after a 429. Everything else surfaces `RateLimited`. ## How it was tested - `crates/fluxer-api/tests/chat.rs` (13 tests) and `tests/expressions.rs` (3 tests) run against wiremock with the REST fixtures from Text chat 2/3: `reaction_path_encodes_unicode_and_custom`, `reaction_users_paging`, `pins_query_and_page`, `search_indexing_then_results`, `group_dm_create_and_recipients`, `edit_channel_icon_data_uri`, `patch_user_settings_only_set_fields`, `gif_endpoints_send_locale`, `thread_create_from_message`, `manual_ack_body`. There are also tests for saved messages and mentions, active threads, memes, guild emoji and stickers, the settings conflict and a 429 on a reaction. - I watched the new tests fail (compile errors for the missing methods) before writing the code. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally. No desktop tests apply. ## Deviations from the plan - `fluxer-proto` gained two small types the Interfaces block uses but no earlier task defines, plus one contract check: - `SaveMemeRequest` (`CreateFavoriteMemeBodySchema`), checked against the vendored OpenAPI in `spec_contract.rs`. - `ActiveThreads` (`ActiveThreadsResponse`). - `ack` gained the `manual` argument, so its three callers now pass `false`: `apps/fluxer/src/runtime.rs`, `crates/fluxer-devserver/tests/scenario.rs` and `crates/fluxer-api/tests/messages.rs`. The manual body is `{"manual": true}` as the plan says. The original also sends `mention_count: 0`, which the server treats as optional. - `active_threads` has no new fixture: its test builds `{threads, members}` from `fixtures/rest/thread_created.json`, so `models_roundtrip`'s fixture registry stays untouched. - Merging the two stacked branches gave non-mechanical conflicts in `fluxer-proto`: `events.rs` variants/imports and dispatch-name counts (now 60 typed + 24 untyped = 84), `channel.rs` fields, `settings.rs` accessors, `models_roundtrip.rs` lists, README. I resolved them by keeping both sides. Please look at the merge commit. Stacked on: textchat-2-proto-chat-requests-events, textchat-3-proto-expressions-threads-prefs Closes #256 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Failing tests for Text chat 3 (expressions.rs, threads.rs, prefs.rs) and the fixtures
they read, each shaped from the fork at ba98441b4:

- gateway/guild_emojis_update.json, guild_stickers_update.json:
  fluxer_api/src/api/guild/services/content/EmojiService.ts:301-307 and
  StickerService.ts:342-348 ({emojis}/{stickers} via mapGuildEmojiToResponse /
  mapGuildStickerToResponse, guild/GuildModel.ts:98-118), guild_id added by
  fluxer_gateway/src/guild/guild_dispatch.erl:91.
- gateway/thread_create.json, thread_update.json, thread_delete.json,
  thread_members_update.json, thread_member_update.json:
  fluxer_api/src/api/channel/services/thread/ThreadDispatch.ts:26-93 (thread object from
  ThreadMappers.ts:42-92); the internal _fluxer_* keys are stripped by
  guild_dispatch.erl:131-136 / guild_thread_payload.erl:139-146.
- gateway/thread_list_sync.json: fluxer_gateway/src/guild/guild_thread_view.erl:100-123.
- gateway/favorite_meme_create.json, favorite_meme_delete.json:
  fluxer_api/src/api/favorite_meme/FavoriteMemeService.ts:213-218, 454-458 and
  FavoriteMemeModel.ts:9-32.
- gateway/user_settings_update_prefs.json:
  fluxer_api/src/api/user/services/UserAccountUpdatePropagator.ts:17-23,
  user/UserMappers.ts:296-375.
- rest/guild_emojis.json, guild_stickers.json: GuildEmojiController.ts:111-133
  (GuildEmojiWithUserResponse, packages/schema/src/domains/guild/GuildEmojiSchemas.ts:9-39).
- rest/gifs_featured.json, gifs_search.json: packages/schema/src/domains/gif/GifSchemas.ts:36-88,
  fluxer_gifs/src/types.rs:70-100 (placeholder left out when absent).
- rest/memes.json: FavoriteMemeModel.ts:9-32 (nullable fields written as null).
- rest/thread_created.json: ThreadController.ts:134-169 (201 ThreadChannelResponse),
  ThreadMappers.ts:19-41 (own member: muted, mute_config null), 58-92.
- prefs/synced_preferences.b64: encoded by the fork's own protobuf-es encoder
  (packages/schema/src/gen/fluxer/user/preferences/v1/*_pb.ts,
  packages/schema/src/domains/user/SyncedPreferencesCodec.ts), run read-only; how is in
  fixtures/prefs/README.md.

Refs #253

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Gateway fixtures, shaped from the fork's server at ba98441b4:
- message_reaction_add (DM, session_id kept): fluxer_api/src/api/channel/
  services/interaction/MessageReactionService.ts:431-449, dispatched as is by
  ChannelGatewayDispatch.ts:46-50
- message_reaction_add_guild, message_reaction_remove (guild_id added,
  member with user, session_id stripped): fluxer_gateway/src/guild/
  guild_dispatch.erl:91,146-149 and guild_dispatch_decorate.erl:36-46,63-66
- message_reaction_add_many: fluxer_gateway/src/session/
  session_dispatch_voice.erl:157-195
- message_reaction_remove_all / _remove_emoji: MessageReactionService.ts:472-500
- message_delete_bulk: channel/services/message/MessageGatewayDispatch.ts:140-158
- channel_pins_update: channel/services/interaction/MessagePinService.ts:253-262
- channel_pins_ack: read_state/ReadStateService.ts:266-281
- channel_recipient_add / _remove: channel/services/group_dm/
  GroupDmOperationsService.ts:207-216,288-296
- saved_message_create (d is the MessageResponse itself), saved_message_delete,
  recent_mention_delete: user/services/UserContentService.ts:114-123,897-981
- relationship_add: user/services/UserRelationshipService.ts:703-720 via
  user/UserMappers.ts:375-394; relationship_remove ({id} only): :742-748
- message_update_unfurl (full message, member without user):
  guild_dispatch_decorate.erl:36-41

REST fixtures:
- presigned_uploads: channel/services/AttachmentUploadService.ts:228-285
- pins_page: packages/schema/src/domains/message/MessageResponseSchemas.ts:177-194
- reaction_users: MessageResponseSchemas.ts:200-204
- search_results / search_indexing (HTTP 200): MessageResponseSchemas.ts:208-233
- saved_messages: user/services/UserContentRequestService.ts:166-174,
  packages/schema/src/domains/user/UserResponseSchemas.ts:591-614
- mentions: MessageListResponse (MessageResponseSchemas.ts:237)
- relationships: UserMappers.ts:375-394, UserResponseSchemas.ts:492-505
- group_dm: ChannelSchemas.ts (nicks at :105-108)

Refs #252

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Requests: SendMessageRequest gains message_reference, allowed_mentions,
flags, attachments, sticker_ids, favorite_meme_id and tts (all left off the
wire at their default, so a plain send is still {content, nonce} byte for
byte); MessageReferenceRequest, AllowedMentions/MentionParse,
AttachmentPayload/AttachmentPayloadId (ids as decimal strings, as the
original sends them), EditMessageRequest with optional content, flags and
attachments; the presigned upload flow (PresignRequest, PresignResponse with
SecretString URLs and redacting Debug, CompleteUploadsRequest); PinsQuery /
PinsPage; ReactionUsersPage; SearchRequest / SearchResponse::{Results,
Indexing}; SavedMessage, SaveMessageRequest, MentionsQuery;
CreateGroupDmRequest, EditChannelRequest, Channel.nicks; Relationship;
UserSettings accessors and UserSettingsPatch.

Gateway: MESSAGE_REACTION_ADD|ADD_MANY|REMOVE|REMOVE_ALL|REMOVE_EMOJI,
CHANNEL_PINS_UPDATE|ACK, CHANNEL_RECIPIENT_ADD|REMOVE,
SAVED_MESSAGE_CREATE|DELETE, RECENT_MENTION_DELETE,
RELATIONSHIP_ADD|UPDATE|REMOVE typed; MESSAGE_DELETE_BULK gains guild_id;
READY.relationships typed. Request bodies are checked against their OpenAPI
request schemas.

The struct-literal changes in fluxer-api and fluxer-devserver tests,
apps/fluxer's runtime and fluxer-core's MESSAGE_DELETE_BULK match are the
minimum needed to compile against the new shapes.

Refs #252

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Typed guild emoji and stickers (REST, READY/GUILD_CREATE, GUILD_EMOJIS_UPDATE,
GUILD_STICKERS_UPDATE), thread channels, members and dispatches with the READY
`threads` key presence kept, thread-create requests, GIFs and the well-known gif
config, saved media and FAVORITE_MEME_*, and `prefs::SyncedPreferences`: a
field-preserving protobuf codec for user_settings.synced_preferences that rewrites
only changed top-level fields and keeps unknown fields byte for byte.

The unknown-dispatch example in fluxer-gateway's tests and fixtures/gateway/
unknown_event.json moves from FAVORITE_MEME_CREATE (now typed) to WEBHOOKS_UPDATE,
shaped from fluxer_api/src/api/webhook/WebhookService.ts:642-647 plus the guild_id
the gateway adds (guild_dispatch.erl:91).

Refs #253

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
EditMessageRequest gains allowed_mentions (Option, left out when unset),
as the original's buildMessageEditRequest sends it
(fork:fluxer_app/src/features/messaging/utils/MessageRequestUtils.ts:164-180)
and MessageUpdateRequestSchema accepts it (spec §3.1). The spec contract
test now checks the field against spec/openapi.json.

Refs #252

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts:
#	crates/fluxer-proto/README.md
#	crates/fluxer-proto/src/gateway/events.rs
#	crates/fluxer-proto/src/gateway/ready.rs
#	crates/fluxer-proto/src/models/channel.rs
#	crates/fluxer-proto/src/models/mod.rs
#	crates/fluxer-proto/src/models/settings.rs
#	crates/fluxer-proto/tests/models_roundtrip.rs
SaveMemeRequest is CreateFavoriteMemeBodySchema
(packages/schema/src/domains/meme/MemeSchemas.ts:20-25), checked against the
vendored OpenAPI schema. ActiveThreads is ActiveThreadsResponse
(packages/schema/src/domains/channel/ThreadRequestSchemas.ts:109-112), the
answer of GET /guilds/{g}/threads/active (ThreadController.ts:230-243).

Refs #256

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ApiClient gains the text chat endpoints of spec §3.1: reactions and reaction
users, pins and the pins ack, message search (indexing answer included),
bookmarks and recent mentions, group DMs, recipients, channel edit and close,
relationships, the user settings patch, GIFs (with the UI locale), saved media,
guild emoji and stickers, and threads. ack() takes a manual flag and sends
{"manual": true} for "Mark as unread"; its three callers pass false.

Refs #256

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

Independent review: Text chat 6 (api-chat-endpoints), head b3179a2

I reviewed git diff 3bcf92d..origin/textchat-6-api-chat-endpoints without relying on the implementer's notes.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree exited 0 (green).

What I checked and found correct

  • All 10 tests named in the plan exist and assert the values the plan gives: reaction_path_encodes_unicode_and_custom, reaction_users_paging, pins_query_and_page, search_indexing_then_results, group_dm_create_and_recipients, edit_channel_icon_data_uri, patch_user_settings_only_set_fields, gif_endpoints_send_locale, thread_create_from_message and manual_ack_body. The PR also adds 6 extra tests.
  • Every method in the Interfaces block exists on ApiClient with the planned name and arguments. ack(channel, message, manual) is updated at all three call sites.
  • Every route, verb and body was checked against the fork:
    • MessageInteractionController.ts (reactions, pins, pins ack), ThreadController.ts (create, active, thread-members/@me) and ChannelController.ts (recipients, PATCH/DELETE channel).
    • UserContentController.ts (saved-messages, mentions), FavoriteMemeController.ts, GifController.ts (GifSearchQuery, GifLocaleQuery, GifRegisterShareRequest), SearchController.ts and UserAccountController.ts (settings).
    • SaveMemeRequest matches CreateFavoriteMemeBodySchema and has a spec_contract check. ActiveThreads matches ActiveThreadsResponse.
  • Only GETs are retried after a 429. A settings conflict is not retried.
  • No new fixtures. No changes to fluxer-core, fluxer-ui or fluxer-emoji.

Findings

  1. [blocking] edit_channel puts file content into --record output (crates/fluxer-api/src/dms.rs).
    • What happens: edit_channel goes through the observed client. With icon: Some(Some(data URI)), the request body carries the user's image file as base64. The observer records that body, and record.rs::redact only removes secret keys and *_token.
    • Why it matters: the Global Constraints say "No upload URL, presigned URL, signed attachment URL, file path or file content in logs or --record output".
    • Fix: send it with self.unobserved().execute_json(...), as streams.rs does, either always or when icon is Some(Some(_)). Add a test that the observer never sees the data URI, in the style of Task 5's observer_never_sees_upload_urls. The existing soundboard upload has the same pattern and predates this constraint; it could be a follow-up issue.
  2. [minor] Manual ack body leaves out mention_count (crates/fluxer-api/src/messages.rs).
    • The original's sendManualAck (fluxer_app/src/features/read_state/state/ReadStates.ts:369-377) sends mention_count with manual: true.
    • The server (MessageController.ts:576-581) defaults a missing mention_count to 0. So "Mark as unread" on a message that mentions the user resets the server-side mention badge to 0.
    • The plan text says {manual}, so this is not a contract break. It is worth a follow-up issue so that Task 16 can pass the count.
  3. [minor] active_threads has no fixture of its own. Its test builds the response from thread_created.json. The shape matches ActiveThreadsResponse, so this is acceptable. A fixtures/rest/active_threads.json would make it easier for the devserver (Task 20) to reuse.

I did not review merge commit 3bcf92d's conflict resolution line by line. It is outside this diff, and the full CI on the head, which includes the fluxer-proto dispatch-count tests, is green.

Verdict: changes requested. There is one blocking finding (#1), a one-line fix plus a test. Everything else is correct and CI is green.

## Independent review: Text chat 6 (api-chat-endpoints), head b3179a2 I reviewed `git diff 3bcf92d..origin/textchat-6-api-chat-endpoints` without relying on the implementer's notes. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree exited 0 (green). **What I checked and found correct** - All 10 tests named in the plan exist and assert the values the plan gives: `reaction_path_encodes_unicode_and_custom`, `reaction_users_paging`, `pins_query_and_page`, `search_indexing_then_results`, `group_dm_create_and_recipients`, `edit_channel_icon_data_uri`, `patch_user_settings_only_set_fields`, `gif_endpoints_send_locale`, `thread_create_from_message` and `manual_ack_body`. The PR also adds 6 extra tests. - Every method in the Interfaces block exists on `ApiClient` with the planned name and arguments. `ack(channel, message, manual)` is updated at all three call sites. - Every route, verb and body was checked against the fork: - `MessageInteractionController.ts` (reactions, pins, pins ack), `ThreadController.ts` (create, active, thread-members/@me) and `ChannelController.ts` (recipients, PATCH/DELETE channel). - `UserContentController.ts` (saved-messages, mentions), `FavoriteMemeController.ts`, `GifController.ts` (GifSearchQuery, GifLocaleQuery, GifRegisterShareRequest), `SearchController.ts` and `UserAccountController.ts` (settings). - `SaveMemeRequest` matches `CreateFavoriteMemeBodySchema` and has a spec_contract check. `ActiveThreads` matches `ActiveThreadsResponse`. - Only GETs are retried after a 429. A settings conflict is not retried. - No new fixtures. No changes to fluxer-core, fluxer-ui or fluxer-emoji. **Findings** 1. **[blocking] `edit_channel` puts file content into `--record` output** (`crates/fluxer-api/src/dms.rs`). - What happens: `edit_channel` goes through the observed client. With `icon: Some(Some(data URI))`, the request body carries the user's image file as base64. The observer records that body, and `record.rs::redact` only removes secret keys and `*_token`. - Why it matters: the Global Constraints say "No upload URL, presigned URL, signed attachment URL, file path or file content in logs or `--record` output". - Fix: send it with `self.unobserved().execute_json(...)`, as `streams.rs` does, either always or when `icon` is `Some(Some(_))`. Add a test that the observer never sees the data URI, in the style of Task 5's `observer_never_sees_upload_urls`. The existing soundboard upload has the same pattern and predates this constraint; it could be a follow-up issue. 2. **[minor] Manual ack body leaves out `mention_count`** (`crates/fluxer-api/src/messages.rs`). - The original's `sendManualAck` (`fluxer_app/src/features/read_state/state/ReadStates.ts:369-377`) sends `mention_count` with `manual: true`. - The server (`MessageController.ts:576-581`) defaults a missing `mention_count` to 0. So "Mark as unread" on a message that mentions the user resets the server-side mention badge to 0. - The plan text says `{manual}`, so this is not a contract break. It is worth a follow-up issue so that Task 16 can pass the count. 3. **[minor] `active_threads` has no fixture of its own.** Its test builds the response from `thread_created.json`. The shape matches `ActiveThreadsResponse`, so this is acceptable. A `fixtures/rest/active_threads.json` would make it easier for the devserver (Task 20) to reuse. I did not review merge commit 3bcf92d's conflict resolution line by line. It is outside this diff, and the full CI on the head, which includes the fluxer-proto dispatch-count tests, is green. **Verdict: changes requested.** There is one blocking finding (#1), a one-line fix plus a test. Everything else is correct and CI is green.
edit_channel now goes through the unobserved client, as the stream preview
endpoints do: a group DM icon is the user's image as a base64 data: URI, and
no file content may reach the observer. A test records every exchange the
observer sees and checks the icon is not among them.

fixtures/rest/active_threads.json gives GET /guilds/{id}/threads/active its own
fixture, shaped from the fork at ba98441b4:
fluxer_api/src/api/channel/services/thread/ThreadListService.ts:165-179
(threads mapped by mapThreadToResponse without a viewer member, so no
`member` key, newest first; members with self fields) and
packages/schema/src/domains/channel/ThreadRequestSchemas.ts:109-112. The
proto round-trip covers it.

Refs #256

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

Review round 1 addressed in 31b48f6.

Blocking: edit_channel observed (crates/fluxer-api/src/dms.rs). Fixed. edit_channel now builds and sends its request through self.unobserved(), as streams.rs does, so the group DM icon's data: URI never reaches the observer / --record. Test first: edit_channel_icon_is_not_observed in crates/fluxer-api/tests/chat.rs records every exchange the observer is shown and asserts the icon bytes are absent; it failed before the change and passes now. The unobserved() doc comment names group DM icons as a reason.

Minor: manual ack without mention_count (crates/fluxer-api/src/messages.rs). Deferred to follow-up #303: changing ack's signature reaches into its callers and Text chat 16's interface, so it is better done there. The issue cites ReadStates.ts:369-377 and the legacy fallback at ReadStates.ts:950-971 (which also sends mention_count to the per-message ack), and notes that the original tries POST /read-states/ack first.

Minor: no active_threads fixture (crates/fluxer-api/tests/chat.rs). Fixed. Added fixtures/rest/active_threads.json, shaped from the fork at ba98441b4 (ThreadListService.ts:165-179, ThreadRequestSchemas.ts:109-112). It has two threads, newest first, with no member key on the threads, because mapThreadToResponse gets no viewer member on this route, and one self membership carrying muted/mute_config. The API test now serves it, and the fluxer-proto round-trip and unknown-fields tables cover it.

FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally. One earlier run hit an intermittent SIGSEGV at exit in the fluxer lib test binary after all 53 tests had passed. It is unrelated to this change and is filed as #304.

(An earlier comment posted here by mistake, a stale review text for Text chat 9, has been deleted.)

Review round 1 addressed in 31b48f6. **Blocking: `edit_channel` observed (crates/fluxer-api/src/dms.rs).** Fixed. `edit_channel` now builds and sends its request through `self.unobserved()`, as `streams.rs` does, so the group DM icon's `data:` URI never reaches the observer / `--record`. Test first: `edit_channel_icon_is_not_observed` in `crates/fluxer-api/tests/chat.rs` records every exchange the observer is shown and asserts the icon bytes are absent; it failed before the change and passes now. The `unobserved()` doc comment names group DM icons as a reason. **Minor: manual ack without `mention_count` (crates/fluxer-api/src/messages.rs).** Deferred to follow-up #303: changing `ack`'s signature reaches into its callers and Text chat 16's interface, so it is better done there. The issue cites `ReadStates.ts:369-377` and the legacy fallback at `ReadStates.ts:950-971` (which also sends `mention_count` to the per-message ack), and notes that the original tries `POST /read-states/ack` first. **Minor: no `active_threads` fixture (crates/fluxer-api/tests/chat.rs).** Fixed. Added `fixtures/rest/active_threads.json`, shaped from the fork at ba98441b4 (`ThreadListService.ts:165-179`, `ThreadRequestSchemas.ts:109-112`). It has two threads, newest first, with no `member` key on the threads, because `mapThreadToResponse` gets no viewer member on this route, and one self membership carrying `muted`/`mute_config`. The API test now serves it, and the `fluxer-proto` round-trip and unknown-fields tables cover it. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally. One earlier run hit an intermittent SIGSEGV at exit in the `fluxer` lib test binary after all 53 tests had passed. It is unrelated to this change and is filed as #304. (An earlier comment posted here by mistake, a stale review text for Text chat 9, has been deleted.)
Author
Owner

Independent review (round 2): Text chat 6 (api-chat-endpoints), head 31b48f6

I reviewed git diff 3bcf92d..origin/textchat-6-api-chat-endpoints cold, then checked the implementer's notes against it.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree (tc-review-6) exited 0 ("all steps passed").

What I checked and found correct

  1. Plan tests. All 10 named tests exist in crates/fluxer-api/tests/{chat,expressions}.rs and assert what the plan says:
    • reaction_path_encodes_unicode_and_custom: %F0%9F%91%8D, name%3Aid, all 6 reaction routes.
    • reaction_users_paging: limit / after, and next_after is fed back.
    • pins_query_and_page: an ISO before.
    • search_indexing_then_results: HTTP 200 {indexing:true}, then results.
    • group_dm_create_and_recipients, edit_channel_icon_data_uri.
    • patch_user_settings_only_set_fields: exact body_json.
    • gif_endpoints_send_locale: all 5 GIF endpoints.
    • thread_create_from_message, manual_ack_body.
    • Extra tests: edit_channel_icon_is_not_observed, active threads, memes, emoji/stickers, the settings conflict, a reaction 429.
  2. Interfaces. Every method in Task 6's Interfaces block exists on ApiClient with the planned name and arguments, including ack(channel, message, manual: bool). Its 3 callers pass false.
  3. Routes and verbs against the fork (ba98441b4). I re-checked:
    • MessageInteractionController.ts: reactions, messages/pins, pins/:message_id, pins/ack.
    • ThreadController.ts: threads/active, thread-members/@me (204), creates (201).
    • ChannelController.ts: recipients, PATCH/DELETE /channels/:id.
    • UserContentController.ts: saved-messages (POST 204), mentions.
    • FavoriteMemeController.ts: list is an array, the create from a message is 201.
    • GifController.ts: suggest and search take GifSearchQuery {q, locale}.
    • GuildEmojiController.ts / GuildStickerController.ts.
  4. Round-1 blocking finding is fixed. edit_channel builds and sends through self.unobserved(). The new test records every exchange the observer sees and asserts the data: URI is absent. The client's tracing logs only status and retry_after, never bodies.
  5. New fixture fixtures/rest/active_threads.json matches the server. It matches ThreadListService.respond: mapThreadToResponse without a viewer member, so threads have no member key, and mapThreadMemberToResponse(self) gives muted and a nullable mute_config. It also matches ThreadMemberResponse. The commit message names the files and lines it was shaped from. It is registered in models_roundtrip.rs for the round trip, unknown fields, ignored flags and defaulted fields.
  6. Invariants. No changes to fluxer-core, fluxer-ui or fluxer-emoji. No secrets: the token is the existing fake fixture token. No upload or signed URLs, and no file content reaches the observer. Only GETs are retried after a 429. Server data cannot panic: ActiveThreads uses lenient_vec.
  7. Round-1 follow-ups. Issue #303 (manual ack mention_count) exists with label follow-up. The stray comment 4557 is gone.

Findings

  1. [minor] The PR body is stale.
    • Under "Deviations" it still says "active_threads has no new fixture", but 31b48f6 adds one.
    • It also says "The original also sends mention_count: 0, which the server treats as optional". The original sends the computed count (ReadStateCommands.ts:48-53, getManualAckMentionCount); see #303.
    • Please update the body so the integrator reads the current state.
  2. [minor] The task touched crates outside its Files list. fluxer-proto gained SaveMemeRequest and ActiveThreads, and apps/fluxer / fluxer-devserver callers changed for the ack signature. All of it is small, needed by the Interfaces block, and stated in the PR. I record it only because CLAUDE.md asks for cross-crate tasks to say so in the plan.
  3. [minor, already deferred] The manual ack body leaves out mention_count. This is tracked in #303, so nothing to do here. The behaviour matches the plan's Interfaces text.

Verdict: approved. There are no blocking findings, CI is green locally, and the round-1 blocking finding is fixed with a test.

## Independent review (round 2): Text chat 6 (api-chat-endpoints), head 31b48f6 I reviewed `git diff 3bcf92d..origin/textchat-6-api-chat-endpoints` cold, then checked the implementer's notes against it. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree (`tc-review-6`) exited 0 ("all steps passed"). **What I checked and found correct** 1. **Plan tests.** All 10 named tests exist in `crates/fluxer-api/tests/{chat,expressions}.rs` and assert what the plan says: - `reaction_path_encodes_unicode_and_custom`: `%F0%9F%91%8D`, `name%3Aid`, all 6 reaction routes. - `reaction_users_paging`: `limit` / `after`, and `next_after` is fed back. - `pins_query_and_page`: an ISO `before`. - `search_indexing_then_results`: HTTP 200 `{indexing:true}`, then results. - `group_dm_create_and_recipients`, `edit_channel_icon_data_uri`. - `patch_user_settings_only_set_fields`: exact `body_json`. - `gif_endpoints_send_locale`: all 5 GIF endpoints. - `thread_create_from_message`, `manual_ack_body`. - Extra tests: `edit_channel_icon_is_not_observed`, active threads, memes, emoji/stickers, the settings conflict, a reaction 429. 2. **Interfaces.** Every method in Task 6's Interfaces block exists on `ApiClient` with the planned name and arguments, including `ack(channel, message, manual: bool)`. Its 3 callers pass `false`. 3. **Routes and verbs against the fork (ba98441b4).** I re-checked: - `MessageInteractionController.ts`: reactions, `messages/pins`, `pins/:message_id`, `pins/ack`. - `ThreadController.ts`: `threads/active`, `thread-members/@me` (204), creates (201). - `ChannelController.ts`: recipients, PATCH/DELETE `/channels/:id`. - `UserContentController.ts`: saved-messages (POST 204), mentions. - `FavoriteMemeController.ts`: list is an array, the create from a message is 201. - `GifController.ts`: `suggest` and `search` take `GifSearchQuery {q, locale}`. - `GuildEmojiController.ts` / `GuildStickerController.ts`. 4. **Round-1 blocking finding is fixed.** `edit_channel` builds and sends through `self.unobserved()`. The new test records every exchange the observer sees and asserts the `data:` URI is absent. The client's tracing logs only status and retry_after, never bodies. 5. **New fixture `fixtures/rest/active_threads.json` matches the server.** It matches `ThreadListService.respond`: `mapThreadToResponse` without a viewer member, so threads have no `member` key, and `mapThreadMemberToResponse(self)` gives `muted` and a nullable `mute_config`. It also matches `ThreadMemberResponse`. The commit message names the files and lines it was shaped from. It is registered in `models_roundtrip.rs` for the round trip, unknown fields, ignored `flags` and defaulted fields. 6. **Invariants.** No changes to fluxer-core, fluxer-ui or fluxer-emoji. No secrets: the token is the existing fake fixture token. No upload or signed URLs, and no file content reaches the observer. Only GETs are retried after a 429. Server data cannot panic: `ActiveThreads` uses `lenient_vec`. 7. **Round-1 follow-ups.** Issue #303 (manual ack `mention_count`) exists with label `follow-up`. The stray comment 4557 is gone. **Findings** 1. **[minor] The PR body is stale.** - Under "Deviations" it still says "`active_threads` has no new fixture", but 31b48f6 adds one. - It also says "The original also sends `mention_count: 0`, which the server treats as optional". The original sends the computed count (`ReadStateCommands.ts:48-53`, `getManualAckMentionCount`); see #303. - Please update the body so the integrator reads the current state. 2. **[minor] The task touched crates outside its Files list.** `fluxer-proto` gained `SaveMemeRequest` and `ActiveThreads`, and `apps/fluxer` / `fluxer-devserver` callers changed for the `ack` signature. All of it is small, needed by the Interfaces block, and stated in the PR. I record it only because CLAUDE.md asks for cross-crate tasks to say so in the plan. 3. **[minor, already deferred] The manual ack body leaves out `mention_count`.** This is tracked in #303, so nothing to do here. The behaviour matches the plan's Interfaces text. **Verdict: approved.** There are no blocking findings, CI is green locally, and the round-1 blocking finding is fixed with a test.
fluxer-proto keeps textchat's resolution of tasks 2 and 3, with task 6's
SaveMemeRequest and ActiveThreads on top; fluxer-api keeps task 5's
uploads and task 6's endpoints.

Refs #256

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge origin/textchat into textchat-6-api-chat-endpoints
Some checks failed
ci / Windows (x64) (push) Successful in 33m30s
ci / Linux (x86_64) (push) Has been cancelled
bdfc575ae1
charles manually merged commit bdfc575ae1 into textchat 2026-11-12 16:52:55 +00:00
Sign in to join this conversation.
No description provided.