You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: a newly created message lands mid-feed instead of at the top #97
Found while implementing #22 (cursor pagination). Pre-existing, unrelated to that change, so filed
rather than fixed there.
The bug
DefaultMessagesRepository.createMessage inserts the new post at maxFeedOrder() - 1.
The feed sorts by feedOrder ASC. With a cached feed of more than two rows, maxFeedOrder() - 1
is not smaller than every other row's order — so the new message lands somewhere in the middle
of the feed instead of at the top.
Why the tests do not catch it
The existing coverage exercises a single-row feed, where maxFeedOrder() - 1 happens to be
correct. The bug only shows up with three or more cached rows.
Fix
Add a minFeedOrder() query to MessageDao and insert at minFeedOrder() - 1. Extend the test to
a feed of at least three rows so the regression is actually covered.
Reported by the agent implementing #22; left out of that PR because it sits in composer code that #19 and #20 will be touching.
Fixed in #122 (the tag-feed PR), since that work replaced the feed's ordering scheme wholesale and the bug lived exactly there.
A newly created message was inserted at maxFeedOrder - 1. With the feed sorting ascending, that is near the bottom of a loaded feed, not the top. It is now minPosition - 1 — a genuine head insert. As predicted in this issue, the existing "at the top of the feed" test passed only because it used a single-row feed.
Activity
Adron commentedon Sep 16, 2026
Fixed in #122 (the tag-feed PR), since that work replaced the feed's ordering scheme wholesale and the bug lived exactly there.
A newly created message was inserted at
maxFeedOrder - 1. With the feed sorting ascending, that is near the bottom of a loaded feed, not the top. It is nowminPosition - 1— a genuine head insert. As predicted in this issue, the existing "at the top of the feed" test passed only because it used a single-row feed.