Text chat 2: fluxer-proto chat requests and gateway events (#252) #299
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-2-proto-chat-requests-events"
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?
What this builds
fluxer-protogains the chat requests and gateway events of Text chat 2 (spec §3.1).Requests
SendMessageRequestgainsmessage_reference,allowed_mentions,flags,attachments,sticker_ids,favorite_meme_idandtts. Each is left off the wire at its default, so a plain send is still{content, nonce}byte for byte.MessageReferenceRequest,AllowedMentions/MentionParse, andAttachmentPayload/AttachmentPayloadId. Ids are sent as decimal strings, as the original sends them.EditMessageRequest { content, flags, attachments, allowed_mentions }: every field is optional and only what changes is sent.PresignRequest,PresignResponse(its URLs areSecretStrings and itsDebugredacts them) andCompleteUploadsRequest.PinsQuery/PinsPage,ReactionUsersPage,SearchRequest/SearchResponse::{Results, Indexing},SavedMessage,SaveMessageRequest,MentionsQuery,CreateGroupDmRequest,EditChannelRequest,Channel.nicks,Relationship, theUserSettingsaccessors andUserSettingsPatch.spec_contract).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_DELETEandRELATIONSHIP_ADD|UPDATE|REMOVE.MESSAGE_DELETE_BULKgainsguild_id,READY.relationshipsis typed, andTYPED_DISPATCH_NAMESis updated.Outside
fluxer-proto, only the struct literals and theMESSAGE_DELETE_BULKmatch influxer-api/fluxer-devservertests,apps/fluxer's runtime andfluxer-corechanged, and only as much as needed to compile against the new shapes.Notes for downstream tasks
GatewayEvent::SavedMessageCreate(Box<SavedMessage>): the plan's Interfaces block saysSavedMessage, but the payload is boxed to satisfy clippy'slarge_enum_variant. Field access auto-derefs. To move the payload out (Text chat 15/19), use*saved.AttachmentPayload.duration/waveform(the original sends them for voice messages,MessageAttachmentUtils.ts:35-36) andMessageReferenceRequest.attachment_ids/embed_indices(partial forwards).EditMessageRequest.allowed_mentionsis included even though the plan's Interfaces block leaves it out. Spec §3.1 andbuildMessageEditRequest(MessageRequestUtils.ts:164-180) both have it. Text chat 11 and 6 can set it.Testing
FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally at72b970a.Closes #252
🤖 Generated with Claude Code
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>Review round 1: what changed for each finding (head
72b970a)010fcbaplus one fix commit,72b970a, so the findings reviewed at010fcbastill apply.SavedMessageCreateholdsBox<SavedMessage>. I kept the code as it is because the box is what clippy'slarge_enum_variantneeds. The PR body now tells downstream tasks to use*savedwhen they move the payload out.EditMessageRequesthas noallowed_mentions. Fixed in72b970a. I wrote the test first:edit_request_sends_only_what_changesnow covers an edit withallowed_mentions, andspec_contract_new_request_typeschecks the field againstMessageUpdateRequestSchema. The field is anOptionand is left out when unset, as inbuildMessageEditRequest. The README is updated too.AttachmentPayload.duration/waveform,MessageReferenceRequest.attachment_ids/embed_indices). These are listed in the PR body and deferred to follow-up #298. Adding them now would change every struct-literal constructor, and no planned task needs them yet.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally.Independent review: Text chat 2 (head
72b970a)Scope: the task's own changes (
origin/textchat..72b970a; the rest of6e2d238..is the already-reviewed Text chat 1/4/7 merges).Checks
plain_send_serialises_like_before…user_settings_accessor_defaultsinchat_requests.rs/chat_events.rs,spec_contract_new_request_typesinspec_contract.rs) and assert what the plan says: plain send is byte-identical{"content","nonce"}; replytype:0/ forwardtype:1+guild_id;allowed_mentionsleaves empty lists off; multipart ids"0","1"as the original'sString(index); presigned payload carriesupload_filename/file_size/content_type; both upload modes parse andDebughides the URLs;{indexing:true}with 200 isIndexing; pinsbeforeis an ISO timestamp; one fixture per new dispatch;ADD_MANYentries in order withmemberonly where present; guild message eventmemberwithoutuser; settings defaults matchUserSettings.ts:309-316andRenderSpoilerswire values matchUserConstants.ts:258-262.SendMessageRequest,MessageReferenceRequest,AllowedMentions,AttachmentPayload/AttachmentPayloadId::{Index,Snowflake},EditMessageRequest,PresignRequest/PresignItem/PresignResponse/PresignedUpload/UploadMode/UploadPartwithSecretString,CompleteUploadsRequest,PinsQuery/PinsPage/PinnedMessage,ReactionUsersPage,SearchRequest/SearchResponse::{Results,Indexing}/SearchResults,SavedMessage,MentionsQuery,CreateGroupDmRequest,EditChannelRequest,Relationship,UserSettingsPatch, theUserSettingsaccessors, all 16GatewayEventvariants,ReactionEvent,ReactionAddMany/ReactionAddManyEntry,ReadyPayload.relationships: Vec<Relationship>,Channel.nicks,TYPED_DISPATCH_NAMES).Cargo.tomluntouched;secrecywas already there);fluxer-core/fluxer-api/devserver/app changes are only the mechanical..Default::default()/guild_idupdates the interface change forces. Fixtures checked against the fork: reaction payloads (MessageReactionService.ts:431-500), member withuseron reactions and without on message events (guild_dispatch_decorate.erl:36-66),ADD_MANY(session_dispatch_voice.erl:156-195),CHANNEL_PINS_UPDATE/ACK,CHANNEL_RECIPIENT_ADD,RELATIONSHIP_REMOVE {id},SAVED_MESSAGE_CREATE= the message,SavedMessageEntryResponse.messagenullable. The fixture commit (92bfe2e) names the server file and line for each. Malformed payloads are errors, not panics (tested for all 15 new names). The presigned fixture's URLs are placeholders (*.example.invalid, fake signature), not real ones.MESSAGE_REACTION_ADD(DM withsession_id, guild withmember),_ADD_MANY,_REMOVE,_REMOVE_ALL,_REMOVE_EMOJIare shaped like the server. They give Text chat 13 what it needs to tell the client's own echo apart (user_id,session_idin DMs).FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a clean review worktree at72b970a: all steps passed.Findings
GatewayEvent::SavedMessageCreate(Box<SavedMessage>)where the plan saysSavedMessageCreate(SavedMessage). Pattern matches downstream work unchanged; code that builds the event (Text chat 15/20 tests, devserver) needsBox::new. The PR body notes this. No change needed.EditMessageRequesthas an extra field,allowed_mentions, that the plan does not list. It is additive and correct: spec §3.1 PATCH andbuildMessageEditRequest. Downstream code that builds it with..Default::default()is unaffected.AttachmentPayload.duration/waveform(voice messages,MessageAttachmentUtils.ts:35-36) andMessageReferenceRequest.attachment_ids/embed_indices. They are outside the plan's Interfaces block and tracked in follow-up #298.No blocking findings.
Verdict: approved (0 blocking, local ci green; remote runners not checked by this review).