fix(update): stream binary update with progress and stall timeout#43
Merged
Conversation
A bare fetch() with no timeout hung forever on a stalled connection, with no error surfaced and no progress shown. Stream to disk with a live progress readout, abort on a 30s stall, and stage the swap in the target's own directory to avoid a cross-filesystem EXDEV rename.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
noorm update(binary install path) streamed the ~70MB release binary with a barefetch()— no timeout — so a stalled connection hung the process forever with no error and no output. Replaced with a streaming download that shows live progress and aborts on a 30s stall.EXDEVin the atomic swap: the temp file was written toos.tmpdir()andrename()d onto~/.local/bin, which throws across volumes on macOS. It now stages in the target's own directory.update:progressevents; the CLI rendersDownloading X / Y MB (Z%)on a TTY.What this solves
A user's
noorm updatesat on "Installing..." for 2+ minutes with no feedback and no way to tell a slow download from a dead one. The real asset downloads in ~1.4s; the hang was an unbounded fetch with no progress. Now it either shows progress, completes, or fails fast with a clear reason.Tests
New
tests/core/update/updater.test.tsdrives the real streaming path against a live local HTTP server (no fetch/fs mocks): full-body stream + executable bit, monotonic progress reaching the total, a stall that aborts in bounded time (reproduces the reported hang), and a 404 surfacing its status.