Skip to content

fix(drive): store files in Conversation-scoped directories instead of a flat directory (WPB-27627) - #5139

Open
ohassine wants to merge 4 commits into
developfrom
conversation-scoped-storage-and-stale-file-detection-for-Cells-downloads
Open

fix(drive): store files in Conversation-scoped directories instead of a flat directory (WPB-27627)#5139
ohassine wants to merge 4 commits into
developfrom
conversation-scoped-storage-and-stale-file-detection-for-Cells-downloads

Conversation

@ohassine

@ohassine ohassine commented Aug 6, 2026

Copy link
Copy Markdown
Member

https://wearezeta.atlassian.net/browse/WPB-27627


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

All downloaded Cells files were stored flat in a single directory. Files from different conversations with the same name would collide.

Solutions

  • Conversation-scoped directories — files are now stored under //filename instead of a flat directory, preventing name collisions across conversations. Falls back to the file's own UUID if no conversation ID is available.
  • Removed FileNameResolver, no longer needed; the scoped subdirectory eliminates the need for (1), (2) suffix disambiguation.

Needs releases with:

  • GitHub link to other pull request

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.

Notes (Optional)

Specify here any other facts that you think are important for this issue.

Attachments (Optional)

Attachments like images, videos, etc. (drag and drop in the text box)


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.

…d-storage-and-stale-file-detection-for-Cells-downloads

# Conflicts:
#	kalium
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@ohassine looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (develop) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

develop This PR
3787a70e8f2d68b5a03ace5af0c3099ced6e5e06 26a90de96ba916431828c4d4c7aa15719f7924dc

Is this intentional?

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.76%. Comparing base (4227a16) to head (5b11a16).

Files with missing lines Patch % Lines
...com/wire/android/feature/cells/ui/CellViewModel.kt 0.00% 0 Missing and 1 partial ⚠️
...oid/feature/cells/ui/OpenFileDownloadController.kt 75.00% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (77.77%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5139      +/-   ##
===========================================
+ Coverage    50.52%   50.76%   +0.24%     
===========================================
  Files          671      670       -1     
  Lines        24604    24591      -13     
  Branches      3832     3832              
===========================================
+ Hits         12430    12484      +54     
+ Misses       11029    10948      -81     
- Partials      1145     1159      +14     
Files with missing lines Coverage Δ
.../feature/cells/ui/OfflineFileDownloadController.kt 88.60% <100.00%> (+78.60%) ⬆️
...com/wire/android/feature/cells/ui/CellViewModel.kt 48.53% <0.00%> (-0.27%) ⬇️
...oid/feature/cells/ui/OpenFileDownloadController.kt 83.87% <75.00%> (-1.85%) ⬇️

... and 2 files 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 4227a16...5b11a16. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ohassine ohassine changed the title fix: conversation-scoped storage and stale file detection for Cells downloads (WPB-27627) fix(drive): store files in Conversation-scoped directories instead of a flat directory (WPB-27627) Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Test Results

2 239 tests  +14   2 239 ✅ +14   1m 55s ⏱️ +8s
  241 suites ± 0       0 💤 ± 0 
  241 files   ± 0       0 ❌ ± 0 

Results for commit 5b11a16. ± Comparison against base commit 4227a16.

This pull request removes 5 and adds 19 tests. Note that renamed tests count towards both.
com.wire.android.feature.cells.ui.OpenFileDownloadControllerTest ‑ givenFileWithLocalPath_whenStartCalled_thenFileOpenedImmediatelyWithoutDownload()
com.wire.android.feature.cells.util.FileNameResolverTest ‑ given_file_does_not_existWhen_getUniqueFile_calledThen_returns_original_file_name()
com.wire.android.feature.cells.util.FileNameResolverTest ‑ given_file_existsWhen_getUniqueFile_calledThen_returns_file_name_with_1_suffix()
com.wire.android.feature.cells.util.FileNameResolverTest ‑ given_file_without_extension_existsWhen_getUniqueFile_calledThen_returns_file_name_with_1_suffix()
com.wire.android.feature.cells.util.FileNameResolverTest ‑ given_multiple_conflicting_files_existWhen_getUniqueFile_calledThen_returns_file_name_with_next_available_index()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenActiveDownload_whenCancelCalled_thenOnSuccessNotInvoked()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenActiveDownload_whenCancelCalled_thenProgressCleared()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenDownloadFailure_whenStartCalled_thenOnErrorCallbackInvoked()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenDownloadFailure_whenStartCalled_thenProgressCleared()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenDownloadSuccess_whenStartCalled_thenOnSuccessCallbackInvoked()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenDownloadSuccess_whenStartCalled_thenPathRecordedInSharedCache()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenDownloadSuccess_whenStartCalled_thenProgressCleared()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenDownloadSuccess_whenStartCalled_thenSaveOfflineFileCalled()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenFileWithConversationId_whenDownloadSucceeds_thenFileStoredInConversationDirectory()
com.wire.android.feature.cells.ui.OfflineFileDownloadControllerTest ‑ givenFileWithExistingLocalPath_whenFileDeletedFromDisk_thenDownloadStarted()
…

@MohamadJaara MohamadJaara left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Android changes are not part of this ticket.
The ticket is about downloading to a .part file and renaming it only when the download is complete.
This PR changes where files are stored and removes numbered filenames. That is a different problem and should be handled in another ticket or PR.
It may also overwrite files with the same name in one conversation.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants