Skip to content

fix(runtime): resume interrupted downloads - #2452

Open
tarikermis wants to merge 2 commits into
voidzero-dev:mainfrom
tarikermis:fix/2449-resume-node-download
Open

fix(runtime): resume interrupted downloads#2452
tarikermis wants to merge 2 commits into
voidzero-dev:mainfrom
tarikermis:fix/2449-resume-node-download

Conversation

@tarikermis

Copy link
Copy Markdown
Contributor

Addresses #2449

A failed response body currently leaves partial bytes on disk, but the next retry recreates the archive and starts from zero.

This keeps those bytes and asks the server for the remaining range. It only appends after validating an exact 206 Partial Content response and its Content-Range. If a server ignores Range and returns a full 200 response, the partial file is truncated before the new body is written. Invalid partial responses fall back to a plain full request.

One limitation worth calling out: nodejs.org currently answers these Range requests with a full 200, so Vite+ still restarts safely there. Mirrors that honor byte ranges can resume. The reporter's profile-specific failure was also caused by an interrupted 0.2.6 to 0.2.9 upgrade, which left current on 0.2.6. That recovery is being verified separately in the issue.

Tests cover:

  • a real truncated connection followed by a valid ranged retry
  • a server that ignores Range and returns 200
  • an inconsistent 206 response falling back safely
  • Content-Range parsing and bounds

Checked with:

  • cargo test -p vp_js_runtime
  • cargo clippy -p vp_js_runtime --all-targets -- -D warnings

Best Regards, Tarik

@netlify

netlify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 4a1b2d9
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a80c299b20d3f0008d1892b
😎 Deploy Preview https://deploy-preview-2452--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@tarikermis tarikermis mentioned this pull request Aug 14, 2026
4 tasks
@tarikermis
tarikermis marked this pull request as ready for review August 14, 2026 10:51
@fengmk2

fengmk2 commented Aug 15, 2026

Copy link
Copy Markdown
Member

@codex review

@fengmk2 fengmk2 self-assigned this Aug 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 269d64dafa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vp_js_runtime/src/download.rs Outdated
@tarikermis
tarikermis force-pushed the fix/2449-resume-node-download branch from f00c20e to 4a1b2d9 Compare August 15, 2026 19:48
@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: create-e2e Run `vp create` e2e tests test: sfw labels Aug 16, 2026
let ranged = client
.get(url)
.timeout(timeout)
.header(reqwest::header::RANGE, format!("bytes={resume_from}-"))

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.

Should we also use If-Range here with the ETag (or Last-Modified) from the original response?

Otherwise, if the resource changes between attempts, the server can return a valid 206 for the new representation, and we'll append it to bytes from the old one.

If-Range is designed for this case: if the representation has changed, the server returns a full 200, and our existing restart path can handle it safely.

@fengmk2 fengmk2 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.

@tarikermis Thanks! LGTM

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

Labels

test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: sfw

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants