How long is left, now that the numbers to say it exist - #286
Merged
Conversation
A rate answers "is anything happening"; on a connection where a cold boot takes five minutes the question underneath it is "how long", and the loader could not answer that until it knew both halves. It does now: the manifest's byte sizes say what each name weighs, and the store tracks how much of each in-flight fetch has landed, so `bytesLeft` is the honest remainder — sizes minus what has actually arrived, not a file count scaled by an average. The caption becomes "800 KB/s · 6.0 MB of 95.5 MB · ~3 min left" once the BOOTFILE has been read and there is a prefetch list to weigh. Not before: an estimate made before the disc has been asked what a launch needs is a guess wearing a number. The total is what has come down plus what is still owed, so it grows if the boot asks for something the plan did not name, which is the honest direction for a total to move. The estimate is rounded coarsely — five seconds under a minute and a half, whole minutes above — because the rate it divides is a three-second average and the raw figure jitters between ticks; a countdown that flickers reads as broken even when every value it shows is true. It says nothing at all when the answer is "any moment now" (under three seconds) or when it exceeds three hours, which is not an estimate but a symptom. Checked against a throttled connection: at an 800 KB/s cap the line reads "~3 min left" with 89 MB to go and counts down to "~85 s left" at 70 MB, which is the arithmetic. A full boot at 4 MB/s still reaches 100% with no page errors, and drops the estimate on the way out rather than showing "~0 s". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
A rate answers is anything happening. On a connection where a cold boot takes five minutes, the question underneath it is how long — and the loader could not answer that until it knew both halves. It does now: the manifest's byte sizes say what each name weighs, and the store tracks how much of each in-flight fetch has landed.
How the remainder is worked out
DustFiles.bytesLeft(names)— sizes minus what has actually arrived, skipping what is already in hand and counting only the unfetched part of what is in flight. Not a file count scaled by an average. A name the manifest does not size contributes nothing, which makes the estimate optimistic rather than invented; on this disc it sizes everything.It appears only once the BOOTFILE has been read and there is a prefetch list to weigh — an estimate made before the disc has been asked what a launch needs is a guess wearing a number. The total shown is what has come down plus what is still owed, so it grows if the boot asks for something the plan did not name. That is the honest direction for a total to move.
Why it is rounded so coarsely
Five seconds under a minute and a half, whole minutes above. The rate it divides is a three-second average, so the raw figure jitters by a second or two between ticks, and a countdown that flickers reads as broken even when every value it shows is true. The tilde is doing real work: it is an estimate from the last three seconds of a connection that is free to change its mind.
It says nothing at all when the answer is "any moment now" (under 3 s) or when it exceeds three hours — that is not an estimate, it is a symptom.
Measured
At an 800 KB/s cap:
~3 min leftwith 89 MB to go, counting down to~85 s leftat 70 MB remaining — which is the arithmetic (70 MB ÷ 800 KB/s ≈ 90 s). A full boot at 4 MB/s reaches 100% with no page errors and drops the estimate on the way out rather than showing "~0 s".tsc --noEmitclean ·npm test534/534.🤖 Generated with Claude Code