Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: allow returning values on commit retry [WPB-3694] #2609

Merged

Conversation

vitorhugods
Copy link
Member

@vitorhugods vitorhugods commented Mar 11, 2024


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

When producing commits inside MLSConversationRepository and calling retryOnCommitFailure, there's no easy way to get values linked to the produced commit.

For example, in the next PR I want to enable creating MLS groups with partial success, and return the non-added users.
But inside establishMLSGroup, I can't keep track of the success the operation had during the retries.

Cause

The retryOnCommitFailure only supports returning Unit on success.

Solutions

Note

This PR should have no behaviour changes at all, but will allow customisation of some MLS pipelines in the near future. For the tickets: [WPB-3694][WPB-6646][WPB-6643]

Refactor the retryOnCommitFailure function (renamed to produceAndSendCommitWithRetryAndResult), so it allows returning a produced value if the commit succeeds.
To reduce code change in this PR, also created a produceAndSendCommitWithRetry for Unit results.

The function now takes the responsibility of sending the generated commit, instead of relying on the callers to do so. It also conveniently provides a MLSClient scope for the callers, as this is the way to obtain a CommitBundle.

Testing

N/A
MLSConversationRepository is already covered with tests regarding the retry pipeline. Kudos to @typfel


PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

This should no behaviour changes at all, but will allow customisation of some MLS pipelines in the near future.
This refactors the `retryOnCommitFailure` function (renamed to `produceAndSendCommitWithRetryAndResult`), so it allows returning a produced value if the commit succeeds.
The function now takes the responsibility of sending the generated commit, instead of relying on the callers to do so.
It also conveniently provides a MLSClient for the callers, as this is the way to obtain a `CommitBundle`.
Copy link
Contributor

github-actions bot commented Mar 11, 2024

Test Results

2 832 tests   2 703 ✔️  24s ⏱️
   485 suites     129 💤
   485 files           0

Results for commit fb7583f.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 83.78378% with 18 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (release/candidate@eb46fe3). Click here to learn what that means.

Additional details and impacted files
@@                 Coverage Diff                  @@
##             release/candidate    #2609   +/-   ##
====================================================
  Coverage                     ?   58.36%           
  Complexity                   ?        7           
====================================================
  Files                        ?     1177           
  Lines                        ?    46064           
  Branches                     ?     4365           
====================================================
  Hits                         ?    26887           
  Misses                       ?    17220           
  Partials                     ?     1957           
Files Coverage Δ
...gic/data/conversation/MLSConversationRepository.kt 81.37% <83.78%> (ø)

Continue to review full report in Codecov by Sentry.

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

@vitorhugods vitorhugods enabled auto-merge (squash) March 11, 2024 13:13
@datadog-wireapp
Copy link

Datadog Report

Branch report: refactor/allow-returning-values-on-commit-retry
Commit report: 5f57044
Test service: kalium-jvm

✅ 0 Failed, 2825 Passed, 123 Skipped, 9m 12.04s Wall Time

@vitorhugods vitorhugods merged commit 390b880 into release/candidate Mar 11, 2024
17 checks passed
@vitorhugods vitorhugods deleted the refactor/allow-returning-values-on-commit-retry branch March 11, 2024 13:47
vitorhugods added a commit that referenced this pull request Mar 13, 2024
This should cause no changes in behaviour at all, but will allow customisation of some MLS pipelines in the near future.
This refactors the `retryOnCommitFailure` function (renamed to `produceAndSendCommitWithRetryAndResult`), so it allows returning a produced value if the commit succeeds.
The function now takes the responsibility of sending the generated commit, instead of relying on the callers to do so.
It also conveniently provides a MLSClient for the callers, as this is the way to obtain a `CommitBundle`.

(cherry picked from commit 390b880)
@echoes-hq echoes-hq bot added the echoes: bugs Technical or functional defects in the product label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants