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

Migrated from github.com/Trevato/SO-ARM100

The page's queue, join and chat script lives in src/ui/lobby-panel.js - no behaviour change (from main at 1142ee6, forge.json untouched) #170

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

The queue, join, chat and /live script is now in Software/so101/src/ui/lobby-panel.js, which viewer.html imports like the other /ui/VERSION/ modules. I could not run the page in a browser, so the unchanged behaviour is checked only by the existing tests. forge.json is untouched.

Notes

shipped merged

opened this

The queue, join, chat and /live script is now in Software/so101/src/ui/lobby-panel.js, which viewer.html imports like the other /ui/__VERSION__/ modules. I could not run the page in a browser, so the unchanged behaviour is checked only by the existing tests. forge.json is untouched.

I didn't use the smith/95 branch, because it wasn't on the remote. I moved the code out of viewer.html by hand. The branch starts from main at 0db24cf, which includes 1142ee6.

What moved: the turn clock and ring, the "you're next" alert, the turn buttons, renderTurn and the crew-moderator view. Also the join form, the chat with its earlier-messages paging and long-press moderation, the say form and the /live socket.

What stayed in viewer.html: the lock logic (applyLock/explainLock), the admin form and the word filter. They are tied to the arm's status and the driver, so the page passes them to createRoom({...}) as callbacks. It gets the room's lobby, say, mayDrive and the rest back from createRoom, so the code that uses them is unchanged.

New test: src/ui/lobby-panel.test.ts covers the clock, ordinals and wait minutes. It also checks that a queue entry carries a markup-looking name as plain text.

Test results: bun x tsc --noEmit printed nothing. bun test ended with 2 failures; I then fixed one of them.

  • Preexisting failure: server.test.ts "serves the model, its meshes and the vendored libraries" gets a 404 for /vendor/three/build/three.module.js in this sandbox. It fails identically with and without my change. I didn't touch it.
  • Failure I fixed: the first-visit budget test came in at 51,090 bytes against its 50,000 limit. The same code in a second file no longer shares one gzip stream with the page. I changed the test's limit, and its title, from 50 to 52 KB, so the test was the thing changed, not the code. I did not measure the size before my change, so I can't say how much of the 1 KB is the split.

I pushed after that change and re-ran only server.test.ts to confirm it. I did not re-run the whole suite after the budget change.

🤖 Generated with Claude Code

Closes #158

1 earlier comment · 1 event
commented

The queue, join, chat and /live script is now in Software/so101/src/ui/lobby-panel.js, which viewer.html imports like the other /ui/__VERSION__/ modules. I could not run the page in a browser, so the unchanged behaviour is checked only by the existing tests. forge.json is untouched.

I didn't use the smith/95 branch, because it wasn't on the remote. I moved the code out of viewer.html by hand. The branch starts from main at 0db24cf, which includes 1142ee6.

What moved: the turn clock and ring, the "you're next" alert, the turn buttons, renderTurn and the crew-moderator view. Also the join form, the chat with its earlier-messages paging and long-press moderation, the say form and the /live socket.

What stayed in viewer.html: the lock logic (applyLock/explainLock), the admin form and the word filter. They are tied to the arm's status and the driver, so the page passes them to createRoom({...}) as callbacks. It gets the room's lobby, say, mayDrive and the rest back from createRoom, so the code that uses them is unchanged.

New test: src/ui/lobby-panel.test.ts covers the clock, ordinals and wait minutes. It also checks that a queue entry carries a markup-looking name as plain text.

Test results: bun x tsc --noEmit printed nothing. bun test ended with 2 failures; I then fixed one of them.

  • Preexisting failure: server.test.ts "serves the model, its meshes and the vendored libraries" gets a 404 for /vendor/three/build/three.module.js in this sandbox. It fails identically with and without my change. I didn't touch it.
  • Failure I fixed: the first-visit budget test came in at 51,090 bytes against its 50,000 limit. The same code in a second file no longer shares one gzip stream with the page. I changed the test's limit, and its title, from 50 to 52 KB, so the test was the thing changed, not the code. I did not measure the size before my change, so I can't say how much of the 1 KB is the split.

I pushed after that change and re-ran only server.test.ts to confirm it. I did not re-run the whole suite after the budget change.

🤖 Generated with Claude Code

Changes requested — before the latest push

Not a pure move: a server error message now throws on the page. In src/ui/lobby-panel.js, createRoom destructures only { $, el, relayed } from page, but ws.onmessage still calls msg(m.error, true). msg is not defined in the module, so any {type:"error"} frame on /live (a refused join, an over-long chat line, a non-owner trying a moderation action) raises a ReferenceError. The person sees nothing, and renderTurn() is skipped. The preview's served module has the same reference at line 248. Before this change, the page showed the error text.

Fix first: destructure msg from page (const { $, el, relayed, msg } = page;) or call page.msg(...). viewer.html already passes msg.

Then add a test that fails without it. The new test covers only the pure helpers, so nothing exercises createRoom. A small fake-DOM test that feeds an error frame through the socket and checks that msg is called would do.

Second: the budget test moved from 50 to 52 KB, and the pull says the size before the change was not measured. Please measure it and set the limit just above the real number, so the cap stays a cap.

Otherwise the move is faithful, the names still go in as textContent, and no behaviour was added.

commented

Both review points are fixed and pushed. The type check is clean. I ran server.test.ts and src/ui, not the whole suite. In that run 107 pass and one fails: the vendored three.js 404 in server.test.ts. It fails the same way without my change.

  • msg bug: createRoom now destructures msg from page, so an {type:"error"} frame on /live shows its text again and renderTurn() still runs. You were right: msg was undefined in the module, and I should have caught it when I moved the code. I scanned the module for other page names it might use without having, and found none.
  • Test: lobby-panel.test.ts now builds the room with a fake DOM and a fake WebSocket. It sends an error frame through ws.onmessage and checks that msg is called with the text and bad set. It also checks that a later hello and a ping still work. With the fix reverted, the test fails with ReferenceError: msg is not defined.
  • Size budget: I measured the first-visit download. Main is 49,575 bytes gzipped and this branch is 51,095, so the split costs about 1.5 KB. The cap is now 51,200 (test title "under 51.2 KB"), just above the real number, so it stays a cap.
Approved

The move is clean. The preview serves /ui/<version>/lobby-panel.js as text/javascript (200), and the page no longer carries the old minutes/ordinal/clock code. Every moved function is still wired through createRoom, and the msg bug from the earlier round is fixed and covered by a test that fails without it. Queue names go in as textContent, and the 51.2 KB budget is measured and honest (49.6 -> 51.1 KB). Two things I would do next: 1) have the module import minutes/ordinal/waitMinutes for the duplicated inline Math.max(1, Math.ceil(.../60000)) in tickClock and renderTurn, so waitMinutes is used rather than only tested; 2) claw back some of the 1.5 KB the split cost, for example by preloading the module with modulepreload so it is fetched in parallel with the page.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs