fix(messages): serialize list responses and mark unavailable envelopes (#336) - #524
Open
johdanike wants to merge 3 commits into
Open
fix(messages): serialize list responses and mark unavailable envelopes (#336)#524johdanike wants to merge 3 commits into
johdanike wants to merge 3 commits into
Conversation
- Updated the conversation list handler to map preview messages through serializeConversation. - Applied serializeMessage to ensure the preview shape matches the GET /:id response. - Prevented the accidental leakage of plaintext content fields in the raw conversation object. - Added explicit tests asserting the list response contains no plaintext fields. - Verified in tests that the preview message perfectly matches the standard ciphertext-safe shape. Closes codebestia#338
- Added privacy check to ensure the reader's sendReadReceipts setting is true before broadcasting. - Implemented a monotonic cursor guard to ensure lastReadMessageId only ever advances forward. - Updated the handler to stamp messageEnvelopes.readAt for the reader's device envelopes. - Ignored backwards cursor updates to prevent stale read receipts from regressing state. - Added comprehensive tests covering the privacy toggle, backwards rejection, and readAt persistence. Closes codebestia#339
- Updated GET /conversations/:id/messages to map rows through the serializeMessage helper. - Ensured the message list response shape perfectly matches the GET /:id endpoint. - Added logic to explicitly mark messages missing a device envelope with unavailable: true. - Created a dedicated test file covering pagination, unavailable envelopes, and cursor correctness. Closes codebestia#336
|
@johdanike Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
This PR resolves #336 by fixing the response shape of the
GET /conversations/:id/messageshandler. Previously, the endpoint returned raw row objects instead of mapping them through the shared serialization helper, and clients had no way to distinguish a legitimately empty message from one where the caller's device lacked a matching envelope. This update ensures consistent ciphertext-safe shapes and explicit unavailable markers.Changes Made
serializeMessagehelper, ensuring the returned shape exactly matches whatGET /:idproduces.unavailable: trueto any message that lacks a matching envelope for the caller's specificdeviceId.Acceptance Criteria Met
serializeMessage, matching the shapeGET /:idalready produces.unavailable: true.Closes #336