Skip to content

fix(downloader): validate partial download responses and sizes - #386

Merged
rtuszik merged 2 commits into
mainfrom
fix-range-resume
Sep 15, 2026
Merged

rtuszik merged 2 commits into
mainfrom
fix-range-resume

Conversation

@rtuszik

@rtuszik rtuszik commented Sep 15, 2026

Copy link
Copy Markdown
Owner

closes #376

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d352e20c-e98f-4da4-8ddc-c6ba7216c8c8

📥 Commits

Reviewing files that changed from the base of the PR and between e13fdc8 and a4d4ca9.

📒 Files selected for processing (2)
  • src/downloader.py
  • tests/test_downloader.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/downloader.py
  • tests/test_downloader.py

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The downloader now validates partial response headers and received sizes. It handles 416 resume responses by clearing state and retrying from byte zero. Tests cover valid resume responses, invalid ranges, oversized bodies, and retry limits.

Changes

Downloader resume validation and retry handling

Layer / File(s) Summary
Response range and size validation
src/downloader.py, tests/test_downloader.py
206 responses require valid case-insensitive Content-Range and matching Content-Length values. Negative lengths, oversized chunks, and incomplete final sizes are rejected. Tests cover invalid headers and oversized responses.
Resume status and retry handling
src/downloader.py, tests/test_downloader.py
416 responses clear download state and trigger retry handling. Unexpected statuses are rejected. 200 responses restart resumed downloads. Tests cover 200 and 206 responses and retry limits.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to a4d4c

No concrete merge-blocking risk is identified in the supplied evidence.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the main change: validation of partial download responses and file sizes in the downloader.
Description check ✅ Passed The description references issue #376, which relates to the downloader validation changes. This is sufficient for the lenient description check.
Linked Issues check ✅ Passed Issue #376 requires resumed downloads from the saved offset, no duplicate appended data, enforcement of the planned file size, and handling of invalid range responses. src/downloader.py validates pa…
Out of Scope Changes check ✅ Passed The changes are limited to download resume and response-size validation in src/downloader.py, with related automated tests in tests/test_downloader.py. The changes directly support issue #376. No …

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report
FileStmtsMissCoverMissing
src
   downloader.py2601993%97–98, 205, 232–233, 250, 263–274, 277–278, 317, 380
   importer.py57296%19, 30
   index.py103199%145
   process_manager.py2541395%155–156, 207–208, 232, 274–275, 284–286, 357–359
   update.py131298%93, 172
src/jsonl
   decompressor.py5340%5–7
   downloader.py311455%14, 18, 23, 25, 32–46
src/utils
   config.py55395%71–73
   regions.py105892%407, 420, 428, 432, 435, 448, 459, 474
   validate_config.py50492%33, 35, 41–42
TOTAL12806995% 

Tests Skipped Failures Errors Time
291 0 💤 0 ❌ 0 🔥 1.781s ⏱️

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fbb58428-603e-4e1b-88f1-7da0cbef99d7

📥 Commits

Reviewing files that changed from the base of the PR and between 15c8c62 and e13fdc8.

📒 Files selected for processing (2)
  • src/downloader.py
  • tests/test_downloader.py

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.

Comment thread src/downloader.py Outdated
@rtuszik
rtuszik merged commit 52856fc into main Sep 15, 2026
9 checks passed
@rtuszik
rtuszik deleted the fix-range-resume branch September 15, 2026 20:58
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.

[BUG] Resumed partial download exceeds planned filesize

1 participant