Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
A moderator can delete a chat line over /live - the first moderator action, server-checked and logged #240
Merged 45d 18h ago
A verified moderator can now delete a chat line over /live. The preview deploy has failed twice for a reason outside this change, and I can't fix that from here. Both failures were npm registry 429 (rate-limit) errors while installing @serialport/ and other packages.
-
Reviews
Changes requested — before the latest pushThe server rule is right: delete needs a forge-verified identity plus isModerator, guests and plain users are refused, and settings and pause stay owner-only. But a moderator cannot use it from either door, and nothing in the change shows how.
Fix first: the page only offers delete to the owner. src/ui/lobby-panel.js:35 defines isOwner() as hello.you.owner, and viewer.html uses it to gate the Mod tab (line 595) and the long-press delete dialog. A moderator never sees a Delete control, so only a hand-written websocket frame reaches the new server path. Let the hello tell the client the seat may moderate, for example you.moderator = seat.verified && admin.isModerator(name). Then show the chat-line delete dialog on that flag, and leave mute, ban and the rest owner-only.
Also required:
- Terminal: src/tty.ts has no chat-delete path at all. Add one, gated by the same verified-moderator-or-owner rule, so a delete there reaches web viewers as unsaid.
- README: say that moderators can delete chat lines, and how, in the page and in the terminal.
- Tests: the pause assertion in lobby.test.ts uses a convoluted predicate (m !== bob.heard.find(...)). Make it simple and clear. Add a test that the owner's delete is logged, since that behaviour is new. Add a test for a non-integer id.
Small points: the 'verified' computation in upgrade() is correct. A failed deleteLine id check relies on the throw being caught as ChatError at line 275, which is fine.
I did not check the preview deploy. It was reported failing on registry 429s, and the missing UI means it would show nothing for a moderator anyway.
ApprovedApproved. The server decides who may delete: a seat counts as a moderator only if the forge signed its identity and the name is listed, and a guest using a listed name is refused. The owner and moderators share one deleteLine, which validates the id, logs who deleted the line, and broadcasts unsaid. Mute, ban, settings, pause and the Mod tab stay owner-only. Both doors are covered: the page (long-press, right-click or Enter) and the terminal (/delete <name> and /delete #id), with tests for each and a README paragraph. The preview answers 200 on /; I did not open the page in a browser. Next: (1) In src/ui/lobby-panel.js, give the delete dialog a visible Delete button of at least 44px for thumb use, and keep the long-press as a shortcut only. Also confirm the focusable chat lines have an accessible name that says they open moderation. (2) In src/terminal.ts, drop the entry from room.latest when an unsaid frame arrives. Otherwise /delete <name> silently does nothing after that line is already gone, and the map grows with every author seen.
-
Checks
shipped merged
-
History
- A moderator's terminal delete reaches web viewers as unsaid, tested end to end (#225) 07c30c3
- Drop the earlier copies of the moderator tests (#225) f2833a5
- Moderators get the delete control in the page and /delete in the terminal; hello says who may moderate; tests and README (#225) aa2d743
- Merge main into the #225 branch a619c0a
- Retrigger the preview: the install hit a 429 from the npm registry, no dependency changed 29ad05c
- Slow mode is an admin setting: slowModeSeconds, 0-300, on /admin (after #211 makes main's tests green) (#229) b8ef3fd
- A verified moderator can delete a chat line over /live; the deletion is logged with who did it (#225) e5aed0a
- src/live-metrics.ts: rolling timings with p50/p95, counters and gauges, rendered as Prometheus text - one new module and its test (#205) 240fb37
- Phone portrait: the video is pinned on top with its 16:9 box reserved, and one status strip sits under it (from main at 1142ee6 or later, forge.json untouched) (#187) a304be7
- Page control for tableOffsetMm and a table-here button in the settings panel (#181) 48b63e8
- Phone portrait: a bottom tab bar Drive / Queue / Chat (/ Mod for admins) shows one panel at a time (from main at 1142ee6, forge.json untouched) (#177) df67db9
- /live closes any text frame over 4096 bytes with 1009 - the three-line cap plus its boundary tests (#199) 1e81d4c
- The page draws the camera from /camera/<id>/ws when relayed and reconnects after 2 s without a frame (#182) 8671eed
- The 3D viewer draws the table at the model floor, not at the enforced plane (#183) 45b7233
- A test proves a driver's slider move reaches the fake Pi within one frame through the relay (#186) 9e38b4b
- A refused move shows its reason on the page and in the Machine panel - never silent (#180) 90b0d9b
- Anyone who is not the owner or a moderator gets 404 on GET and POST /admin, not 401/403 (#175) 3854e9a
- The table plane can be set: a tableOffsetMm setting and POST /settings/table-here from the arm's lowest point now (#173) 0ebf3bb
- /status names who is driving, including the owner after a take-over (#174) 4eb94fb
- The relay serves WS /camera/<id>/ws from the shared camera feed, and the offline picture when the Pi camera is down (#172) 46c4128
6 earlier comments
A verified moderator can now delete a chat line over /live. The preview deploy has failed twice for a reason outside this change, and I can't fix that from here. Both failures were npm registry 429 (rate-limit) errors while installing @serialport/* and other packages. This change touches no dependencies.
I merged current main into the branch and pushed, so the deploy runs again. forge.json was not changed on this branch; the merge only brings in main's own edit to it. I re-ran src/lobby.test.ts after the merge: 30 pass. I could not type-check, because bun x tsc and bun install fail in this sandbox with a read-only temp dir error.
- Who counts as a moderator: a seat qualifies only if the forge signed its identity and
admin.isModerator(name)is true. A guest who picks a moderator's name is refused. - Other actions: a plain user, and a moderator's
settingsorpause, still get "only the owner can do that". - Delete path: the owner and moderators now share one
deleteLineinsrc/lobby.ts. It validates the id, deletes the line, and recordsdeleted chat line Nin the admin log under the actor. It then broadcastsunsaidand refreshes the owners' admin view. The owner's deletes are now logged too, which they weren't before. - Tests, in
src/lobby.test.ts:- A moderator deletes a line, the others receive
unsaid, and the log names the moderator. - A plain user is refused.
- A moderator's
settingsandpauseare refused. - A guest using a moderator's name is refused.
- A moderator deletes a line, the others receive
If the install still hits a 429, the failure is still in the registry or the deploy environment, not this code.
🤖 Generated with Claude Code
Issue #225 is done and pushed on smith/225-a-moderator-can-delete-a-chat-line-over. I haven't seen a preview deploy for it yet, and I couldn't type-check here.
The earlier preview failure was the deploy's bun install getting HTTP 429 (rate limited) from the npm registry. My change touches no dependencies. I merged current main into the branch (a619c0a) and pushed, which should start a fresh deploy. I ran src/lobby.test.ts after the merge and all 30 tests pass. One run directly after an earlier rebase had one failure, which I didn't identify. It passed on two reruns, so it may be a flaky test.
I did not run bun x tsc --noEmit, because bun x and bun install fail in this sandbox with a read-only temp dir error. The forge's check will be the first type check. I also ran only lobby.test.ts, not the full suite.
- Moderator delete: a moderator whose identity the forge has signed can send
deleteover/live. A guest who picks a moderator's name is refused. - Everything else: other owner actions, including a moderator's
settingsandpause, are still owner-only, and a plain user gets the same "only the owner can do that" error. - Logging: each deletion is recorded in the admin log as
deleted chat line Nunder whoever did it, owner or moderator. Owner deletions weren't logged before. - Tests: four new cases in
src/lobby.test.tscover a moderator delete, a plain user,settings/pauseand a guest with a moderator's name. - Diff vs
main: onlysrc/lobby.tsandsrc/lobby.test.ts.forge.jsonis not touched by this branch.
If the deploy hits the registry limit again, someone will need to re-run it, since pull #239 is closed and a person has to reopen or recreate it.
🤖 Generated with Claude Code
A verified moderator can now delete a chat line over /live, and the deletion is logged with their name. I changed nothing this run. Pull #240 is open on this branch and already up to date with main (b8ef3fd). I re-ran only src/lobby.test.ts after merging main (30 pass), not the full suite. I couldn't type-check here, so the forge's check is the first.
The two earlier preview failures were npm registry 429 (rate-limit) errors during install, not this code. No dependencies changed, so there is nothing to fix on this side. If #240's preview still fails the same way, someone needs to re-run it.
- Who counts as a moderator: a seat qualifies only if the forge signed its identity and
admin.isModerator(name)is true. A guest who picks a moderator's name is refused. - Other actions: a plain user, and a moderator's
settingsorpause, still get "only the owner can do that". - Delete path: the owner and moderators share one
deleteLineinsrc/lobby.ts. It validates the id and deletes the line. It recordsdeleted chat line Nin the admin log under whoever did it, then broadcastsunsaidand refreshes the owners' admin view. The owner's deletes are now logged too, which they weren't before. - Tests, in
src/lobby.test.ts:- A moderator deletes a line, the others receive
unsaid, and the log names the moderator. - A plain user is refused.
- A moderator's
settingsandpauseare refused. - A guest using a moderator's name is refused.
- A moderator deletes a line, the others receive
forge.jsonis not touched by this branch.
🤖 Generated with Claude Code
Moderators can now delete chat lines from the page and from the terminal, as well as over /live. Tests pass for src/lobby.test.ts and src/terminal.test.ts (50), but I did not run the type check or the page code in a browser. The preview deploy for this push is still unseen. The earlier failure was an npm registry 429 during install.
- Hello flag: the
helloframe now carriesmoderator. It is true only for a forge-verified, non-owner seat named inadmin.isModerator. I put it at the top level ofhello, not underyou.moderatoras you suggested, so the existingyouequality checks keep working. If you'd rather haveyou.moderator, it's a one-line move plus the two readers. When the owner changes the moderators list, connected non-owners get a freshhello. - Page:
src/ui/lobby-panel.jshas acanDelete()(owner orhello.moderator) that gates the line focus, long-press, right-click, Enter and the dialog. Mute and Ban are hidden for moderators and mute/ban frames stay owner-only on the server. The Mod tab is still owner-only. - Terminal:
src/terminal.tsadds/delete <name>for that person's latest line and/delete #12for a specific line. The owner and moderators see#idbefore each chat line, and the hello line says(moderator). The server decides who may delete, so a plain user's/deletecomes back as "only the owner can do that". The deleted line then reaches web viewers asunsaid, and it is covered insrc/terminal.test.ts. - README: a paragraph under the owner's bullet says how a moderator deletes, in the page and in the terminal.
- Tests: the pause assertion now clears
bob.heardand waits for the next error, with no predicate. New tests:- the owner's delete is logged under the owner;
- ids
"3",1.5andnullare refused with "delete which line?"; hello.moderatoris true for the moderator and false for a plain user.
While I worked, the working tree was reset under me by something that wasn't my session, so I redid the changes in one pass and committed at once (aa2d743, f2833a5). I haven't seen the other writer's edits to terminal.ts, terminal.test.ts or the README, so check those files for leftovers.
🤖 Generated with Claude Code
A moderator can now delete a chat line from both the page and the terminal, and the server still checks every delete. I couldn't type-check here (bun x tsc fails in this sandbox), so the forge's check is the first one. src/lobby.test.ts and src/terminal.test.ts pass (the terminal file has 20 tests). I did not look at the preview deploy.
The full bun test run had one failure: "serves the model, its meshes and the vendored libraries…". It fails the same way on the unmodified branch, so this change didn't cause it.
Some of these changes were already on the branch when I got to them. Another writer pushed aa2d743 and f2833a5 while I worked. They cover the page, hello, the terminal /delete and most of the tests. I dropped my overlapping copies and added only what was missing. If those commits weren't yours, it's worth a look.
- Page:
hellonow carries a top-levelmoderatorflag, true only for a forge-verified seat thatisModeratoraccepts. I kept it top-level rather than the suggestedyou.moderator.- The chat-line delete dialog opens for the owner or a moderator. Mute and ban show only for the owner, and the Mod tab stays owner-only.
- Adding or removing a moderator re-sends
helloto connected seats, so the control appears without a reload.
- Terminal:
/delete <name>removes that person's latest line, and/delete #12removes a numbered line.- Owners and moderators see
#idbefore each chat line, and a moderator's login shows(moderator). - The server applies the same verified-moderator-or-owner rule, so web viewers get
unsaid.
- README: documents moderators and
/delete, with the page and terminal steps. - Tests:
- The pause assertion is now a plain check on the errors bob received.
- The owner's delete being logged is a new test.
- A non-integer id is refused with "delete which line?".
- The new end-to-end terminal test (07c30c3) checks that a moderator's
/deletereaches a web viewer asunsaid, is logged under the moderator, and is refused for a plain user.
🤖 Generated with Claude Code
A verified moderator can now delete a chat line over /live, and the page and the terminal both offer it. lobby.test.ts and terminal.test.ts pass (51 tests), but I haven't run the type check or seen the preview deploy. The type check can't run in this sandbox (bun x and bun install fail with a read-only temp dir). The preview deploy failed earlier on npm registry 429 errors, which were not caused by this code.
A full bun test run showed one failure, "the safe zone, the jam watch, and the model routes > serves the model, its meshes and the vendored libraries, and nothing outside them". It also fails with this work stashed, so it is not from this change.
Commits aa2d743, f2833a5 and 07c30c3 appeared on this branch while I was working, and I did not write them. I dropped my own overlapping edits and reviewed what they contain; it covers each review point below.
- Server: a seat is a moderator only if the forge signed its identity and
admin.isModerator(name)is true. A guest who picks a listed name is refused. Thehelloframe carriesmoderatoras a top-level field, notyou.moderatoras the review suggested, and it is re-sent when the owner changes the moderator list. Every other owner action, includingsettingsandpause, stays owner-only. - Logging:
deleteLineinsrc/lobby.tsserves both the owner and moderators. It recordsdeleted chat line Nin the admin log under whoever did it, then broadcastsunsaid. The owner's deletes are now logged too. - Page: the chat-line delete dialog (long-press, right-click or Enter) opens for the owner or a moderator. Mute and ban in that dialog, and the Mod tab, stay owner-only.
- Terminal:
/delete <name>removes that person's latest line, and/delete #12removes that line number. Both go through the same server check. Moderators and the owner see line numbers before each chat line./deletewith no argument prints a usage message, because the other writer implemented it differently from my version. An end-to-end test interminal.test.tsshows a moderator's terminal delete reaching web viewers asunsaidand being logged under their name. - README:
Software/README.mdnow says moderators can delete chat lines, and how, in the page and in the terminal. - Tests: the
pauseassertion is now a plain check. New tests cover the owner's delete being logged and a non-integer id being refused. The earlier duplicate copies of the moderator tests were dropped. forge.jsonis untouched by this branch.
🤖 Generated with Claude Code
Nothing has changed on this branch since my last run. It is in sync with origin at 07c30c3, with no new pushes and no new review comments. I changed nothing and pushed nothing.
A moderator can delete a chat line over /live on the page and in the terminal. I haven't type-checked it (bun x and bun install fail in this sandbox with a read-only temp dir error) or seen the preview deploy. The earlier deploy failures were npm registry 429 errors, not this code. If it still fails the same way, someone will need to re-run it.
- Server: a seat is a moderator only if the forge signed its identity and
admin.isModerator(name)is true. A guest who picks a listed name is refused. A plain user, and a moderator'ssettingsorpause, still get "only the owner can do that". - Logging: the owner and moderators share one
deleteLineinsrc/lobby.ts. It recordsdeleted chat line Nin the admin log under whoever did it, then broadcastsunsaid. The owner's deletes are now logged too. - Page: the
helloframe carriesmoderator, so a moderator gets the chat-line delete dialog. Mute, ban and the Mod tab stay owner-only. - Terminal:
/delete <name>and/delete #12go through the same server check, and web viewers receiveunsaid. - README: it says how a moderator deletes lines, in the page and in the terminal.
- Tests: new tests cover:
- a moderator's delete and the resulting log entry;
- a plain user being refused;
- the owner's delete being logged;
- a non-integer id being refused;
- a guest using a moderator's name being refused;
- the terminal delete reaching web viewers.
forge.jsonis not touched.
The full bun test run has one failure, in the model routes test ("serves the model, its meshes and the vendored libraries, and nothing outside them"). It fails the same way on the base branch.
🤖 Generated with Claude Code
A verified moderator can now delete a chat line over
/live. The preview deploy has failed twice for a reason outside this change, and I can't fix that from here. Both failures were npm registry 429 (rate-limit) errors while installing@serialport/*and other packages. This change touches no dependencies.I merged current
maininto the branch and pushed, so the deploy runs again.forge.jsonwas not changed on this branch; the merge only brings inmain's own edit to it. I re-ransrc/lobby.test.tsafter the merge: 30 pass. I could not type-check, becausebun x tscandbun installfail in this sandbox with a read-only temp dir error.admin.isModerator(name)is true. A guest who picks a moderator's name is refused.settingsorpause, still get "only the owner can do that".deleteLineinsrc/lobby.ts. It validates the id, deletes the line, and recordsdeleted chat line Nin the admin log under the actor. It then broadcastsunsaidand refreshes the owners' admin view. The owner's deletes are now logged too, which they weren't before.src/lobby.test.ts:unsaid, and the log names the moderator.settingsandpauseare refused.If the install still hits a 429, the failure is still in the registry or the deploy environment, not this code.
🤖 Generated with Claude Code
Continues #240