Page MenuHomePhabricator

Fix an issue where paginating notifications could fail a GROUP BY test
ClosedPublic

Authored by epriestley on Feb 26 2021, 6:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 3, 10:56 AM
Unknown Object (File)
Wed, Jun 3, 10:56 AM
Unknown Object (File)
Mon, Jun 1, 4:56 PM
Unknown Object (File)
Apr 16 2026, 1:51 AM
Unknown Object (File)
Apr 7 2026, 8:37 AM
Unknown Object (File)
Apr 7 2026, 8:33 AM
Unknown Object (File)
Apr 1 2026, 1:33 PM
Unknown Object (File)
Mar 30 2026, 2:49 PM
Subscribers
None

Details

Summary

Ref T13623. When paginating notifications, we may currently construct a query which:

  • loads from non-unique rows; and
  • returns multiple results.

In particular, chronologicalKey isn't unique across the whole table (only for a given viewer). We can get away with this because no user-facing view of notifications is truly "every notification for every viewer" today.

One fix would be to implicitly force the paging query to include withUserPHIDs(viewerPHID), but puruse a slightly more general fix:

  • Load only unique stories.
  • Explictly limit the pagination subquery to one result.
Test Plan
  • Set page size to 1, inserted duplicate notifications of all stories for another user, clicked "Next", got the GROUP BY error.
  • Applied the "only load unique stories" part of the change, got a "expected one row" error instead.
  • Applied the "limit 1" part of the change, got a second page of notifications.

Diff Detail

Repository
rP Phabricator
Branch
notif1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 25173
Build 34742: Run Core Tests
Build 34741: arc lint + arc unit