Skip to content

Send a download's progress once its forward index is stored - #152

Merged
alekswebnet merged 1 commit into
mainfrom
fix/early-boot-progress
Nov 7, 2026
Merged

alekswebnet merged 1 commit into
mainfrom
fix/early-boot-progress

Conversation

@alekswebnet

Copy link
Copy Markdown
Contributor

Closes #144.

On a host that ignores Range, the Jobs worker sent each progress report before it stored the snapshot of the entries found so far. The element asks the Service Worker whether the frame can boot on every report, and the worker answers from the stored snapshot. A report that overtook its write was therefore answered from the snapshot before, and nothing asked again until the next report, a chunk (256 kB) later. For a package under two chunks, the first report is also the last before the download ends, so the frame waited for all of it. That is the pack.test.ts failure CI's Firefox runner hits now and then (#75, #144).

What changes

  • IndexPublisher (src/jobs/index-publisher.ts) holds what downloadArchive did inline: storing the snapshot when the scanner has found more, one write at a time, a refused write dropped with one warning, and the final snapshot written at the end. Its report(send) sends a progress report once the write it waits for has landed or been refused. With nothing new to store, a report waits only for the writes already under way, so reports keep their order, and the last one still goes out before done.
  • jobs-worker.ts uses it, so its onProgress is one line.
  • design/serving.md: a sentence on the order, under An archive from a host that ignores Range is indexed as it downloads.

Checked

  • index-publisher.test.ts, four new unit tests with a store whose writes land when the test says:

    • a report waits for its write;
    • reports keep their order, one with nothing new included;
    • a refused write still lets the report out and warns once;
    • the final publish writes after every write before it.

    The first two fail when report sends first, as the old code did.

  • The issue's proof, end to end: with setForwardIndex delayed by 400 ms, pack.test.ts "attaches the parts while a download from a host without Range is under way" failed three times out of three with the old order, with the CI error ('probing', 'downloading', …(2)). With this change it passed three out of three. The delay was a one-off edit, reverted.

  • The player's suite in Chromium: 602 tests, unit and both browser projects. pack.test.ts in Firefox, five runs of 20 tests: all pass. CI runs the browser suite in Firefox and WebKit.

Release: a fix in the player's next minor, the one that moves the pin to pack 1.1.0.

On a host that ignores Range, the Jobs worker sent each progress report
before it stored the snapshot of the entries found so far. The element
asks whether the frame can boot on every report, and the Service Worker
answers from the stored snapshot, so a report that overtook its write was
answered from the one before, and the next report was a chunk away. For a
package under two chunks that meant the whole download.

The publishing moves into IndexPublisher, whose report() sends once the
write it waits for has landed or been refused, in order.

Closes #144.
@alekswebnet
alekswebnet merged commit b4ea8b2 into main Nov 7, 2026
9 checks passed
@alekswebnet
alekswebnet deleted the fix/early-boot-progress branch November 8, 2026 13:38
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.

Early boot without Range can wait for the whole download: progress is reported before its index is stored

1 participant