Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
Relay's GET /admin page is served from src/admin-routes.ts - no behaviour change #133
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
GET /admin and its 401/403 refusals are now served from a new src/admin-routes.ts, and relay.ts calls it. I couldn't run bun x tsc --noEmit here. Bun couldn't write to its temp directory, even for bun install.
shipped merged
2 earlier comments
GET /admin and its 401/403 refusals are now served from a new src/admin-routes.ts, and relay.ts calls it. I couldn't run bun x tsc --noEmit here. Bun couldn't write to its temp directory, even for bun install. I checked the types by reading instead, so the forge's check is the first real type check.
src/admin-relay.test.ts, src/relay.test.ts and src/admin.test.ts pass untouched: 26 tests, 0 failures.
- New function:
serveAdminPage(lobby, req, res, url)sends the refusal for anyone not allowed, and the page for GET and HEAD. For any other method by an allowed caller, it hands back{ who, canEdit, show, refuse }so the POST handler inrelay.tscan carry on. - Unchanged: The POST actions stay in
relay.tswith no behaviour change. The issue said to passjsonandreadBodyinto the new function as arguments. The new function never needs them, because the 405 and the form-size handling stay inrelay.ts.
I wrote this fresh rather than reusing the earlier #107 branch. That branch isn't in this clone, so I couldn't check it.
🤖 Generated with Claude Code
GET /admin and its 401/403 refusals are now served from a new src/admin-routes.ts, and relay.ts calls it. The POST actions stay in relay.ts with no behaviour change.
- Check failure:
forge.jsondeclaredcheck.limitsbut nocheck.run, so the check had nothing to run. I addedcheck.run: install with the frozen lockfile, thenbun x tsc --noEmit, thenbun test, all fromSoftware/so101. I picked those commands myself, because the repo's docs name none. I couldn't run the check here, so the forge's run on this push is the first real one. - Tests:
src/admin-relay.test.ts,src/relay.test.tsandsrc/admin.test.tspass untouched (26 tests). - Type check:
bun x tsc --noEmitwouldn't run in my sandbox, because Bun couldn't write to its temp directory. I checked the types by reading only. - Shape of the new module:
serveAdminPage(lobby, req, res, url)answers the refusals and GET/HEAD itself. For any other method from an allowed caller it returns{ who, canEdit, show, refuse }for the POST handler.jsonandreadBodyare not passed in, because the new function never needs them.
🤖 Generated with Claude Code
GET /admin and its 401/403 refusals are now served from a new src/admin-routes.ts, and relay.ts calls it. The POST actions stay in relay.ts with no behaviour change.
- Why the check failed: My earlier
forge.jsonedit addedcheck.run, and main had since removed the wholecheckblock (commit 1142ee6). The two edits to the same file conflicted. I took main'sforge.jsonas it is and merged main in, so this branch no longer touchesforge.json. - Diff against main: It is now only
src/admin-routes.ts(new) and therelay.tschange. - Tests: I didn't re-run them after the merge, because nothing in the source changed. Before it,
src/admin-relay.test.ts,src/relay.test.tsandsrc/admin.test.tspassed untouched (26 tests). - Type check:
bun x tsc --noEmitwon't run in my sandbox, because Bun can't write its temp directory. I checked the types by reading only, so the forge's check is the first real type check. - New function:
serveAdminPage(lobby, req, res, url)answers the refusals and GET/HEAD itself. For any other method from an allowed caller it returns{ who, canEdit, show, refuse }for the POST handler.jsonandreadBodyare not passed in, because the new function never needs them.
🤖 Generated with Claude Code
Pure move: the identity, moderator-verification and refusal logic is byte-for-byte the same, POST handling stays in relay.ts, and the diff is only admin-routes.ts plus the relay call site. Preview /admin answers 401 with the admin CSP, no-store, nosniff and referrer headers; / answers 200. Existing admin/relay tests cover the behaviour and no new behaviour was added. Next: (1) serveAdminPage returns a session for POST and null for already-answered, which is a surprising contract for a function named serve*; rename it or split the gate from the page. (2) Add a direct unit test for the gate (guest 401, non-owner 403, moderator needing a verified id) so it does not depend on the relay harness.
GET /adminand its 401/403 refusals are now served from a newsrc/admin-routes.ts, andrelay.tscalls it. I couldn't runbun x tsc --noEmithere. Bun couldn't write to its temp directory, even forbun install. I checked the types by reading instead, so the forge's check is the first real type check.src/admin-relay.test.ts,src/relay.test.tsandsrc/admin.test.tspass untouched: 26 tests, 0 failures.serveAdminPage(lobby, req, res, url)sends the refusal for anyone not allowed, and the page for GET and HEAD. For any other method by an allowed caller, it hands back{ who, canEdit, show, refuse }so the POST handler inrelay.tscan carry on.relay.tswith no behaviour change. The issue said to passjsonandreadBodyinto the new function as arguments. The new function never needs them, because the 405 and the form-size handling stay inrelay.ts.I wrote this fresh rather than reusing the earlier #107 branch. That branch isn't in this clone, so I couldn't check it.
🤖 Generated with Claude Code
Closes #121