Repository navigation
Conversation
Optional DEFLATE compression for the negotiated binary ScreenPatch
transport, plus the under-10%-of-full-frame measurement.
- id-core screen_codec: version-2 envelope {version: 2, compression,
payload} carrying raw-DEFLATE (RFC 1951) of the version-1 frame;
encode_view_patch_compressed emits it only when the complete
compressed frame is smaller, so small frames stay byte-identical
to version 1. Decoding is bounded by the 1 MiB frame limit in both
directions; unknown versions/compressions, truncated streams, and
oversized inflation fail closed. New deps flate2 (rust_backend)
and serde_bytes, both already in the lockfile, gated under the
world feature.
- Session: join gains screen_compress (contract revision 16); the
host sends version-2 frames only to sessions that offered it.
- Browser: decodeViewPatchAsync handles version 2 via
DecompressionStream('deflate'); the join offers screen_compress.
- Measurement (design Q2 option B): a repeatable test records
complete logical View payload bytes for a sparse redraw versus a
full snapshot at 80x24 and 200x60 and asserts the sparse patch
stays under 10% of the full frame, with patch/full-frame parity.
- Session test: a compressed resume patch arrives as a version-2
binary frame and applies to exactly the full-frame screen.
Refs #805
b"#" is a byte string (&[u8; 1]) while the else branch yields u8; the test target failed to compile (E0308). Use the b'#' byte literal.
…le (#805) The under-10% test failed at 80x24 (279/2487 bytes, 11.2%): a 29-cell status-line restyle is a dense change, and its minimum encoding already exceeds the bar (the 29-cell run alone is ~244 bytes against a 248-byte bar), so no encoder could meet it. The nominated typical case is a status count tick plus two scattered edits, which measures ~8% at 80x24.
Screen bounds are 120x50, so document_screen(200, 60) panics in from_cells; the 200x60 case could never run. 120x50 is the largest valid screen and the meaningful second size.
|
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 42 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 625106db12
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| try { | ||
| stream = new Blob([bytes as BlobPart]) | ||
| .stream() | ||
| .pipeThrough(new DecompressionStream("deflate")); |
There was a problem hiding this comment.
Decode the host's payload using raw DEFLATE
Whenever the host sends a compressed patch, encode_view_patch_compressed produces raw RFC 1951 bytes using Rust's DeflateEncoder, but DecompressionStream("deflate") expects a zlib-wrapped stream. Consequently, host-generated compressed patches fail decoding and cause the browser—which now always advertises screen_compress—to request full views instead of applying them. This mismatch is reproducible with the platform decompressor. Use "deflate-raw" for the negotiated format and test against a Rust-produced compressed fixture; the current TypeScript helper uses CompressionStream("deflate"), so its round-trip tests conceal the incompatibility.
Useful? React with 👍 / 👎.
Refs #805 — phase 4 does not complete the issue; protocol negotiation / cross-language parity remain.
What this slice does
Optional DEFLATE compression on the negotiated binary ScreenPatch transport, plus the <10%-of-full-frame measurement for sparse redraws:
pkgs/id/crates/id-core/src/screen_codec.rs— compressed (v2 binary) frame encode/decode; 7 new tests, includingsparse_redraws_measure_under_ten_percent_of_full_frameandcompressed_resume_patch_arrives_as_a_version_two_binary_frame.pkgs/id/crates/id-worlds/src/world_session/— wire the compressed patches through the session view path and resume tokens; new session tests.pkgs/id/web/src/screen-codec.ts(+ tests) andworld.ts— TS-side compressed codec parity; 7 new async tests inscreen-codec.test.ts.pkgs/id/contract/shell-contract.v1.json— contract bump for the v2 binary frame.Verification (remote dispatch, GitHub-hosted runners)
Rust — green:
cargo test -p id-core -p id-worlds@1f8c33512): id-core lib 548 passed / 1 ignored / 0 failed; id-worlds lib 954 passed / 0 failed; all integration suites green.cargo test -p id-core screen_codec@625106db1): success.Web — green:
bunx vitest run src/screen-codec.test.ts src/world-program.test.ts@625106db1): 2 test files passed, 14 tests passed / 0 failed (screen-codec 13, world-program 1).Note on #13337: the web suite segfaults at vitest startup in the standard fleet-build container (nix Bun 1.4.2; both forks and threads pools; also fails identically on unmodified main), so this run used the stock
node:22-bookwormcontainer with the official Bun 1.4.5 build, where the suite passes. The crash is environmental, not slice code — see #13337 for the tracking issue.{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-23T14:23:14Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": "/home/hatch/workspace/github-work/code-805", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/hatch/workspace/github-work/code-805", "repo": "developing-today/code", "branch": "xaltha/805-compression", "sha": "625106db12c735c5209118c838b0d0acd7ea233c" }, "auth_subject": "xaltha", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.