Skip to content

fix(sync): avoid invalid MLS reset state - #4301

Draft
MohamadJaara wants to merge 2 commits into
developfrom
mo/fix-mls-reset-event-failures
Draft

fix(sync): avoid invalid MLS reset state#4301
MohamadJaara wants to merge 2 commits into
developfrom
mo/fix-mls-reset-event-failures

Conversation

@MohamadJaara

@MohamadJaara MohamadJaara commented Jul 14, 2026

Copy link
Copy Markdown
Member

Intent

Avoid persisting an incorrect MLS reset state when the new group cannot be inspected.

Root cause

The reset handler converted a failed established-group check to false. That made an unavailable or failed check indistinguishable from a confirmed non-established group, so the conversation could be written as PENDING_AFTER_RESET even though the real group state was unknown.

The established-group path also read the epoch directly instead of using the repository's failure-aware wrapper.

Reproduction

  1. Deliver an MLSReset event.
  2. Make the established-group check fail.
  3. Observe the failure become false.
  4. Observe the handler attempt to persist the new group as pending.

Fix

The handler now stops the reset state transition when either the established-group check or the new-group epoch lookup fails. Epoch lookup uses the repository wrapper, and handling failures are logged inside the handler.

Leaving the old group remains best-effort because a replay may find it already absent. The receiver's existing acknowledgement behavior is unchanged; these failures are not newly propagated to its caller.

Regression coverage verifies that established-group and epoch lookup failures do not update the conversation state, while the established and pending success paths still do.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Test Results

0 tests   - 5 871   0 ✅  - 5 730   0s ⏱️ - 4m 25s
0 suites  -   889   0 💤  -   141 
0 files    -   889   0 ❌ ±    0 

Results for commit dd1a5be. ± Comparison against base commit d57f18f.

♻️ This comment has been updated with latest results.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.31%. Comparing base (d57f18f) to head (a22b279).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #4301   +/-   ##
==========================================
  Coverage      61.30%   61.31%           
  Complexity      4022     4022           
==========================================
  Files           2163     2163           
  Lines          69467    69463    -4     
  Branches        6901     6900    -1     
==========================================
- Hits           42590    42588    -2     
+ Misses         24114    24112    -2     
  Partials        2763     2763           
Files with missing lines Coverage Δ
...m/logic/sync/receiver/ConversationEventReceiver.kt 86.44% <100.00%> (+4.47%) ⬆️
...r/conversation/MLSResetConversationEventHandler.kt 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d57f18f...a22b279. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branch${GITHUB_HEAD_REF}
Testbedubuntu-latest

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymicroseconds (µs)
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInFiles📈 view plot
⚠️ NO THRESHOLD
913.01 µs
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInMemory📈 view plot
⚠️ NO THRESHOLD
569,702.81 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.inboxPagingDeepPageBenchmark📈 view plot
⚠️ NO THRESHOLD
135,170.36 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.inboxPagingFirstPageBenchmark📈 view plot
⚠️ NO THRESHOLD
129,861.15 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.localMarkAsReadBenchmark📈 view plot
⚠️ NO THRESHOLD
3,579.36 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.messagePagingDeepPageBenchmark📈 view plot
⚠️ NO THRESHOLD
38,204.58 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.messagePagingFirstPageBenchmark📈 view plot
⚠️ NO THRESHOLD
22,459.99 µs
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.messageInsertionBenchmark📈 view plot
⚠️ NO THRESHOLD
1,385,926.75 µs
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.queryMessagesBenchmark📈 view plot
⚠️ NO THRESHOLD
21,375.45 µs
🐰 View full continuous benchmarking report in Bencher

@sonarqubecloud

Copy link
Copy Markdown

@MohamadJaara MohamadJaara changed the title fix(sync): propagate MLS reset event failures fix(sync): avoid invalid MLS reset state Jul 14, 2026
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