mirror of
https://github.com/block/buzz.git
synced 2026-11-28 12:12:04 +00:00
Follow-up to #9832, which derives the Active filter's activity from the channel list's own reads. Three cases could leave a channel marked known with activity that is too old or too new. Each now leaves it unknown, so it stays visible until the next list read re-reads it (the filter's existing fail-open path). - **A latest post deleted while offline, after the read marker moved past the deletion on another device.** The catch-up asked for deletions only after the read marker, so it never saw this one, and the channel kept the deleted post's time. The gap read, which already runs for a channel an Active section shows that has an activity gap, now also asks for deletions of each such channel's current latest post (`#e` plus `#h`, since the gap's start) and forgets a head they removed. With up to 64 such channels, those deletions are read in the gap read's own request. Past that, the gap posts are read and applied first, and the deletions are then read only for the channels whose latest post no gap post replaced, so a failed deletion read leaves only those channels unknown. When the read marker sits on the latest post, so the gap read is moot, the catch-up's deletion filter for that channel starts one second earlier instead, so a deletion in that post's second is seen. A deletion from that extra second only updates the Active filter's activity. ([review comment](https://github.com/block/buzz/pull/9832#issuecomment-7053648925)) - **A gap read whose one post is already deleted.** The gap read asks for the newest post in the gap (`limit: 1`). When the catch-up has just found that post deleted, an older post in the gap may survive, but the channel was marked covered. It now stays unknown. ([review comment](https://github.com/block/buzz/pull/9832#discussion_r4688526643)) - **A gap read whose signature checks throw.** The channels were marked covered with nothing recorded. They now stay unknown, as the catch-up already does when its own checks throw. ([review comment](https://github.com/block/buzz/pull/9832#discussion_r4688526649)) ### Validation - Added three steps to the journey test [Active filter activity survives rebuilds, read gaps, failed catch-ups and deletions](bc664ae8a9/mobile/test/features/channels/channels_provider_test.dart), one per case, plus a step that another post's deletion in the extra second leaves a page being saved current. Added [gap posts settle Active activity even when the head deletion read fails](55144f79be/mobile/test/features/channels/channels_provider_test.dart) for 65 gap channels, with every gap channel holding a cached head (two requests) and with two empty ones (one request). - Full-app run on an iOS 27 simulator signed in to a Builderlab community: channel list on launch, Active filter (7 days) collapsing each section to its active channels, opening a channel and back, background and resume, pull to refresh, and a cold relaunch with Active kept. All behaved as on main, with no error notice. The three changed paths need staged deletions and failures a live community can't produce, so only the journey test covers them. ### Regressions - **Network:** no new requests while a gap read's posts and the head ids fit in one request (128 channel values, so always up to 64 such channels). Past that, one more optional request per 128 channels, sent after the gap posts settle and only for the channels whose latest post no gap post replaced. The optional gap read, sent after the unread badges and only for channels an Active section shows with an activity gap, names their latest posts by id and returns only deletions of those posts. The unread catch-up's filters are unchanged, except that a shown channel whose latest post sits at the read marker asks for deletions from one second earlier. - **Unread state and saved pages:** unchanged for `h`-tagged deletions, including those from the extra second, which only update the Active filter's activity. A deletion without an `h` tag stamped in that extra second takes the ordinary unread path, as main already does for one a second later. For a reaction removal (what agents send when a turn ends), that republishes the list once, with no saved page or badge change. An untagged deletion of a post already observed would also reset that channel's unread catch-up cursor, so the next reconnect fetches its backlog again, but no shipped client sends one: desktop, mobile and the SDK all tag `h` on post deletions. - **Activity:** each change only turns a channel unknown, which keeps it visible in Active, never hidden. buzz-review-completed --------- Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>