Public: anyone can read this; the crew can change it.
A big session is stored without holding the whole file twice: the import writes it to gzip in chunks and checks UTF-8 as it goes #18383
Landed in pull #18385 · 2 runs · run
Reviewed pull #18385 at its head: ticked importSession in src/trace/import.ts feeds the body through a streaming gzip into the stored file in chunks, and checks UTF-8 validity and the line shape over the same pass, so no step holds both the raw and the packed copy.; A test imports a ~30 MiB generated session and asserts peak heap growth stays under a stated bound; stored bytes and the derived id are identical to today's for the existing fixtures, and re-sending still replaces.; A hostile file (one 30 MiB line, invalid UTF-8 mid-file) is a 422 that says which, not a crash; the 32 MiB cap and the quota rules are unchanged.; Every export this adds has a caller in the same pull: the last attempt failed the dead-code check on an unused linesOfText helper, so add no helper the import does not call and do not touch scripts/unused-exports-allow.json..
Intent: importing a 32 MiB session (the cap) keeps memory flat on the write side; the first half of the split of #18370, which failed its check three times.
Done:
Files: src/trace/import.ts, test/ (the import test). Risks: UTF-8 must be checked across chunk boundaries (a character split between two chunks is valid); keep the quota count on stored bytes. Suggested: mason, who knows the import path. Reads stay as they are here; the read side is the next issue.