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

Migrated from github.com/Trevato/SO-ARM100

Everyone sees '12 here · 4 signed in · 8 watching' on one line at the top, updated live over /live #297

Parked opened this
Closed without merging

The status strip now shows "12 here · 4 signed in · 8 watching" on one line, updated live over /live. The page-size test that failed the preview deploy passes again. Server: the lobby sends a presence frame with total, signedIn and anonymous.

Notes

stopped parked by the crew deploy 44d552d

opened this

The status strip now shows "12 here · 4 signed in · 8 watching" on one line, updated live over /live. The page-size test that failed the preview deploy passes again.

  • Server: the lobby sends a presence frame with total, signedIn and anonymous. It sends the current counts to each new socket and tells the room about changes once, 300 ms after the first connect or disconnect in a burst (presenceMs option). "Signed in" means the socket has a name, which covers forge sign-in and people who joined in the app.
  • Page: a #presence line sits in the strip under the clock and shares the cap line's style, which includes a fixed 16 px height so nothing shifts. It is drawn by src/ui/presence.js, which is loaded the first time a frame arrives. The size budget forced that: the first version put the first-visit download at 51,233 bytes gzipped, 33 over the 51,200 limit.
  • Tests: src/lobby.test.ts checks that counts rise on connect and fall on disconnect, and that three quick connects don't produce three broadcasts. src/ui/presence.test.ts checks the line's wording.
  • What I ran: bun test src/ui src/lobby passes (146 tests), and so does the size test in src/server.test.ts. I did not run tsc because bun can't write to its temp directory in this sandbox, so the type check is left to the forge. The whole suite had two failures at the start of this work. One was the size budget. The other is the model-routes test, which gets a 404 for /vendor/three/build/three.module.js. That one also fails in this sandbox without my changes (the vendored libraries aren't available here), and I didn't touch it or forge.json.

The working tree changed under me between commands during this work: files appeared, disappeared and were reverted. I re-checked what I committed (29a694c), but the first thing to look at in review is the diff of lobby-panel.js and viewer.html.

Continues #297

5 earlier comments · 1 event
commented

The status strip now shows "12 here · 4 signed in · 8 watching" on one line, updated live over /live. The page-size test that failed the preview deploy passes again.

  • Server: the lobby sends a presence frame with total, signedIn and anonymous. It sends the current counts to each new socket and tells the room about changes once, 300 ms after the first connect or disconnect in a burst (presenceMs option). "Signed in" means the socket has a name, which covers forge sign-in and people who joined in the app.
  • Page: a #presence line sits in the strip under the clock and shares the cap line's style, which includes a fixed 16 px height so nothing shifts. It is drawn by src/ui/presence.js, which is loaded the first time a frame arrives. The size budget forced that: the first version put the first-visit download at 51,233 bytes gzipped, 33 over the 51,200 limit.
  • Tests: src/lobby.test.ts checks that counts rise on connect and fall on disconnect, and that three quick connects don't produce three broadcasts. src/ui/presence.test.ts checks the line's wording.
  • What I ran: bun test src/ui src/lobby passes (146 tests), and so does the size test in src/server.test.ts. I did not run tsc because bun can't write to its temp directory in this sandbox, so the type check is left to the forge. The whole suite had two failures at the start of this work. One was the size budget. The other is the model-routes test, which gets a 404 for /vendor/three/build/three.module.js. That one also fails in this sandbox without my changes (the vendored libraries aren't available here), and I didn't touch it or forge.json.

The working tree changed under me between commands during this work: files appeared, disappeared and were reverted. I re-checked what I committed (29a694c), but the first thing to look at in review is the diff of lobby-panel.js and viewer.html.

commented

The lobby now broadcasts {type:"presence", total, signedIn, anonymous} over /live, and the status strip shows it as "12 here · 4 signed in · 8 watching". The lobby, UI and size-budget tests pass. In src/server.test.ts, "serves the model, its meshes and the vendored libraries" fails, and I haven't run the full suite since the budget fix.

  • Why the last preview failed: the first version pushed the first-visit page over its 51.2 KB gzip budget in src/server.test.ts. It measured 51233 bytes, and main measures 51143. That failure is what sank the preview.
  • How it fits now: src/ui/presence.js is loaded lazily on the first presence frame, so it isn't part of the first-visit download. It adds the strip line itself, so viewer.html is unchanged from main. The "one line, no layout shift" item is argued, not checked in a browser: the line is a fixed 16px, and the strip is at least 64px tall, which should absorb it.
  • Server: connects and disconnects start one 300 ms timer, and when it fires the room gets one frame with the current counts. A new socket also gets the current counts straight away. "Signed in" means the socket has a name: a forge identity or someone who joined in the app.
  • Tests: src/lobby.test.ts has a new test for counts on connect and disconnect, including that three connects don't send three broadcasts. src/ui/presence.test.ts covers the line's wording.
  • Pre-existing failure: that vendored-libraries test returns 404 for /vendor/three/build/three.module.js. It also fails on main in this sandbox, probably because the vendored libraries aren't installed here, so I left it alone.
  • Pulled-in commit: 29a694c was already on the branch from the earlier run. It removed the #presence markup but left code that needed it. 1c513c7 fixes that by having the module create its own element.

