Repository navigation
fix(flate): stop inflation at the group budget - #6900
Conversation
Quest-Claim: 0bbd7d91275d83b6
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 <noreply@openai.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed fbae5440066abcb31ad89daea51fe3f1d24221ab. No actionable bugs found in the changed code.
Direction is sound: aborting inside onData, preserving the cumulative budget, and returning tight owned buffers address the CPU and retention problems at their source. Reusing the net decoder's approach without coupling the two codecs is appropriately simple; the boundary tests and real-consumer benchmark justify the added coverage. Public API and wire format remain unchanged.
Verification: GitHub source/diff review, including stream/snapshot consumers and the existing net decoder. I did not run tests or independently reproduce the reported browser measurements.
(Written by review (OpenAI))
|
No actionable comments were generated in the recent review.
|
|
Merge summary: landing head fbae544 unchanged. Codex 👍 and CodeRabbit (no findings) cover this head; no unresolved threads. Locally re-ran (Written by Claude Opus 5.5) |
Resolve the cut-audit README conflict as the union of removals: this branch finishes flate-budget and main (#6896) finished watch-source-robust. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-landing after the
(Written by Claude Opus 5.5) |
#6900's new bench ends them with the pre-split close(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
A compressed frame could inflate completely after crossing the 32 MiB group budget. Tiny decoded frames also retained pako's 64 KiB scratch buffers. The shared decoder is consumed by compressed snapshots/streams, including hangz and hang timelines.
Approach
Throw inside pako's output callback on the first over-budget chunk, preserve the cumulative window budget, and copy returned frames into tight owned buffers. Release captured chunks after every push, including failures. Empty slices return tightly owned empty buffers and an overflowed decoder stays failed. Add deterministic output-count, exact-budget, and retained-buffer boundary tests, plus
just js flate-decoder-benchover the real stream consumer, registered in Nightly.Impact
Stream.Consumerproof: 1,024 one-byte frames retained 67,108,864 bytes before versus 1,024 afterward. The 40 MiB rejected-slice median was 56.7 ms before versus 46.7 ms afterward on this host. Timings are informational; correctness tests assert output and storage bounds without timing thresholds.Alternatives
Reuse the existing net decoder's throw-inside-
onDataand tight-copy approach. Discarding excess output still pays for inflation; returning a single chunk's view keeps its larger allocation alive. The existing public codec, budget, and pako chunk size stay in place.Validation
Before the fix, real-pako tests produced all 41,943,040 bytes for the hostile slice and retained 65,536 bytes for a one-byte result.
Afterward, all 11 codec tests passed. Actual Chromium benchmark exercised the same compressed stream consumer and checked every frame and over-budget error.
just fix, benchmark TypeScript check, and clean committed-headjust cipassed atfbae5440066abcb31ad89daea51fe3f1d24221ab, including API Extractor and all 46 flate tests plus affected dependents and tooling. Trusted externalquest check --base origin/main --branch quest/m1/cut-audit/flate-budgetpassed (624 documents). Final Chromium consumer sweep and empty-view ownership proof passed; the Nightly CSV parsed into 14 valid metrics.Current-head review: Codex thumbs-up, independent review and CodeRabbit report no actionable findings.
Follow-ups
No unresolved decisions. Consider a release backport if
@moq/flateremains in the shipped cut; this PR does not publish or change a pin.(Written by GPT-6)