Skip to content

fix: ensure marked-as-Done notifications don’t unexpectedly resurface#790

Merged
dlvhdr merged 1 commit intodlvhdr:mainfrom
sideshowbarker:fix/done-store-timestamps
Mar 5, 2026
Merged

fix: ensure marked-as-Done notifications don’t unexpectedly resurface#790
dlvhdr merged 1 commit intodlvhdr:mainfrom
sideshowbarker:fix/done-store-timestamps

Conversation

@sideshowbarker
Copy link
Contributor

@sideshowbarker sideshowbarker commented Mar 5, 2026

Bug: Notifications resurface immediately after being marked as Done.

Cause: The markAsDone closure captured the notification pointer returned by GetCurrNotification(), which points into the Notifications slice. When multiple mark-as-Done operations run concurrently, the TaskFinishedMsg handler removes notifications from the slice via append — shifting elements, and causing the pointer to reference a different notification's data. That resulted in wrong UpdatedAt timestamps being stored in the Done store.

Fix: Capture UpdatedAt as a time.Time value (copied by value) before the closure — matching how notificationId is already captured.

Also increases the DoneStore pruning cutoff from 14 days to 90 days. GitHub can retain Done-marked notifications for much longer than the previously assumed ~1 week, so entries were being pruned on startup and then resurfacing.

@sideshowbarker sideshowbarker force-pushed the fix/done-store-timestamps branch 4 times, most recently from b388e47 to 65f89b5 Compare March 5, 2026 04:29
Bug: Notifications resurface immediately after being marked as Done.

Cause: The markAsDone closure captured the notification pointer returned by
GetCurrNotification(), which points into the Notifications slice. When
multiple mark-as-Done operations run concurrently, the TaskFinishedMsg
handler removes notifications from the slice via append — shifting
elements, and causing the pointer to reference a _different_ notification's
data. That resulted in wrong UpdatedAt timestamps being stored in the
Done store.

Fix: Capture UpdatedAt as a time.Time value (copied by value) _before_
the closure — matching how notificationId is already captured.

Also increase the DoneStore pruning cutoff from 14 days to 90 days.
GitHub can retain Done-marked notifications for much longer than the
previously assumed ~1 week, so entries were being pruned on startup
and then resurfacing.
@sideshowbarker sideshowbarker force-pushed the fix/done-store-timestamps branch from 65f89b5 to 75930f1 Compare March 5, 2026 04:32
Copy link
Owner

@dlvhdr dlvhdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very noice

@dlvhdr dlvhdr merged commit 29db1ce into dlvhdr:main Mar 5, 2026
3 checks passed
@sideshowbarker sideshowbarker deleted the fix/done-store-timestamps branch March 5, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants