Skip to content

fix(id/web): validate frames and chunk_bytes in world upload/compile socket handlers (#5034) - #5041

Merged
dezren39 merged 1 commit into
mainfrom
queue/8635-5034-world-frame-validation
Nov 3, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/8635-5034-world-frame-validation

Conversation

@dezren39

@dezren39 dezren39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

fix(id/web): validate frames and chunk_bytes in world upload/compile socket handlers (#5034)

The module-upload and Roc-compile socket handlers in pkgs/id/web/src/world.ts cast JSON.parse straight to WorldFrame and read frame.type unguarded: a null frame threw uncaught, number/string/array frames were silently ignored and hung the flow, and a fractional or string chunk_bytes corrupted the chunk stream (fractional or string install_chunk offsets the server's usize offsets cannot accept).

  • Both handlers now mirror the main receive() guard in the same file: parse to unknown, require isRecord + string type, otherwise set the existing "invalid upload/compile response" error status and close the socket.
  • chunk_bytes is accepted only as a finite integer (Number.isInteger) within the existing 1..=6144 range; anything else takes the existing "invalid module chunk size" path.
  • world-contract.test.ts: FakeSocket.deliverRaw plus tests covering null / number / string / array frames and fractional + string chunk_bytes (upload handler) and a non-object frame (compile handler).

Verification (laptop, worktree at origin/main d496214):

  • bunx vitest run src/world-contract.test.ts — 23 passed
  • bunx vitest run (full pkgs/id/web suite) — 632 passed, 9 skipped, 0 failed
  • bunx tsc --noEmit — clean

Queue task 8635.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 3, 2026 17:30
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T17:30:59.820626Z
We couldn’t complete this review. Comment @codex review to try again.
c661e5f PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8d45de03-0b0d-4fec-a28e-d0567530a858
Commits

Reviewing files that changed from the base of the PR and between 8f3a6cc and c661e5f.

Files selected for processing: 2
  • pkgs/id/web/src/world-contract.test.ts
  • pkgs/id/web/src/world.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@dezren39

dezren39 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Codex disposition (task 8635): the Codex code review on c661e5f failed on Codex usage limits (see the Codex summary comment above: "You have reached your Codex usage limits for code reviews"). Verified fresh this shift: PR #5041 has zero Codex review threads and zero inline review comments — no findings were delivered, so there is nothing undispositioned to fix or rebut. CodeRabbit was rate-limited/skipped (NEUTRAL). Proceeding under the standing merge criteria: diff is +70/−5 across 2 files (world.ts guard mirroring receive()'s isRecord pattern + Number.isInteger chunk_bytes check; world-contract tests cover null/number/string/array frames and fractional/string chunk_bytes for the upload handler, non-object frames for the compile handler); laptop verification from the opening shift stands (world-contract 23/23, full web suite 632 passed / 9 skipped, tsc clean). The production line-limit check has been QUEUED since 17:31Z in the fleet-wide Actions runner stall; the diff is 75 changed lines, verified manually against the 2500-line limit.

@dezren39
dezren39 merged commit 7de65a8 into main Nov 3, 2026
2 checks passed
@dezren39
dezren39 deleted the queue/8635-5034-world-frame-validation branch November 3, 2026 17:59
@dezren39
dezren39 restored the queue/8635-5034-world-frame-validation branch November 8, 2026 04:26
@dezren39
dezren39 deleted the queue/8635-5034-world-frame-validation branch November 8, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant