Repository navigation
fix(notifications): match bigint notification ids in the listener - #103
Merged
Merged
Conversation
api migration 0233 (2026-08-03) widened notification.id to bigint, which pg returns as a string. The tick keys fetched rows by row.id and looks them up with the numeric ids from the NOTIFY payload, so nothing matches: every app notification is logged as "not found" and dropped. Normalize ids to numbers where rows are fetched. 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
The notifications listener drops every app notification. Prod logs show about 11k IDs a day under
tick: some notification IDs were not found in DB, and zeroProcessing N app notificationslines in 24h.The rows exist. I sampled 200 "missing" IDs from the logs and all 200 are in
notificationon the primary.Cause: api migration 0233 (
Fix notification ID sequence exhaustion, 2026-08-03) changednotification.idfromintegertobigint. node-postgres returnsbigintas a string. The tick buildsbyIdfromrow.id(string) and looks it up with IDs from the NOTIFY payload (json_build_object→ JS number), sobyId.get(id)is always undefined.Impact since the migration: app pushes are not sent for any type that goes through this listener (follows, reposts, saves, comments, tips, rewards, announcements and re-engagement campaigns). DMs use a separate path and are unaffected. Email digests read the DB directly and are unaffected by this bug.
Change
fetchNotificationsByIdsandgetNotificationByIdconvertidto a number. That restores the pre-migration shape for everything downstream. IDs are about 3.3e9, far below 2^53.Verification
I ran the tick's lookup against prod (read-only) on the 200 most recent notification IDs:
row.idas key)Number(row.id))tsc(only the existing unbuilt-workspace module errors), Prettier and eslint are clean. The one eslint warning is pre-existing on main.Rollout note
Merging auto-deploys and turns app pushes back on for all types at once. There is no backlog replay: NOTIFY IDs are in-memory, so only notifications created after deploy are sent. After deploy, expect
Processing N app notificationslines, and thenot foundwarnings should drop to roughly zero.🤖 Generated with Claude Code