Adding a new transport and making it primary can lead to missing messages on second device
- Dominant language
- Rust
- Stars
- 929
- Forks
- 143
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 59
Description
Steps to reproduce:
- add a new relay on one device, and set it as default, while the other device is offline
- Send a message to a contact, and get an answer
- -> When the other device gets online, it won't download any of the messages that arrived in the meantime
The problem is that [the second transport doesn't fetch existing messages](https://github.com/chatmail/core/pull/7753#issuecomment-3866478128).
Possible solutions are:
1. Always fetch all messages when adding a transport.
- Pro: Simple and easy
- Con: If there are a lot of messages on the server already, then all of them will be downloaded after logging in, potentially wasting a lot of mobile data. This would be mostly fine, though, because we don't recommend using existing accounts.
2. The first device sends `uid_next` in the Transports sync message so that other devices fetch the same set of messages. Not as simple as the first solution, but probably not too complex.
3. Do nothing code-wise, _maybe_ advise users not to immediately switch transports
Iff solution 2. doesn't turn out to be more complex than expected, I would prefer it.
cc @link2xt @iequidoo
Contributor guide
Research direction
Start by reviewing the second transport's existing-message fetch path and the Transports sync message, using the discussion on PR #7753 as context. Compare the proposed uid_next synchronization with fetching existing messages when a transport is added. Done means reproducing the offline-device scenario and confirming that messages received meanwhile are downloaded without unnecessary message retrieval.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- distributed-systems, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100