Repository navigation
Conversation
The discovery repair rewrote all three relay-signed events (39000, 39001, 39002) when any was missing. Clients read kind:39000's created_at as a chat's creation time, so a repaired chat jumped to the top of a list sorted by recency without a new message. The repair now reads which kinds are missing and publishes only those. Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost> Signed-off-by: Tom Brow <tomb@block.xyz>
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
PostgreSQL 17 can pull the lateral aggregate's NOT EXISTS up into an anti join that walks the channel's history on the channel/time index. A scalar subquery tested IS NULL keeps one idx_events_addressable probe per kind under custom and generic plans. Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost> Signed-off-by: Tom Brow <tomb@block.xyz>
🔐 Codex Security Review
Review SummaryOverall Risk: NONE
FindingsNo concrete security, correctness, or reliability findings were identified. Notes
Generated by Codex Security Review | |
Follow-up to #9805. Its repair republishes all three relay-signed discovery events (kinds 39000, 39001, 39002) whenever any one is missing. Mobile reads the kind:39000
created_atas a chat's creation time, so a repaired chat with its metadata still in place jumped to the top of a list sorted by Recent, without a new message.Now both repair paths (the DM reopen and the startup sweep) publish only the kinds the channel lacks:
idx_events_addressable.emit_group_discovery_kindsemits a given subset of the three events.emit_group_discovery_eventscalls it with all three, so every other caller is unchanged. A kind outside the three is an error.This covers only the repair path. Mobile still sorts by the kind:39000 event's
created_atrather than itscreated_attag (NIP-CL), so a metadata edit or membership change, or a repair where 39000 itself is missing, still moves a chat in Recent; reading the tag is a separate mobile change.Validation
reopening_a_dm_republishes_its_missing_rosternow also checks that repairing a DM's lost roster leaves its live kind:39000 and kind:39001 events as they were (same event ids).the_sweep_republishes_recent_channels_missing_any_discovery_kindnow also checks that a channel missing only its admins and roster keeps its live kind:39000.Regressions
idx_events_addressable, as before (see Query plan); a healthy reopen is still one indexed read and no writes. The sweep's per-channel probe now aggregates the missing kinds instead of stopping at the first, which costs nothing extra for healthy channels and at most two more index probes for a broken one; over a 366-day window the sweep reads about 3 to 7% more buffers than the parent, depending on how many channels lack all three kinds.ttl_deadlinetag, which messages extend without republishing 39000. The second needs only one failed emission, but it is the same stale deadline every healthy ephemeral channel already shows after a message; the relay still archives on the real deadline.IS NULLrather thanNOT EXISTS, which PostgreSQL 17 can turn into an anti join that walks the channel's whole history; the scalar form keeps oneidx_events_addressableprobe per kind under custom and generic plans.BUZZ_RECONCILE_CHANNELS,reconcile_channel_events) sharesrepublish_missing_discovery, so it also republishes only missing kinds now.emit_group_discovery_events(creation, metadata edits, membership changes, operator reconcile) still publish all three.Rollout
No flag: the change only narrows which events a repair writes, with no schema or data change.
kinds=[39002]and that the DM's kind:39000 and kind:39001 event ids are unchanged.buzz_channel_discovery_republished_total{path}andbuzz_channel_discovery_repair_failures_totalagainst the Republish channel discovery events a failed emission left missing #9805 baseline, and thechannel_missing_discoveryspan latency on DM reopen.