Simplify message ordering and server-side sorting - #183
Open
stevebauman wants to merge 6 commits into
Open
Conversation
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.
Message queries currently blur together local UID ordering and RFC 5256 server-side sorting. They also expose oldest() and newest(), even though UID order does not reliably represent message chronology.
This replaces that API with two explicit operations: orderByUid() for capability-free local UID ordering, and sortBy() for server-side sorting. The query stores one UidOrder or ImapSort strategy, making the two modes mutually exclusive without maintaining or resetting parallel properties.
Repeated sortBy() calls add RFC 5256 criteria in priority order, allowing later criteria to act as tie-breakers. Hydrated FETCH responses are rebuilt in the original SORT order, extended SORT capabilities are recognized, and the testing fake applies the same ordering strategies. Server-side sorting continues to fail clearly when the mailbox does not advertise a SORT capability.