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

fix: delete asset file when removing self-deleting msg [WPB-1807] 🍒 #3034

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 25, 2024

StoryWPB-1807 Self-deleting: Delete assets from internal storage once the timer runs out

This PR was automatically cherry-picked based on the following PR:

Original PR description:



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

Asset file is not removed from the storage once the self-deleting asset message timer runs out.

Causes (Optional)

Wrong order of actions:

  • the message is marked as deleted, which means that the content is cleared in db
  • attempt to send "deleted" messages
  • remove message completely from the db
  • try to remove the asset from the db and its file from the storage - at this point, because of the first step, the content of the message is already empty so the app doesn't know the id of the asset to remove and no file is being removed. Also, the app tries to remove the asset remotely by making a request which ends up with 403 error, probably because this asset belongs to someone other.

Solutions

Change the order of actions, so that now it will look like this:

  • get the content of the message
  • mark the message as deleted and clear the content from the db
  • use the retrieved content data from first step to remove asset, but only locally, together with deleting associated file from the storage
  • attempt to send "deleted" messages
  • remove message completely from the db
    Thanks to that, the asset file and asset data will be removed from the asset table right when the content of the message is being cleared and marked as deleted. Asset is being removed only locally, there's no need to make a request that will probably fail.
    Also, selectPendingEphemeralMessages is fixed to return only real pending messages, so messages that has yet not started (messages without end time) should be filtered out, to make sure that only messages that has been shown to the user are enqueued.

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Send a self-deleting message with asset, wait until that message disappears and check if "used storage" has changed.

Attachments (Optional)

Before After
self-deleting-remove-asset-before.mov
self-deleting-remove-asset-after.mov

PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

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.

@github-actions github-actions bot added cherry-pick PR is cherry-picking changes from another banch echoes: product-roadmap Work aligned with the customer-announced roadmap, targeting a specific release date. type: bug / fix 🐞 👕 size: M 🚨 Potential breaking changes labels Sep 25, 2024
Copy link

Copy link
Contributor Author

github-actions bot commented Sep 25, 2024

Test Results

3 203 tests  +1   3 096 ✅ +1   3m 43s ⏱️ -10s
  551 suites ±0     107 💤 ±0 
  551 files   ±0       0 ❌ ±0 

Results for commit 799f492. ± Comparison against base commit 3d4468b.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 94.59459% with 2 lines in your changes missing coverage. Please review.

Project coverage is 52.53%. Comparing base (3d4468b) to head (799f492).

Files with missing lines Patch % Lines
...ssage/ephemeral/EphemeralMessageDeletionHandler.kt 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3034   +/-   ##
========================================
  Coverage    52.52%   52.53%           
========================================
  Files         1301     1301           
  Lines        50043    50041    -2     
  Branches      4663     4664    +1     
========================================
+ Hits         26286    26289    +3     
+ Misses       21884    21880    -4     
+ Partials      1873     1872    -1     
Files with missing lines Coverage Δ
...eteEphemeralMessageForSelfUserAsReceiverUseCase.kt 94.11% <100.00%> (+8.61%) ⬆️
...ature/message/ephemeral/SelfDeletionEventLogger.kt 88.57% <100.00%> (+0.16%) ⬆️
...ssage/ephemeral/EphemeralMessageDeletionHandler.kt 76.81% <84.61%> (-1.05%) ⬇️

... and 3 files with indirect coverage changes


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 3d4468b...799f492. Read the comment docs.

@datadog-wireapp
Copy link

Datadog Report

Branch report: fix/delete-asset-when-removing-selfdeleting-msg-cherry-pick
Commit report: 43b71d7
Test service: kalium-jvm

✅ 0 Failed, 3096 Passed, 107 Skipped, 11.61s Total Time

@saleniuk saleniuk added this pull request to the merge queue Sep 25, 2024
Merged via the queue into develop with commit 873cf34 Sep 25, 2024
21 of 22 checks passed
@saleniuk saleniuk deleted the fix/delete-asset-when-removing-selfdeleting-msg-cherry-pick branch September 25, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick PR is cherry-picking changes from another banch echoes: product-roadmap Work aligned with the customer-announced roadmap, targeting a specific release date. 🚨 Potential breaking changes 👕 size: M type: bug / fix 🐞
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants