fix(notifications): rescue notification_deliveries rows stranded at pending by a failed enqueue - #9393
Conversation
…ending by a failed enqueue evaluateAndEnqueueNotificationDeliveries commits each fresh delivery row before enqueuing its notify-deliver job, so a rejected JOBS.send leaves the committed rows at pending. A client retry finds them already present (idempotent) and omits them, so no deliver job is ever re-sent and the notification stays invisible to the recipient until the 90-day retention sweep deletes it. Add a periodic sweep, mirroring sweepStrandedPendingClosures: a bounded lookback window, a grace period so an in-flight row is not mistaken for a lost one, and a minimum re-sweep interval so a row stuck for another reason is retried periodically rather than every tick. A new repository query lists pending rows within the window, the sweep re-enqueues notify-deliver for each and fails open on a DB read error, and it is wired into the periodic queue tick alongside the sibling repair scans.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9393 +/- ##
==========================================
+ Coverage 75.38% 76.15% +0.77%
==========================================
Files 275 278 +3
Lines 58023 60168 +2145
Branches 6181 6882 +701
==========================================
+ Hits 43739 45821 +2082
- Misses 14014 14023 +9
- Partials 270 324 +54
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-27 16:08:10 UTC
Review summary Nits — 4 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.
|
fix(notifications): rescue notification_deliveries rows stranded at pending by a failed enqueue
evaluateAndEnqueueNotificationDeliveries commits each fresh delivery row
before enqueuing its notify-deliver job, so a rejected JOBS.send leaves the
committed rows at pending. A client retry finds them already present
(idempotent) and omits them, so no deliver job is ever re-sent and the
notification stays invisible to the recipient until the 90-day retention
sweep deletes it.
Add a periodic sweep, mirroring sweepStrandedPendingClosures: a bounded
lookback window, a grace period so an in-flight row is not mistaken for a
lost one, and a minimum re-sweep interval so a row stuck for another reason
is retried periodically rather than every tick. A new repository query lists
pending rows within the window, the sweep re-enqueues notify-deliver for each
and fails open on a DB read error, and it is wired into the periodic queue
tick alongside the sibling repair scans.
Closes #9320
Validation
Verified locally on this branch before opening:
npm run typechecknpx turbo run build:tsc build:verifynpm run test:coverage— patch coverage 100.0% of changed lines