mirror of
https://github.com/block/buzz.git
synced 2026-10-30 22:11:36 +00:00
Jude review #1: two failures in the DM resurface path. 1. Causal ordering. unhide_dm_recipients cleared every non-null hidden_at with no time comparison, so a recipient who re-hid the DM on another device after a message was accepted could have that newer choice wiped by a delayed resurface. Fence the clear on the triggering message's relay-assigned received_at (AND cm.hidden_at < message_received_at). hidden_at and received_at both come from the server clock (NOW()), so the comparison is against one monotonic authority. 2. Recoverability. Resurface only ran on the fresh-insert path, so a relay that committed the message but died before clearing hidden state never repaired it. Run the (idempotent) fenced resurface on the duplicate/ replay path too, keyed on the message's *original* received_at read back from the DB — so replay self-heals a missed transition without ever clobbering a newer re-hide. Tests: - buzz-db dm::tests (Postgres): older hide clears, newer re-hide survives, sender's own hide is never touched. Wired into the backend-integration CI job by name. - e2e_nostr_interop: replaying the identical message preserves a newer re-hide, proving the duplicate branch fences on the original receive time. Co-authored-by: Mongo <9cfd347903944d5b85aa6c93d2ab67381b978a92a31914bca69998968752a1d7@buzz.block.builderlab.xyz> Signed-off-by: kenny lopez <klopez4212@gmail.com>