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

Migrated from github.com/Trevato/SO-ARM100

A chat mute can last 10 min, 1 h, 24 h or for good, and ends on its own - in src/chat.ts #253

Merged opened this

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

Merged

The code for #236 is finished and pushed, but the preview deploy fails again, and I can't fix that from here. The failure is on the registry side, not in the change. The install step in the deploy gets HTTP 429 (rate limited) from registry.npmjs.org on dozens of packages, such as @serialport/, ms and debug.

Notes

shipped merged

opened this

The code for #236 is finished and pushed, but the preview deploy fails again, and I can't fix that from here. The failure is on the registry side, not in the change.

The install step in the deploy gets HTTP 429 (rate limited) from registry.npmjs.org on dozens of packages, such as @serialport/*, ms and debug. This diff doesn't touch package.json, the lockfile, forge.json or any dependency. The install fails before any test could run.

The same code passes in my sandbox: bun test src/chat.test.ts src/lobby gave 38 pass, 0 fail. The full bun test has one failure, in the vendored three.js route of server.test.ts. That route is unrelated to chat, and I didn't touch it. I couldn't confirm the type check, because bun x tsc --noEmit stopped with "bun is unable to write files to tempdir".

A chat mute can now end on its own. mute(id, name, until) takes a time in ms, or null for good, and the new unmute(id) lifts one.

  • Expiry: post refuses while now < until. chat.muted is now a getter that returns only the mutes still in force, so an expired one drops out of it.
  • Stored file: a permanent mute is still written as a plain name string. A timed mute is written as {name, until}. An old file's name string loads as a mute for good.
  • Caller: in lobby.ts, a /live mute calls mute(id, name, null), so it stays permanent, and an unmute calls unmute(id).
  • Tests: in chat.test.ts, with an injected clock, a 10-minute mute blocks just before 10:00 and allows just after. A permanent mute survives a reload, and an old-format file loads.
  • Not done: no /live message offers a 10-minute, 1-hour or 24-hour mute yet. The issue limits the lobby.ts change to the one caller.

The branch needs the preview re-run once the registry stops rate-limiting the deploy host.

🤖 Generated with Claude Code

Continues #253

6 earlier comments · 2 events
commented

The code for #236 is finished and pushed, but the preview deploy fails again, and I can't fix that from here. The failure is on the registry side, not in the change.

The install step in the deploy gets HTTP 429 (rate limited) from registry.npmjs.org on dozens of packages, such as @serialport/*, ms and debug. This diff doesn't touch package.json, the lockfile, forge.json or any dependency. The install fails before any test could run.

The same code passes in my sandbox: bun test src/chat.test.ts src/lobby gave 38 pass, 0 fail. The full bun test has one failure, in the vendored three.js route of server.test.ts. That route is unrelated to chat, and I didn't touch it. I couldn't confirm the type check, because bun x tsc --noEmit stopped with "bun is unable to write files to tempdir".

A chat mute can now end on its own. mute(id, name, until) takes a time in ms, or null for good, and the new unmute(id) lifts one.

  • Expiry: post refuses while now < until. chat.muted is now a getter that returns only the mutes still in force, so an expired one drops out of it.
  • Stored file: a permanent mute is still written as a plain name string. A timed mute is written as {name, until}. An old file's name string loads as a mute for good.
  • Caller: in lobby.ts, a /live mute calls mute(id, name, null), so it stays permanent, and an unmute calls unmute(id).
  • Tests: in chat.test.ts, with an injected clock, a 10-minute mute blocks just before 10:00 and allows just after. A permanent mute survives a reload, and an old-format file loads.
  • Not done: no /live message offers a 10-minute, 1-hour or 24-hour mute yet. The issue limits the lobby.ts change to the one caller.

The branch needs the preview re-run once the registry stops rate-limiting the deploy host.

🤖 Generated with Claude Code

commented

Chat mutes can now last 10 minutes, 1 hour, 24 hours or for good, and a timed one ends on its own. I merged current main into the branch and pushed it, so the preview deploy runs again. I haven't seen that deploy's result.

The earlier deploy failure was the package registry rate-limiting the install (429s), not this change. I changed no code for it: this push is the merge plus a fresh deploy. If the registry limits it again, the deploy will fail the same way and someone will need to re-run it.

  • chat.ts: mute(id, name, until) takes a time in ms, or null for good, and unmute(id) lifts one. post refuses while now < until, and an expired mute drops out of muted.
  • Stored file: a permanent mute is still written as a plain name string. A timed mute is written as {name, until}. An old file's name string loads as a mute for good.
  • lobby.ts: the one caller now calls mute(id, name, null) or unmute(id), so a /live mute stays permanent. Nothing in /live offers a timed mute yet.
  • Tests: with an injected clock, a 10-minute mute blocks just before 10:00 and allows just after. A permanent mute survives a reload, and an old-format file loads.
  • Test run: the chat, lobby and admin suites pass (50 tests). The type check wouldn't run here ("bun is unable to write files to tempdir"), and I didn't re-run the full suite after the merge. The earlier full run had one failure, on the vendored three.js route in server.test.ts. I didn't touch that route and haven't traced the cause.

forge.json shows a diff against main, but that came from main itself. Against the merge base, the branch changes only chat.ts, chat.test.ts and lobby.ts.

🤖 Generated with Claude Code

commented

Pull #253 is open for this issue and carries the timed-mute work. The branch is pushed and main has nothing newer, so I changed no code this run. I haven't seen the preview deploy's result for #253. The earlier failure was the package registry rate-limiting the install (429s), not this change. If it hits the limit again, the deploy needs a re-run.

A chat mute can now last 10 minutes, 1 hour, 24 hours or for good, and a timed one ends on its own.

  • chat.ts: mute(id, name, until) takes a time in ms, or null for good, and unmute(id) lifts one. post refuses while now < until, and an expired mute drops out of muted.
  • Stored file: a permanent mute is still written as a plain name string. A timed mute is written as {name, until}. An old file's name string loads as a mute for good.
  • lobby.ts: the one caller calls mute(id, name, null) or unmute(id), so a /live mute stays permanent. Nothing in /live offers a timed mute yet.
  • Tests: with an injected clock, a 10-minute mute blocks just before 10:00 and allows just after. A permanent mute survives a reload, and an old-format file loads.
  • Test run: the chat, lobby and admin suites pass (50 tests). The type check wouldn't run here ("bun is unable to write files to tempdir"). The full bun test has one failure I haven't traced, on the vendored three.js route in server.test.ts, which this branch doesn't touch.

Pull #254 also edits the mute case in lobby.ts to log mutes to the admin log, so the two pulls will likely conflict there.

🤖 Generated with Claude Code

Changes requested — before the latest push

The expiry logic in chat.ts is sound and tested: injected clock, reload, and old-format file. But the issue asks that a mute can last 10 min, 1 h, 24 h or for good, and nobody can choose a duration. The only caller, lobby.ts, passes null, so every mute is still permanent. The PR says so itself ("Nothing in /live offers a timed mute yet"). The preview therefore cannot show a timed mute working, and neither the page nor the terminal can set one (both-doors rule). Fix first: let the /live mute message carry a validated duration (one of 10m, 1h, 24h, forever; reject anything else at the boundary). Convert it to until with the lobby clock, and add a lobby test that a 10-minute mute reaches the muted list and then ends. Then add the control to the mod panel, the same option in src/tty.ts if it mutes there, and a README line. Also: (1) the mutes list shown to the owner should say when a mute ends; (2) the muted getter rebuilds a Map on every read, so prune expired entries on read or save instead. Also, #254 edits the same mute case in lobby.ts, so expect a rebase conflict.

commented

A chat mute can now last 10 minutes, 1 hour, 24 hours or for good, and a timed one ends on its own. You can pick the length from the mod dialog and from the terminal.

  • /live mute: the message takes an optional "for" of 10m, 1h, 24h or forever. Anything else gets error: mute for 10m, 1h, 24h or forever, and leaving it out means for good. lobby.ts turns the length into until using a new now option on the lobby, which defaults to Date.now.
  • Mod dialog: it now has a "mute for" select, and its Mute button sends the chosen length. The mute-suggestion button still sends no length, so it mutes for good.
  • Terminal: /mute <name> [10m|1h|24h|forever], and /mute <name> alone is still for good. Without this change terminal.ts rejected the extra word as "one name at a time". The README line and the help text are updated.
  • Owner's list: the muted frame now carries until, and the list reads "alice is muted until 10/21/26, 3:04 PM" or "for good".
  • Pruning: chat.ts keeps a name map in step with the mutes. A shared prune() removes expired entries on post, on reading muted, and on mutedList(), so reads no longer build a new Map.
  • Tests: lobby.test.ts has a new test where a 10-minute mute reaches the owner's list with its end time, a bad length is refused, and after the clock passes it the person can post again. I updated the existing mute expectation to include until: null. terminal.test.ts covers /mute alice 1h. The chat, lobby, terminal, admin and moderator suites pass (82 tests).
  • Not run: bun x tsc --noEmit fails here with a bun tempdir write error, so there is no type-check result. I did not run the full suite.
  • Rebase: main has no new commits and #254 has not merged, so there was no conflict. Whichever of #253 and #254 lands second will have to rebase over the mute case in lobby.ts.

🤖 Generated with Claude Code

commented

Nothing has changed since my last push, so I changed no code this run. Pull #253 is open and mergeable, my branch matches origin, and main has no new commits. The API shows no new comments and no check result on the pull. I haven't seen the preview deploy's result.

The review asked for four things, and all four are in the branch:

  • Choosing a length: the /live mute message takes an optional "for" of 10m, 1h, 24h or forever. Anything else gets an error. A mute with no length is for good.
  • Page and terminal:

- Mod dialog: it has a "mute for" select. - Terminal: /mute <name> [10m|1h|24h|forever] works. - README: it documents both.

  • Owner's list: each entry says when the mute ends, or "for good".
  • Pruning: chat.ts no longer builds a new Map on every read. A shared prune() drops expired mutes on post, on muted and on mutedList().

The chat, lobby, terminal, admin and moderator suites pass (82 tests). A new lobby test sends a 10-minute mute, checks it appears in the owner's list with its end time, then moves the clock past it and checks the person can post again. bun x tsc --noEmit fails here with a bun tempdir write error, so there is no type-check result. I did not run the full suite.

Pull #254 also edits the mute case in lobby.ts, so whichever of #253 and #254 lands second will have to rebase over it.

🤖 Generated with Claude Code

commented

I merged main into the branch, resolved the three conflicts keeping both sides, and pushed. The merge commit is 27417dd. I haven't seen the forge check's result on it.

  • lobby.ts: one comment line conflicted. The delete line now reads "owner or a moderator" from main, and the mute line keeps the "for" field.
  • terminal.ts: the header kept /mute <who> [10m|1h|24h|forever] plus main's new /delete line. The mute code kept the timed-length parsing next to main's new delete case.
  • lobby.test.ts: both new tests stay, my 10-minute-mute test and main's moderator-delete tests.

The chat, lobby, terminal, admin and moderator suites pass (86 tests). bun x tsc --noEmit can't run in this sandbox (a bun tempdir write error), and I did not run the full suite.

The working tree briefly ended up on main with my changes staged. I saved a copy of the staged diff, put the tree back on this branch and redid the merge there. No work was lost.

🤖 Generated with Claude Code

Changes requested — before the latest push

The server side is sound: the owner gate on mute is kept, the length is validated against a fixed table, the old file format loads, and the terminal and README are covered. One thing makes the feature fail on the page. A timed mute ends on the server, but nothing tells the muted person's client. hello.muted is computed only when a hello is sent, and the page hides the chat box on lobby.hello.muted and shows 'The owner has muted you.' So after 10 minutes the person is still shut out of the chat until they reload. The owner's list also keeps showing the expired mute. Fix first: when a mute runs out, push a fresh hello to that person's seats and the muted list to owners. For example, schedule a timer in lobby.ts at until (cleared on unmute), or sweep expired mutes on the existing ping interval, and add a lobby test that a seat receives hello with muted false once the clock passes. Smaller: const who = arg; in terminal.ts is a pointless alias, and /unmute alice 1h gets 'one name at a time', which is an odd message.

commented

When a timed mute runs out, the muted person's seats now get a fresh hello with muted: false, so their chat box comes back without a reload. Owners get the updated muted list. I pushed this as 729b11f; I haven't seen the forge check's result on it.

  • chat.ts: prune() now records the ids it drops, and a new takeExpired() returns and clears them. This way a lazy read in post or muted can't swallow the expiry before the lobby hears of it.
  • lobby.ts: I took your second option and sweep on the existing ping interval rather than adding a per-mute timer. ping() calls a new mutesEnded(), so the news arrives within one ping interval, 5 seconds by default. There is no timer to clear on unmute, because unmute removes the entry.
  • Test: the 10-minute-mute lobby test now moves the clock past the end, with a 20 ms ping. It checks that the muted person's seat receives hello with muted: false and that the owner receives an empty muted list.
  • terminal.ts: I removed the const who = arg; alias. /unmute alice 1h now prints usage: /unmute <name> instead of "one name at a time", and terminal.test.ts covers it.

The chat, lobby and terminal suites pass (62 tests). bun x tsc --noEmit can't run in this sandbox (a bun tempdir write error), and I did not run the full suite.

🤖 Generated with Claude Code

Approved

Timed mutes work end to end: /live validates the length against a fixed list, expiry is server-side on an injectable clock, the muted person gets a fresh hello when it ends, the owner list shows the end, the terminal accepts /mute <name> [10m|1h|24h|forever], the README says so, and tests cover expiry, reload, old file format, bad length and the terminal parse. The preview serves the new select. Next two things: (1) hide the modFor select with the Mute button for moderators (lobby-panel.js:224 hides modMute/modBan but not the label, so a non-owner sees a control that does nothing); (2) the owner list prints toLocaleString in the browser zone, so consider a relative form such as "for 8 more min" that is readable on a 360px phone.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs