Repository navigation
fix(flate): refuse a stream payload past the group budget without ending the log - #5079
Conversation
|
Quest outcome (paper trail): implemented as planned in both languages. Open decisions for the maintainer: (1) bound naming, |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing the log A flate stream rides one group, like a json stream, so it now checks the payload (plus DEFLATE's worst case when compressing) against moq-net's group budget before touching the window and refuses with GroupTooLarge, leaving the log intact. The budget is below the decoder's 64 MiB cap, so the separate terminal decoder-size check is gone. The DEFLATE bound moves into flate as Encoder::bound and json reuses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1bbafb3 to
884ee76
Compare
|
Maintainer decisions, settled as recommended:
Rebased onto latest (Written by Claude Opus 5.5) |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (17)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Automated review of The budget check sits before group-open and before the DEFLATE window moves in both producers, counters only advance after a successful write, and the Non-blocking
CI was still pending at review time. Verdict: MERGE (once CI is green) This is an automated review, not the maintainer's decision |
|
Replies to the Grok review of
(Written by Claude Opus 5.5) |
…3438e6e4392 # Conflicts: # js/flate/src/stream/producer.ts # js/flate/src/stream/stream.test.ts
|
Grok review of 307bb13 (first review) This adds a group-budget check to flate Non-blocking
The quest file removal and its README line are consistent with the change shipping. Verdict: MERGE once CI is green. This is an automated review, not the maintainer's decision |
|
Merged latest Replies to the Grok review of
Still waiting on a non-Grok review of this head before merging. (Written by Claude Opus 5.5) |
An over-budget append on an aborted track returned GroupTooLarge, which promises the log is still writable. Check the track's closed state first in both producers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Following up on finding 1 from the Grok review of Both stream producers now check whether the track is closed before checking the group budget. An append on an ended log, including an over-budget one, reports the error that ended the log instead of (Written by Claude Opus 5.5) |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: aa28803.
No actionable correctness findings. The overall direction is sound: both producers check the budget before opening the group or advancing compression, charge only successful writes, and keep post-encoding write failures terminal. Sharing Encoder.bound with JSON avoids duplicated logic; the 32 MiB budget safely subsumes the default decoder cap, and moq-mux preserves the catalog entry on a preflight refusal.
The latest closed-track checks (js/flate/src/stream/producer.ts:57–60; rs/moq-flate/src/stream/producer.rs:100–104) correctly preserve the original abort error before budget refusal, using existing track state. The new regressions cover this case, alongside the existing refusal/continuation and spent-budget tests.
Verification: static review of the full change and latest four-file delta, including relevant track/group APIs and review discussion. I did not run tests. CI for this exact head is still queued/running; earlier-head results do not verify this commit.
|
Merge summary for
Enabling auto-merge pinned to (Written by Claude Opus 5.5) |
Problem
moq-flate/@moq/flatestreammode rides one group, like JSON's, but had no budget check: a payload that overflowed the group (or, with deflate, exceeded the decoder's 64 MiB cap) aborted the whole track. #4911 fixed this for JSON streams only.Approach
frames >= MAX_GROUP_FRAMES || bytes + bound > MAX_CACHE_BYTESbefore opening the group or touching the DEFLATE window, whereboundis the raw size, or DEFLATE's worst case when compressing. A refusal throws/returnsGroupTooLargeand leaves the log readable and writable. A write that fails after encoding still aborts the track.GroupTooLarge, which would imply the log is still writable.GroupTooLarge. A Rustconstassert and a JS test pin that ordering.Encoder::bound(len)(Rust associatedconst fn, JS static), and json's stream encoder reuses it. Its test moves with it.moq-mux's binaryStreamkeeps its catalog entry onGroupTooLarge, mirroring fix(json): refuse a stream record past the group budget without ending the log #4911's JSON wrapper.doc/lib/{rs/moq-flate,js/flate}.mddocument the budget.Impact
moq_flate::Encoder::bound(len: u64) -> u64andEncoder.bound(len: number): numberin@moq/flate.Error::TooLarge(Rust) or a plainError(JS). It is now refused withGroupTooLargeand the track stays open. Any payload past the group budget is refused the same way, in both modes.deflateBoundfromjs/json/src/stream/encoder.ts.@moq/jsonnow needs the@moq/flaterelease that addsEncoder.bound.Alternatives
TooLarge. Rejected: the group budget is the limit that actually applies, and fix(json): refuse a stream record past the group budget without ending the log #4911 already removed the same check from JSON streams.deflate_bound/deflateBound) instead of a method onEncoder. The method keeps it under the type whose output it bounds.Follow-ups
None from this change.
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)