HomePhabricator
Diffusion Comm 883e1ca1276d

[web][native] Fix retrying sending message when having device without keys

Description

[web][native] Fix retrying sending message when having device without keys

Summary:
https://linear.app/comm/issue/ENG-10141/retrying-message-on-prod-cause-it-sending-multiple-times

To reproduce have a device in a "broken" state (? instead of web/mobile icon). Send a message. It will
fail with log "Keys missing for device ..." but the message will be delivered. Showing that the delivery failed
is ok (we couldn't deliver to the broken device) but after retrying the message will be delivered again and
the other user will see duplicated messages.

The exception is thrown in function returned from useInputStateContainerSendTextMessage. failedOutboundP2PMessageIDs is
set correctly here. But then the exception is caught in sendTextMessageAction and re-thrown without setting failedOutboundP2PMessageIDs.
failedOutboundP2PMessageIDs is then used do determine how we should resend the message.
Therefore setting failedOutboundP2PMessageIDs in sendTextMessageAction fixes the bug.

Test Plan:

  1. Have a "broken" device (by logging out with v1 flow or by failing to connect the device)
  2. Send a message and retry.
  3. Verify the other user has no duplicated messages.

Reviewers: tomek, kamil

Reviewed By: kamil

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D14289

Details

Provenance
angelikaAuthored on Feb 4 2025, 8:47 AM
Reviewer
kamil
Differential Revision
D14289: [web][native] Fix retrying sending message when having device without keys
Parents
rCOMMa38a6e8d4ff7: [native_rust_library] avoid triggering backup upload before cleanup
Branches
Loading...
Tags
Loading...