Repository navigation
GET /fmsg: list most recently arrived first, so a fresh add-to comes first - #66
Merged
Merged
Conversation
…first The inbox was ordered by message id, so an older message an identity was just added to sat at its original position, far below newer messages, and clients scanning the latest page missed it. Order by when the message arrived for that identity: the later of its send time (as a recipient) and the time_added of any add-to batch that added the identity. Ties fall back to id descending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
GET /fmsgordered the inbox by message id. When someone adds an identity to an older message, it stays at its original position, far below newer messages. A client reading the latest page, whether a person or an agent checking for new mail, never sees it.Change
The inbox is now ordered by when each message arrived for that identity:
time_sent, where the identity is inmsg_to;time_addedof any add-to batch that added the identity;Ties fall back to id descending.
msg_toandmsg_add_to/msg_add_to_batchfor the identity first (both use the existinglower(addr)indexes), then joinsmsg.GET /fmsgsection describes the new order.Tests
TestListOrdersByArrivalcovers:limit/offsetpages;It fails on main and passes with the change. The full
go test ./...passes against Postgres 17 with fmsgd'sdd.sql.🤖 Generated with Claude Code