Repository navigation
improvement(file-parsers): parse spreadsheets on a worker thread - #9313
Conversation
XLSX.read is synchronous and blocks the event loop for the full parse (about 1.1-2s on 16-23 MB workbooks). Spreadsheet buffers going through parseBuffer now run on a bounded worker_threads pool (one worker) built from the same XlsxParser, with an in-process fallback for a missing or broken bundle, worker startup failure, or crash.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
[Medium impact] The latest changes appear safe to merge; no new actionable issues remain. SummaryMoves spreadsheet parsing to a single worker thread, with in-process parsing when the worker is unavailable.
|
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.
Turn on auto-fix | Re-trigger cubic
|
@greptile |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 9 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.
Turn on auto-fix | Re-trigger cubic
Summary
XLSX.readis synchronous, so every spreadsheet parse throughparseBufferblocked the event loop for the whole parse (1.1–2s on 16–23 MB workbooks on Bun)xlsx/xls/xlsm/xlsb/xltx/ods) now parse on aworker_threadspool running the sameXlsxParser; output is identicalArrayBufferand transferred, so the caller'sBufferis never detached; options cross without the signalsignal.reason(same value the in-process path throws)FileParserErrorwith code/message/cause name+message,ZipBombError,ArchiveIntegrityError), sogetFileParserErrorCodecallers see no changebuild:xlsx-worker(bun build --target=node, builtins only, ~0.8 MB) runs inbun run build; shipped via DockerfileCOPY(fails the image build if missing) plus anoutputFileTracingIncludesentry, resolved from cwd candidates like the isolated-vm workerresourceLimits, so the worker heap counts against the process exactly like an in-process parse; the bound is concurrency, not heap sizeType of Change
Testing
xlsx-worker-pool.test.tsbuilds the real bundle withbun run build:xlsx-workerand checks in-process parity (preview, complete, text-budget error, archive-guard rejection, corrupt ZIP), caller buffer intact, fallback for a missing bundle / a bundle that throws on load / a worker that exits mid-parse, abort of a running job (frees the slot of a spinning worker) and of a queued job. Each guard was reverted and its test went redparseBufferwithNODE_ENV=production: worker 66 ms gap (cold spawn included); bundle removed → one warn, in-process, same hash; bundle replaced with a throwing file → one warn, in-process, same hashlib/file-parsers/suite (316 tests),bun run lint, focused tsc on the new modules and test,check:source-conventions,check:utils,check:comment-hygiene,check:file-names,check:test-patterns,check:boundariesChecklist
test-auditauthoring gate)