Skip to content

test: Work around test_sync_broadcast_and_send_message flakiness#7967

Merged
iequidoo merged 2 commits intomainfrom
iequidoo/test_sync_broadcast_and_send_message
Mar 10, 2026
Merged

test: Work around test_sync_broadcast_and_send_message flakiness#7967
iequidoo merged 2 commits intomainfrom
iequidoo/test_sync_broadcast_and_send_message

Conversation

@iequidoo
Copy link
Collaborator

The test sometimes fails because of wrong message ordering for bob (https://github.com/chatmail/core/actions/runs/22780794012/job/66085797963):

     [...]
     Waiting for the device of alice@example.org to reply… [NOTICED][INFO]
    <Msg#2010🔒:  (Contact#Contact#2001): hi [FRESH]
     Msg#2008🔒:  (Contact#Contact#2001): You joined the channel. [FRESH][INFO]
    >Msg#2010🔒:  (Contact#Contact#2001): hi [FRESH]
     Msg#2011🔒:  (Contact#Contact#2001): Member Me removed by alice@example.org. [FRESH][INFO]

This adds SystemTime::shift(Duration::from_secs(1)) as a workaround.

The test sometimes fails because of wrong message ordering for bob:
     [...]
     Waiting for the device of alice@example.org to reply… [NOTICED][INFO]
    <Msg#2010🔒:  (Contact#Contact#2001): hi [FRESH]
     Msg#2008🔒:  (Contact#Contact#2001): You joined the channel. [FRESH][INFO]
    >Msg#2010🔒:  (Contact#Contact#2001): hi [FRESH]
     Msg#2011🔒:  (Contact#Contact#2001): Member Me removed by alice@example.org. [FRESH][INFO]

This adds `SystemTime::shift(Duration::from_secs(1))` as a workaround.
@iequidoo iequidoo requested a review from Hocuri March 10, 2026 02:53
Comment on lines +4704 to +4705
// alice2's smeared clock may be behind alice's one, so "hi" from alice2 may appear before "You
// joined the channel." for bob. Work around this for now.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// alice2's smeared clock may be behind alice's one, so "hi" from alice2 may appear before "You
// joined the channel." for bob. Work around this for now.
// alice2's smeared clock may be behind alice's one, so "hi" from alice2 may appear before "You
// joined the channel." for bob.

There are no plans to introduce a replacement for timesmearing, so, this is probably not just "for now".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't suggest to replace timesmearing completely, but the 2nd device could at least adjust "Date" in its messages if it received an outgoing message with greater "Date". This also should be limited to MAX_SECONDS_TO_LEND_FROM_FUTURE (30s currently). Also this way we don't leak the fact that messages are sent from different devices

Co-authored-by: Hocuri <hocuri@gmx.de>
@iequidoo iequidoo merged commit f85c625 into main Mar 10, 2026
18 checks passed
@iequidoo iequidoo deleted the iequidoo/test_sync_broadcast_and_send_message branch March 10, 2026 13:00
@iequidoo
Copy link
Collaborator Author

iequidoo commented Mar 10, 2026

One second didn't help: https://github.com/chatmail/core/actions/runs/22903698439/job/66456520063
I'm going to debug it.
...
It's not good that our log records don't have timestamps. Also encrypted message headers would be helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants