feat(app): R4.3a the page reads the file chunk by chunk and streams it to the worker's sink

Measured at R4.3a (RUST.md §10.5): reading a file inside a WebKit worker costs about
180 MiB of content RSS whatever the method (arrayBuffer, stream, BYOB), 14 MiB on the
page; a page-side BYOB read feeding the worker's FileBytes gives 106 MiB on a 50 MiB file
against 272 in the worker and 76 for the TypeScript. Protocol v1 gains chunk / ack / end:
one 1 MiB buffer travels (transferred) and comes back after each push, so the page holds
one chunk and the worker's sink the only whole copy; no byte is parsed on the page. The
worker refuses an oversize announced before any chunk and a size that changes while
reading. Tests adapted (handler, client with a scripted ack, read failure on the page).
This commit is contained in:
bchanot committed 2026-10-18 18:57:55 +02:00
1 parent 49591c53cd
commit e659924ec0
12 files changed
+552 -272

No files matched your search

@@ -172,7 +172,7 @@ describe('callers stop on a failed core call', () => {
})
await screen.findByText(fr['home.import.error_core_unavailable']!)
// The worker read the file; the page's core, needed to open it, did not load.
expect(workers[0]!.posted.map((m) => m.type)).toEqual(['ready', 'result'])
expect(workers[0]!.sequence()).toEqual(['ready', 'result'])
expect(screen.queryByTestId('editor-route')).toBeNull()
expect(useReportStore.getState().report).toBeNull()
})