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
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
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.
shipped merged
6 earlier comments · 2 events
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:
postrefuses whilenow < until.chat.mutedis 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/livemute callsmute(id, name, null), so it stays permanent, and an unmute callsunmute(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
/livemessage offers a 10-minute, 1-hour or 24-hour mute yet. The issue limits thelobby.tschange to the one caller.
The branch needs the preview re-run once the registry stops rate-limiting the deploy host.
🤖 Generated with Claude Code
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, ornullfor good, andunmute(id)lifts one.postrefuses whilenow < until, and an expired mute drops out ofmuted.- 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 callsmute(id, name, null)orunmute(id), so a/livemute stays permanent. Nothing in/liveoffers 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
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, ornullfor good, andunmute(id)lifts one.postrefuses whilenow < until, and an expired mute drops out ofmuted.- 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 callsmute(id, name, null)orunmute(id), so a/livemute stays permanent. Nothing in/liveoffers 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 testhas one failure I haven't traced, on the vendored three.js route inserver.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
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.
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.
/livemute: the message takes an optional"for"of10m,1h,24horforever. Anything else getserror: mute for 10m, 1h, 24h or forever, and leaving it out means for good.lobby.tsturns the length intountilusing a newnowoption on the lobby, which defaults toDate.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 changeterminal.tsrejected the extra word as "one name at a time". The README line and the help text are updated. - Owner's list: the
mutedframe now carriesuntil, and the list reads "alice is muted until 10/21/26, 3:04 PM" or "for good". - Pruning:
chat.tskeeps a name map in step with the mutes. A sharedprune()removes expired entries onpost, on readingmuted, and onmutedList(), so reads no longer build a new Map. - Tests:
lobby.test.tshas 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 includeuntil: null.terminal.test.tscovers/mute alice 1h. The chat, lobby, terminal, admin and moderator suites pass (82 tests). - Not run:
bun x tsc --noEmitfails here with a bun tempdir write error, so there is no type-check result. I did not run the full suite. - Rebase:
mainhas 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 themutecase inlobby.ts.
🤖 Generated with Claude Code
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
/livemute message takes an optional"for"of10m,1h,24horforever. 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.tsno longer builds a new Map on every read. A sharedprune()drops expired mutes onpost, onmutedand onmutedList().
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
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" frommain, and the mute line keeps the"for"field.terminal.ts: the header kept/mute <who> [10m|1h|24h|forever]plusmain's new/deleteline. Themutecode kept the timed-length parsing next tomain's newdeletecase.lobby.test.ts: both new tests stay, my 10-minute-mute test andmain'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
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.
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 newtakeExpired()returns and clears them. This way a lazy read inpostormutedcan'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 newmutesEnded(), so the news arrives within one ping interval, 5 seconds by default. There is no timer to clear on unmute, becauseunmuteremoves 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
hellowithmuted: falseand that the owner receives an empty muted list. terminal.ts: I removed theconst who = arg;alias./unmute alice 1hnow printsusage: /unmute <name>instead of "one name at a time", andterminal.test.tscovers 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
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.
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.orgon dozens of packages, such as@serialport/*,msanddebug. This diff doesn't touchpackage.json, the lockfile,forge.jsonor any dependency. The install fails before any test could run.The same code passes in my sandbox:
bun test src/chat.test.ts src/lobbygave 38 pass, 0 fail. The fullbun testhas one failure, in the vendored three.js route ofserver.test.ts. That route is unrelated to chat, and I didn't touch it. I couldn't confirm the type check, becausebun x tsc --noEmitstopped 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, ornullfor good, and the newunmute(id)lifts one.postrefuses whilenow < until.chat.mutedis now a getter that returns only the mutes still in force, so an expired one drops out of it.{name, until}. An old file's name string loads as a mute for good.lobby.ts, a/livemute callsmute(id, name, null), so it stays permanent, and an unmute callsunmute(id).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./livemessage offers a 10-minute, 1-hour or 24-hour mute yet. The issue limits thelobby.tschange 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