Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
A moderator can ban and unban over /live, never the owner or another moderator, and receives the banned list #327
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
A verified moderator can now send ban with on true or false over /live. A moderator who tries it on the owner or another moderator gets an error and nothing changes. The new test and the rest of src/lobby.test.ts pass (37 of 37).
shipped merged
A verified moderator can now send ban with on true or false over /live. A moderator who tries it on the owner or another moderator gets an error and nothing changes. The new test and the rest of src/lobby.test.ts pass (37 of 37).
The full bun test has two failures, in the viewer page's first-visit size budget and in the model-routes test. They fail the same way without my change. I couldn't run the type check here: bun x tsc --noEmit stops with "bun is unable to write files to tempdir".
- Moves into
banUser: the owner's ban code moved out of theswitchinsrc/lobby.tsinto a newbanUsermethod. The owner and moderators now share it, and the log still says who banned or unbanned. - Moderator limits:
- A moderator who bans the owner or a moderator gets "only the owner can ban the owner or a moderator". - The same goes for lifting the ban on someone whose name is a moderator's. - A plain user still gets "only the owner can do that".
- Banned list: moderators now get
bannedwhen they join and on every change, as owners do. Moderators who are already connected get it throughmayHearMuted, the existing check that decides who gets the muted list. - Test: the new one in
src/lobby.test.tshas a moderator ban and unban a user, with the ban barring the user and the log naming the moderator. It also checks the refusals against the owner, another moderator and a plain user. - Distinct addresses: the test gives alice and carol their own
x-forwarded-foraddresses. A ban also bars the banned person's address, and without that every test client shares one address.
forge.json is untouched.
🤖 Generated with Claude Code
I merged main into this branch and pushed it. The lobby tests pass (40), but I couldn't run the type check here.
bun x tsc --noEmit failed with "bun is unable to write files to tempdir: ReadOnlyFileSystem". I didn't run bun install first, so there's no local tsc either. The forge's check will cover the type check on this push.
The conflicts were in Software/so101/src/lobby.ts and lobby.test.ts. I kept both sides in each:
- Doc comment: it now lists both
banned(owners and moderators) andreports. seat(): anyone allowed to see the muted list now also gets the reports list and the banned list on join.wordsand the admin state stay owner-only.- Tests: the moderator ban/unban test and the report test both stay.
🤖 Generated with Claude Code
Verified moderators can ban and unban over /live and receive the banned list. Moderator status is checked by seat.verified plus isModerator, so it does not come from a client-typed name. Banning the owner or another moderator is refused, and so is lifting the ban on one. A plain user is still refused. Each ban or unban is logged with who did it, and the shared banUser removes the duplicated owner code. The new test covers ban, unban, the log, the banned list and every refusal. The preview answers 200 on /. I did not exercise ban over a live socket there, because that needs a signed-in moderator.
Two things to do next:
- Software/README.md (around lines 466-491) still says the ban list and unban are the owner's. Add that moderators can ban and unban over /live, except the owner and other moderators.
- The page UI was not changed, so a moderator receives the banned list but has no control for it. Wire that up in a follow-up only if the issue asks for it. The change is otherwise scoped to the issue.
A verified moderator can now send
banwithontrue or false over/live. A moderator who tries it on the owner or another moderator gets an error and nothing changes. The new test and the rest ofsrc/lobby.test.tspass (37 of 37).The full
bun testhas two failures, in the viewer page's first-visit size budget and in the model-routes test. They fail the same way without my change. I couldn't run the type check here:bun x tsc --noEmitstops with "bun is unable to write files to tempdir".banUser: the owner's ban code moved out of theswitchinsrc/lobby.tsinto a newbanUsermethod. The owner and moderators now share it, and the log still says who banned or unbanned.- A moderator who bans the owner or a moderator gets "only the owner can ban the owner or a moderator". - The same goes for lifting the ban on someone whose name is a moderator's. - A plain user still gets "only the owner can do that".
bannedwhen they join and on every change, as owners do. Moderators who are already connected get it throughmayHearMuted, the existing check that decides who gets the muted list.src/lobby.test.tshas a moderator ban and unban a user, with the ban barring the user and the log naming the moderator. It also checks the refusals against the owner, another moderator and a plain user.x-forwarded-foraddresses. A ban also bars the banned person's address, and without that every test client shares one address.forge.jsonis untouched.🤖 Generated with Claude Code
Closes #227