fix(db): add a monotonic tiebreak to listNotificationDeliveriesForRecipient's ORDER BY - #8926
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…ipient's ORDER BY listNotificationDeliveriesForRecipient ordered only by `createdAt DESC`. A fan-out (e.g. issue_watch_match to many miners) stamps createdAt via nowIso() per row, so several deliveries can tie on the millisecond timestamp, leaving display order and the limit-boundary row engine-defined. Add `desc(notificationDeliveries.id)` as a deterministic secondary sort, matching the ai_review_cache tiebreak fix. Closes JSONbored#8895 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8926 +/- ##
==========================================
- Coverage 93.84% 91.03% -2.82%
==========================================
Files 803 97 -706
Lines 80084 24366 -55718
Branches 24277 4505 -19772
==========================================
- Hits 75157 22182 -52975
+ Misses 3562 1954 -1608
+ Partials 1365 230 -1135
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-26 13:46:55 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
listNotificationDeliveriesForRecipient's badge-feed query ordered only bycreatedAt DESCwith nosecondary sort key.
evaluateAndEnqueueNotificationDeliveriesfans out one event to many recipients,stamping
createdAtvianowIso()per row, so several deliveries in one fan-out can tie on themillisecond timestamp — leaving display order (and the
limit-boundary row) engine-defined.Adds
desc(notificationDeliveries.id)as a deterministic secondary sort, matching the same fix classas
ai_review_cache's tiebreak.Test plan
createdAtreturn a stable, deterministic order (id-desc), using controlled ids so the query provably reorders rather than echoing insertion ordernpx vitest run test/unit/notifications-service.test.ts— 21/21 pass;tsc --noEmitcleanCloses #8895