forge.json is untouched.

🤖 Generated with Claude Code

commented

Nothing new has been said on #291 since my last run, so I made no changes and pushed nothing. The branch is still at 1c513c7, up to date with origin.

The only comment on the issue is the earlier "parked" note after pull #295 closed. The pulls list shows no open pull for this branch.

What the branch does:

  • The lobby broadcasts {type:"presence", total, signedIn, anonymous} over /live. Connects and disconnects within 300 ms are coalesced into one frame.
  • The status strip shows "12 here · 4 signed in · 8 watching". It is drawn from a lazily loaded module, so the first-visit page stays under its 51.2 KB gzip budget (the earlier version exceeded it, which is what failed the preview).
  • src/lobby.test.ts has a test for the counts changing on connect and disconnect, and src/ui/presence.test.ts covers the line's wording.
  • forge.json is untouched.

What I ran: the lobby, UI and size-budget tests pass. The vendored-libraries test in src/server.test.ts also fails on main here, probably because those libraries aren't installed in this sandbox. I haven't run the full suite since the budget fix, and tsc fails here with a read-only tempdir error.

Still open:

  • No pull exists for this branch. Pull #295 is closed, so someone needs to reopen it or have the forge open a new one before the check can run.
  • "No layout shift" is argued, not checked in a browser. The line is a fixed 16px inside a strip at least 64px tall.
commented

Nothing has changed on #291 since my last run. I made no changes and pushed nothing.

  • Issue: the only comment is still the "parked" note about pull #295.
  • Pull: pull #297, "Everyone sees '12 here · 4 signed in · 8 w…", is now open for this branch. I didn't read its body or its check result.
  • Branch: it is still at 1c513c7, up to date with origin.

The work itself is as I described last time: the presence frames over /live and the strip line drawn from a lazily loaded module. If #297's check comes back with a failure, send me the log.

Changes requested — before the latest push

The server side is sound: counts come from the verified seats, the frame is coalesced, and the timer is cleared in close(). Two things block it.

  1. Fix first: the terminal has no presence. The page shows '12 here · 4 signed in · 8 watching', but src/tty.ts has no equivalent, and the README says nothing about the line. Both doors must offer it. Add a presence command or line to tty.ts that uses the same presenceLine wording, add a test for it, and add one README sentence.
  1. Layout shift: the #presence line is created after first paint and inserted after #clock. The line is 16px, but the 'strip is at least 64px' claim was never checked in a browser. Any growth of .who shifts the content below it. Reserve the slot in viewer.html instead, as #capLine does, for example an empty div with a fixed height. If the size budget forbids that, say what you measured. Also add role/aria so the counts are reachable by screen readers, for example a plain text node inside a labelled region. aria-live=off is fine for the updates, but the element must be readable.

No-JS: the line is absent without JavaScript. That is acceptable for a live count, but mention it in the README.

commented

Both blockers are addressed, but I couldn't run the type check here: bun x tsc fails with a read-only tempdir error. The forge's check will cover it. The terminal, UI, server and lobby tests pass except one model-routes test, "serves the model, its meshes and the vendored libraries". That test also fails without my changes.

  • Terminal presence: src/terminal.ts now handles the presence frame and keeps the line, worded by the page's own presenceLine. A new /here command prints it, or "no count from the room yet" before the first frame. It is also in HELP. The terminal door's logic is in terminal.ts, not tty.ts, so the change is there. A test in terminal.test.ts covers /here, including that malformed counts are ignored. I chose not to print the line on every change, because a terminal scrolls.
  • Layout shift: viewer.html now has <div id="presence" role="status" aria-live="off"> in the strip, between #clock and #capLine. It has a fixed 16px height, sharing #capLine's colour and size rule. presence.js only fills the slot with a text node, so nothing moves when the line arrives and screen readers can read it. I used role="status" with aria-live="off" instead of a labelled group because the group's aria-label cost bytes the size budget doesn't have. I didn't measure the strip in a browser.
  • Size budget: the new markup pushed the first-visit download over 51.2 KB gzipped, which failed the size test. I removed the trailing comment on the .estop:active rule in viewer.html to get back under it.
  • README: a "presence line" paragraph says that it is drawn by JavaScript, so without JavaScript the line stays empty, and that the terminal has /here. /here is also listed with the other terminal commands.
commented

Parked by the crew: the preview's deploy failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs