Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
The admin page shows the table height and a 'the arm rests on the table now - set the table here' button #184
/admin now has a Table section that shows the arm server's tableOffsetMm. I ran the admin, relay and lobby tests (60 pass) and pushed. I did not run the whole bun test suite; the forge runs that on push.
stopped parked by the crew deploy 0012547
4 earlier comments · 3 events
The page work is sound: owner-only writes (403 for a moderator), the mm value is validated server-side, the redirect line is fixed text, the CSP is unchanged, and the test covers owner, moderator, bad value and both writes. The preview /admin answers 401 without the forge identity, as intended. Two things from the list are missing.
- README: Software/README.md documents /admin at about lines 471-513 (owner actions, moderators, the log) and says nothing about the Table section. Fix first: add a short paragraph there. It should say the owner sets the table height (-100 to 100 mm) or presses "The arm rests on the table now - set the table here", a moderator only reads it, and each action goes to the arm server (or the simulation).
- Both doors: src/tty.ts is untouched. Either give the terminal the same read and set (gated like the page: owner writes, moderator reads, guest sees nothing) with a test, or, if the terminal has no admin surface by design, say so in the README so that is a decision rather than a gap.
Smaller: the new test only checks 403 for table-here by a moderator; add table-set as well, since it is a separate case branch. On the page, label the number field so a screen-reader user hears the unit (the small text is inside the label, which is fine), and note the two table forms stack on 360px as a column. Check that, since the button text is long and must wrap rather than overflow.
/admin now shows the table height and the "set the table here" button, and I've addressed the review points on this branch. I pushed it. The admin tests pass (12); I did not run the whole suite.
- README: the
/adminlist inSoftware/README.mdhas a new Table bullet. The owner sets the height (-100 to 100 mm) or presses "The arm rests on the table now - set the table here". A moderator only reads it. Each action goes to the arm server, or the simulation when there is none, and is checked there. - Terminal: I did not add a read and set to
src/tty.ts. The README already says admin settings are web-only, and the new bullet repeats that the terminal has no admin surface by design. If you want the terminal to have it, that's a separate change. - Test: a moderator posting
table-setnow gets a 403, and the stub's table value stays unchanged. - Label: the number field has an
aria-labelgiving the unit ("Table height in millimetres above the model's table"). - 360px layout: I did not open it in a browser. By the CSS, the button wraps rather than overflows: buttons have no
nowrap, and the.actionsrow and.gridboth wrap. I left the CSS alone.
🤖 Generated with Claude Code
The page half works: the logic is sound, a moderator gets 403 on both table actions (tested), the number is validated 3 digits and -100..100, and the arm server also checks it. The preview answers 401 on /admin to a guest, as it should. One miss against the list: both doors. A person can set the table on the page but not in src/tty.ts (it has no table read or set), and the README answers that by calling the terminal having no admin surface by design. The owner's rule is that what a person can do on the page they can do in the terminal, and the terminal gates exactly as the page does (owner only to set, a moderator reads). Fix first: add a table read and set/here to src/tty.ts for the owner, read-only for a moderator, through the same ArmTable, with a test that a guest and a moderator are refused and the owner's write reaches the arm server; then update the README bullet. If the terminal truly has no admin surface for any setting today, say so with a pointer to that decision and open an issue for the terminal admin door instead of asserting it in the README. Smaller: the 360px layout was not looked at; ArmTable.read swallows every error into null, which shows "did not say" even when the server is down. Say so (e.g. unreachable) so the owner is not misled.
The terminal can now read and set the table as well, and /admin tells an unreachable arm server apart from one that didn't report a height. I ran the terminal, admin and lobby tests (58 pass) and pushed. I did not run the whole suite.
- Terminal commands:
/tablereads the height,/table 12sets it (a whole number, -100 to 100), and/table heredoes what the page button does. They go through a new/admin/tableroute insrc/admin-routes.ts, wired inrelay.tsto the sameArmTableand the same owner/moderator check as the page. Here is how each person is treated:
- A guest gets 401. - Anyone who isn't the owner or a moderator gets 403. - A moderator can read, but a write gets 403. - The owner's write goes to the arm server.
- Test:
src/terminal.test.tshas a new case against the real simulation server. The owner reads and sets 12, and the simulation's/settingsthen shows 12. A moderator reads 12 and is refused/table 3and/table here, and the value stays 12. A user who isn't the owner or a moderator, and a guest, are both refused. - README: the Table bullet documents the
/tablecommands. I also removed an older sentence in the Moderators bullet that said the app has no terminal, becauseforge.jsondoes declaretty. The other settings are still web-only. - Unreachable vs. no height:
ArmTable.readno longer swallows errors. The page now shows "the arm server did not answer (…): the table height is not known" when it can't reach the arm server, and "did not say" only when it answered without a height. - 360px layout: I still haven't looked at it in a browser; I can't from here. The CSS wraps long button text rather than overflowing it.
🤖 Generated with Claude Code
main is merged into the branch and pushed. The one conflict, in src/admin-routes.ts, is resolved. The terminal, admin, lobby and relay tests pass (80), and the type check shows no errors outside src/ui.
- What conflicted:
mainchanged/adminto answer anyone who isn't the owner or a moderator with a plain 404 (no such route). My branch had moved that check into a shared helper that answered 401 or 403. - How I kept both: the shared helper stays, and
/adminnow usesmain's 404. /admin/table: it follows the same rule and answers outsiders with 404. A moderator still reads the value and gets 403 on a write.- Terminal test and README: I updated the terminal test and the README Table bullet to say 404.
🤖 Generated with Claude Code
The page and terminal both work and are tested, but the new write door /admin/table has no same-origin check. Fix that first.
The owner's browser authenticates with the forge's signed headers on any request. handleTable parses the body as JSON whatever its content-type. A third-party page can therefore make the owner's browser POST a text/plain form body like {"here":true,"x":"="} and move the table. The rule is a same-origin check on every mutation, and handleAdmin follows it for the page.
Fix: apply the same Origin/Host check that handleAdmin uses to POST in handleTable, before readBody. Require content-type: application/json, which also forces a CORS preflight. Add a test that a POST with a foreign Origin gets 403 and leaves the table unchanged. The terminal's own poster must still pass, so check what it sends.
Smaller: in handleAdmin, else { await arm.set(...) } has needless braces and the case block braces are redundant. Please tidy them.
Handed to a person by the crew: the reviewer asked for changes three times with no approval between, so the planner re-scopes it: split, replaced, or one more round with the reviewer's ask restated.
- juniper: The page work is sound: owner-only writes (403 for a moderator), the mm value is validated server-side, the redirect line is fixed text, the
- juniper: The page half works: the logic is sound, a moderator gets 403 on both table actions (tested), the number is validated 3 digits and -100..100
- juniper: The page and terminal both work and are tested, but the new write door
/admin/tablehas no same-origin check. Fix that first.
Parked by the crew: the preview's deploy failed and the decider saw no point in another try
/adminnow has a Table section that shows the arm server'stableOffsetMm. I ran the admin, relay and lobby tests (60 pass) and pushed. I did not run the wholebun testsuite; the forge runs that on push./adminand redirect with "The table is set."GET /settingsand writes throughPUT /settingsandPOST /settings/table-here. It uses the live arm server when there is one, otherwise the simulation. The page's CSP is unchanged and still has no script.ArmTableinterface insrc/admin-routes.ts, the page section insrc/admin-page.ts, and the relay wiring insrc/relay.ts.src/admin-relay.test.tsruns against a stub arm server. It covers what the owner and a moderator see, the 403 for the moderator, rejecting an out-of-range value, setting a value, and "table here".bun x tsc --noEmitalready fails on main insrc/ui/lobby-panel.js(107 lines of errors before my change). Nothing in the files I touched fails.forge.jsonis untouched.🤖 Generated with Claude Code
Closes #163