Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions js/net/src/flate/codec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,11 @@ test("final blocks, malformed input, and a decoder already failed are refused",
expect(() => decoder.frame(new Uint8Array(64).fill(0xff), 64)).toThrow();
expect(() => decoder.frame(new Uint8Array(), 0)).toThrow(/already failed/);
});

test("incompressible input stays within the worst-case bound, across stored-block boundaries", () => {
const encoder = new Encoder();
for (const size of [1, 4095, 4096, 16383, 16384, 16385, 65536, 100_003]) {
const payload = crypto.getRandomValues(new Uint8Array(size));
expect(encoder.frame(payload).length).toBeLessThanOrEqual(Encoder.bound(size));
}
});
12 changes: 5 additions & 7 deletions js/net/src/group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,22 +535,20 @@ test("a plain frame has no size cap, while a compressed one keeps its whole-fram
compressed.finish();
});

// Quarantined: flaky under load, see /quest/m0/test-flakes-2/compressed-frame-cap.md
test.skip("a compressed frame is refused unless its worst-case slice fits a peer's frame cap", async () => {
// The bound's soundness for incompressible input lives in flate/codec.test.ts; deflating 32 MiB of
// noise here would cost seconds under load.
Comment thread
kixelated marked this conversation as resolved.
Resolved
test("a compressed frame is refused unless its worst-case slice fits a peer's frame cap", async () => {
const MAX = 32 * 1024 * 1024;
let largest = MAX;
while (!encodable(largest)) largest--;
const compressed = new Producer(0n);
hooks.bindGroupCompression(compressed, true);
const reader = compressed.consume();
// High-entropy input expands under DEFLATE, so even the cap itself may not encode within it.
// Refused by size alone, even though zeros would compress far below the cap.
expect(() => compressed.writeFrame({ payload: new Uint8Array(largest + 1) })).toThrow(FrameTooLarge);
expect(() => compressed.createFrame({ size: largest + 1 })).toThrow(FrameTooLarge);
const payload = new Uint8Array(largest);
for (let i = 0; i < largest; i += 65536) crypto.getRandomValues(payload.subarray(i, i + 65536));
compressed.writeFrame({ payload });
compressed.writeFrame({ payload: new Uint8Array(largest) });
const read = await hooks.readGroupFrame(reader, true);
expect(read?.frame.payload.byteLength).toBeGreaterThan(largest);
expect(read?.frame.payload.byteLength).toBeLessThanOrEqual(MAX);
compressed.finish();

Expand Down
1 change: 0 additions & 1 deletion quest/m0/test-flakes-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ Public API: none. Wire: none.
- [Fallback playback](/quest/m0/test-flakes-2/ietf22-fallback.md) - a browser viewer follows a fallback within the media lane's bound without dropping its session
- [js/net's bandwidth sampling test holds up under load](/quest/m0/test-flakes-2/bandwidth-sampling.md) - the sampling test counts ticks without racing the mocked clock, and its `test.skip` is removed
- [bench/relay.test.py's stream-transport test gets a port free for TCP and UDP](/quest/m0/test-flakes-2/relay-port-pair.md) - the test binds TCP and UDP to one number free in both, so parallel checks can't collide with it
- [js/net's compressed-frame cap test holds up under load](/quest/m0/test-flakes-2/compressed-frame-cap.md) - the cap is proven without a 32 MiB payload, and its `test.skip` is removed
- [js/net's lite-07 re-dropped re-offer test holds up under load](/quest/m0/test-flakes-2/redropped-reoffer.md) - update 3 is ordered before the re-offer opens by an event, not a yield count, and its `test.skip` is removed
- [moq-net's random-mesh withdrawal tests fit the gate](/quest/m0/test-flakes-2/mesh-withdraw-runtime.md) - the 200-seed mesh tests cost seconds of CPU, and their `#[ignore]` is removed
- [js/net's datagram session-close-after-end test holds up under load](/quest/m0/test-flakes-2/datagram-close-end.md) - the abort is ordered after the end by an event the client observes, and its `test.skip` is removed
27 changes: 0 additions & 27 deletions quest/m0/test-flakes-2/compressed-frame-cap.md

This file was deleted.