chore(chat): decompose ChatCoordinator into focused delegates#977
Merged
Conversation
New Messaging RPCs: GetDelta, EditMessage, DeleteMessage, AddReaction, RemoveReaction, GetReactors, GetReactionSummary, GetReactionSummaries. New content types: ReplyContent, MediaContent, SystemContent, DeletedContent. New models: Event, Mutation, EventBatch, ReactionSummary, EmojiReaction, ReactionUpdate, Emoji, Reactor, MediaItem, MediaMetadata, MediaId. ChatUpdate.new_messages deprecated in favor of EventBatch events. Message gains last_edited_ts, event_sequence, reactions fields. Metadata gains latest_event_sequence field. Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
Full Api → Service → Repository → Controller scaffolding for: GetDelta, EditMessage, DeleteMessage, AddReaction, RemoveReaction, GetReactors, GetReactionSummary, GetReactionSummaries. Domain model updates: - ChatMetadata: +latestEventSequence - ChatMessage: +lastEditedTs, eventSequence, reactions - MessageContent: +Reply, Media, System, Deleted subtypes - ChatUpdate: +events, reactionUpdates (newMessages deprecated) - New models: Emoji, Reactor, EmojiReaction, ReactionSummary, ReactionUpdate, MediaId, MediaItem, MediaMetadata, ChatEvent, ChatMutation Mapper updates for all new proto→domain and domain→proto conversions. 8 new error sealed classes matching proto response result enums. Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
Add Room columns for eventSequence, lastEditedTs, reactions on ChatMessageEntity and latestEventSequence on ChatMetadataEntity (migration 20→21). ChatCoordinator now prefers ChatUpdate.events over deprecated newMessages, supports delta-based catch-up on reconnect via getDelta, and maintains an in-memory reaction overlay from reactionUpdates. DAO upsert guards against stale writes using event sequence LWW. Add TODOs for UI handling Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
Replace naive max-sequence cursor advancement with a contiguous- frontier tracker. Out-of-order events are held in a pending set; only the highest gapless sequence is persisted. If a gap is not filled within 2s, getDelta backfills from the frontier. Prevents permanently skipping events on reordered delivery, critical for large group chats. Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
…rialization EventSequenceTrackerTest (14): gap detection, contiguous advancement, out-of-order handling, resetTo, multi-chat isolation. ChatCoordinatorEventsTest (10): events-vs-newMessages preference, gap-aware cursor, reaction overlay LWW guard and pruning. ChatTypeConvertersTest (12): ReactionSummary round-trip, nulls, plus MessageContent/Status/UserProfile converters.
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
Split the 735-line monolithic ChatCoordinator into three delegates using Kotlin interface delegation, following the SessionController pattern: - FeedSyncDelegate: feed sync, DB observation, ChatSummary projection - EventStreamDelegate: event stream, applyUpdate, gap tracking, reactions, typing indicators - MessagingDelegate: per-chat messaging, read pointers, paging, notifications ChatCoordinator becomes an interface with sub-interfaces (FeedOperations, EventStreamOperations, MessagingOperations). RealChatCoordinator is the thin shell that wires delegates via Channel<Event> flows, handles lifecycle, and observes feature flags. Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
Cover editMessage, deleteMessage, addReaction, removeReaction, getReactors, getReactionSummary, getReactionSummaries, and getDelta with no-account-cluster, parameter-forwarding, and result-surfacing tests. Wire up FakeChatMessagingRepository with tracked state for all new repository methods.
…inator-delegates * origin/code/cash: feat(messaging): integrate updated chat protos with data layer and tests (#976) fix(streaming): stop reporting retryable ClosedSendChannelException to Bugsnag (#978) build: update release manifest # Conflicts: # apps/flipcash/shared/chat/src/main/kotlin/com/flipcash/shared/chat/ChatCoordinator.kt # apps/flipcash/shared/chat/src/test/kotlin/com/flipcash/shared/chat/ChatCoordinatorEventsTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split the 735-line monolithic ChatCoordinator into three delegates using Kotlin interface delegation, following the SessionController pattern:
ChatCoordinator becomes an interface with sub-interfaces (FeedOperations, EventStreamOperations, MessagingOperations). RealChatCoordinator is the thin shell that wires delegates via Channel flows, handles lifecycle, and observes feature flags.