Skip to content

Conversation

@tylerjroach
Copy link
Contributor

  • PR title and description conform to Pull Request guidelines.

Issue #, if available:

Description of changes:
Our integration tests occasionally failed with the downloaded file not always matching the expected original. Through logging and file inspections, I was able to determine that in a rapid pause/resume scenario, the DownloadWorker that is cancelled on pause, may still write buffered data to the downloaded file. The new DownloadWorker may have already begun, setting an offset for download that was the file.length at the time. This value may end up being wrong if the previous worker flushes its last bits of data before cancelling. This would result in a section of the file that ends up duplicating contents.

This PR ensures that no buffered data is written to the file once the pause has been initiated.

How did you test these changes?
(Please add a line here how the changes were tested)

Documentation update required?

  • No
  • Yes (Please include a PR link for the documentation update)

General Checklist

  • Added Unit Tests
  • Added Integration Tests
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Ensure commit message has the appropriate scope (e.g fix(storage): message, feat(auth): message, chore(all): message)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tylerjroach tylerjroach requested a review from a team as a code owner November 7, 2025 20:44
@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

❌ Patch coverage is 28.57143% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.77%. Comparing base (8b2ef91) to head (82c7600).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3156   +/-   ##
=======================================
  Coverage   54.77%   54.77%           
=======================================
  Files        1046     1047    +1     
  Lines       31242    31251    +9     
  Branches     4671     4673    +2     
=======================================
+ Hits        17113    17118    +5     
- Misses      12323    12325    +2     
- Partials     1806     1808    +2     
🚀 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.

@mattcreaser
Copy link
Member

Should we also change the ExistingWorkPolicy to REPLACE?

@tylerjroach
Copy link
Contributor Author

Should we also change the ExistingWorkPolicy to REPLACE?

I didn't see any behavioral difference when testing. I'm guessing this is because we manually cancel the task. Otherwise, it still had the same issue.

@tylerjroach tylerjroach merged commit e54f435 into main Nov 11, 2025
16 of 17 checks passed
@tylerjroach tylerjroach deleted the tjroach/fix-download-accuracy branch November 11, 2025 14:53
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