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

chore(backup): improve backup export error handling [WPB-10575] #3257

Merged

Conversation

vitorhugods
Copy link
Member

@vitorhugods vitorhugods commented Jan 28, 2025

StoryWPB-10575 Cross Platform Backup: Write common backup / restore library


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

Follow-up on:

but for exporting.

Solutions

Encapsulate and catch failures during the exporting process. Either ZIP or IO Errors can happen at this stage.

Testing

Test Coverage

  • I have added automated test to this contribution

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.

@echoes-hq echoes-hq bot added the echoes: product-roadmap/feature Work contributing to adding a new feature as part of the product roadmap. label Jan 28, 2025
@vitorhugods vitorhugods force-pushed the refactor/backup/handle-exporting-errors branch from e07b61d to 2ccb508 Compare January 28, 2025 16:39
Copy link
Contributor

github-actions bot commented Jan 28, 2025

Test Results

3 379 tests   3 272 ✅  5m 30s ⏱️
  578 suites    107 💤
  578 files        0 ❌

Results for commit effdec9.

♻️ This comment has been updated with latest results.

@datadog-wireapp
Copy link

datadog-wireapp bot commented Jan 28, 2025

Datadog Report

Branch report: refactor/backup/handle-exporting-errors
Commit report: f0e8047
Test service: kalium-jvm

✅ 0 Failed, 3272 Passed, 107 Skipped, 37.97s Total Time

@vitorhugods vitorhugods force-pushed the refactor/backup/handle-exporting-errors branch from 2ccb508 to d208a25 Compare January 29, 2025 08:19
…ulation

Introduced `BackupExportResult` and `ExportResult` to encapsulate and represent export operation outcomes, including success and specific failure types (`IOError`, `ZipError`). Refactored relevant methods to use these types, added coroutine support annotations, and implemented error handling for zipping and I/O operations. Added unit tests to ensure correct error handling behavior.
@vitorhugods vitorhugods force-pushed the refactor/backup/handle-exporting-errors branch from d208a25 to effdec9 Compare January 29, 2025 08:34
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (epic/multiplatform-backup@a4e2968). Learn more about missing BASE report.

Additional details and impacted files
@@                     Coverage Diff                      @@
##             epic/multiplatform-backup    #3257   +/-   ##
============================================================
  Coverage                             ?   54.03%           
============================================================
  Files                                ?     1246           
  Lines                                ?    36152           
  Branches                             ?     3656           
============================================================
  Hits                                 ?    19534           
  Misses                               ?    15208           
  Partials                             ?     1410           

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 a4e2968...effdec9. Read the comment docs.

@vitorhugods vitorhugods merged commit d48cbb1 into epic/multiplatform-backup Jan 29, 2025
21 checks passed
@vitorhugods vitorhugods deleted the refactor/backup/handle-exporting-errors branch January 29, 2025 09:23
vitorhugods added a commit that referenced this pull request Jan 31, 2025
…ulation (#3257)

Introduced `BackupExportResult` and `ExportResult` to encapsulate and represent export operation outcomes, including success and specific failure types (`IOError`, `ZipError`). Refactored relevant methods to use these types, added coroutine support annotations, and implemented error handling for zipping and I/O operations. Added unit tests to ensure correct error handling behavior.
github-merge-queue bot pushed a commit that referenced this pull request Feb 7, 2025
* chore: create backup module (#3117)

This commit introduces a new cross-platform backup module to the project with support for iOS, Web, and Android. Additionally, it enables JavaScript multiplatform support in existing `kalium/network-model` and `kalium/data` projects.

* chore: create backup protobuf models (#3116)

* feat: add initial crossplatform backup serialization [WPB-10575] (#3121)

* feat: support other message types [WPB-10575] (#3122)

Co-authored-by: Yamil Medina <[email protected]>

* refactor(backup): make visibility modifier mandatory (#3153)

* chore(backup): add encrypted stream [WPB-10575] (#3154)

* chore(backup): read and write the backup header (#3159)

* feat(backup): support export and import of backups on Web, iOS and Android [WPB-10575] (#3228)

* refactor(backup): enhance error handling and test coverage (#3248)

Refactored the backup import process to improve error handling by introducing more granular failure types and modularized the logic for decrypting and unzipping archives. Added comprehensive test coverage, including tests for edge cases in decryption, parsing, and unzipping.

* chore(backup): improve backup export error handling and result encapsulation (#3257)

Introduced `BackupExportResult` and `ExportResult` to encapsulate and represent export operation outcomes, including success and specific failure types (`IOError`, `ZipError`). Refactored relevant methods to use these types, added coroutine support annotations, and implemented error handling for zipping and I/O operations. Added unit tests to ensure correct error handling behavior.

* feat(backup): support file peeking [WPB-10575] (#3261)

Introduced `peekBackup` and related methods to retrieve backup metadata such as version, encryption status, and original creator. Also added unit tests to validate behavior for various cases, including unsupported versions and mismatched user IDs.

* feat(backup): paginate different types of content (#3268)

Consolidated handling of paginated backup data into the new `BackupPage` concept to improve clarity and support pagination for users, conversations, and messages during import. Added tests to validate the refactored `BackupImportPager`.

* docs(backup): add multiplatform sample implementations and documentation (#3269)

Introduced examples showcasing `MPBackupImporter` and `MPBackupExporter` usage for different platforms. Updated documentation, README, and build configurations to support multiplatform samples, including JS and non-JS targets.

---------

Co-authored-by: Yamil Medina <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: product-roadmap/feature Work contributing to adding a new feature as part of the product roadmap. 👕 size: M type: chore 🧹
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants