Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

/live closes any text frame over 4096 bytes with 1009, counted by the relay because Bun's ws ignores maxPayload #130

Closed opened this
Closed without merging

/live now counts each message's bytes with frameBytes before parsing it. Anything over 4096 bytes closes the socket with 1009. The check is in lobby.ts, and the maxPayload option stays in place, but Bun's ws ignores it.

Notes

stopped closed without shipping deploy da0a864

opened this

/live now counts each message's bytes with frameBytes before parsing it. Anything over 4096 bytes closes the socket with 1009. The check is in lobby.ts, and the maxPayload option stays in place, but Bun's ws ignores it. The src/lobby tests pass, including the new one. I read the tsc --noEmit output as clean, but it also printed a "bun is unable to write files to tempdir" error, so I can't say the type check fully ran.

I didn't take code from pull #25's branch, which isn't in this clone. frameBytes and TOO_BIG_CLOSE were already in src/frame-limit.ts, so I used them directly.

The new test in lobby.test.ts pins the boundary:

  • 4096 bytes: a frame of exactly 4096 bytes is accepted and handled (it gets the normal "history before which line?" reply).
  • 4097 bytes: a 4097-byte frame closes with 1009 and is not handled.
  • Bytes, not characters: a frame of é padding (two bytes each) is over 4096 bytes but under 4096 characters, and it also closes with 1009.

Closes #123

2 earlier comments
commented

/live now counts each message's bytes with frameBytes before parsing it. Anything over 4096 bytes closes the socket with 1009. The check is in lobby.ts, and the maxPayload option stays in place, but Bun's ws ignores it. The src/lobby tests pass, including the new one. I read the tsc --noEmit output as clean, but it also printed a "bun is unable to write files to tempdir" error, so I can't say the type check fully ran.

I didn't take code from pull #25's branch, which isn't in this clone. frameBytes and TOO_BIG_CLOSE were already in src/frame-limit.ts, so I used them directly.

The new test in lobby.test.ts pins the boundary:

  • 4096 bytes: a frame of exactly 4096 bytes is accepted and handled (it gets the normal "history before which line?" reply).
  • 4097 bytes: a 4097-byte frame closes with 1009 and is not handled.
  • Bytes, not characters: a frame of é padding (two bytes each) is over 4096 bytes but under 4096 characters, and it also closes with 1009.
commented

/live now counts each message's bytes with frameBytes before parsing, and closes the socket with 1009 when a message is over 4096 bytes. The src/lobby tests pass. The tsc --noEmit output looked clean, but it also printed a "bun is unable to write files to tempdir" error, so I can't say the type check fully ran.

The check on #130 failed because forge.json had check.limits but no check.run. I added check.run: it installs dependencies, runs bun x tsc --noEmit, then bun test in Software/so101. I haven't run that exact command here, and I haven't seen the forge's check pass on this push yet.

What to look at

  • Software/so101/src/lobby.ts: the size check sits in the /live message handler. It uses frameBytes and TOO_BIG_CLOSE from src/frame-limit.ts, which were already in the repo. maxPayload stays on the server, but Bun's ws ignores it.
  • Software/so101/src/lobby.test.ts: a new test pins the boundary.

- A frame of exactly 4096 bytes is accepted and handled. - A 4097-byte frame closes with 1009 and isn't handled. - A frame of two-byte é padding that is over 4096 bytes but under 4096 characters also closes with 1009, so the limit is in bytes, not characters.

🤖 Generated with Claude Code

commented

Declined: the failing check can't be fixed from this branch. The error is main: forge.json: check.run is required. The "main:" prefix means the forge is validating forge.json as it stands on main, and main declares check.limits but no check.run. Run log: https://forge.open-platform.sh/trevato/arm/runs/01m5e189xext6x0n9rar5k1ja5

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs