Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
/admin shows each joint's servo control registers in one read-only table #472
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
/admin now has a Servos section. It shows one row per joint and one column per register, with the arm's GET /servo-params read on the server each time the page loads. I ran the whole Software/so101 test suite (755 pass).
shipped merged
3 earlier comments · 1 event
/admin now has a Servos section. It shows one row per joint and one column per register, with the arm's GET /servo-params read on the server each time the page loads. I ran the whole Software/so101 test suite (755 pass). I added servo-panel.test.ts for this, and it passes. bun x tsc --noEmit reports errors in other files, but none in the files I touched. src/web is untouched, so I did not run design-lint.
- Columns: they are whichever registers the arm returns, taken from its answer.
- Silent servo: its row shows its error text, and any missing register shows "—".
- Someone driving: a 409 shows the sentence "Someone is driving the arm, so the servos are not read now…".
- Other failures: an arm that is unreachable or answers with something unexpected gets a sentence too, never a blank table.
- Escaping: every value from the arm is cut to a safe length, stripped of control characters and HTML-escaped.
- Owner only: the section appears only for the owner. A moderator sees
/adminwithout it, and anyone else gets 404.
The page logic is in the new src/servo-panel.ts. src/relay.ts fetches /servo-params with a timeout of at most 3 seconds and passes it through src/admin-routes.ts to src/admin-page.ts.
The new tests cover the table from a fixture, including escaping and the per-row errors, and the 409 sentence. They also cover the owner-versus-moderator-versus-404 behaviour against a fake arm.
The table, escaping, owner-only gating and tests are sound. Two items on the list are missed.
- README: nothing says the owner's /admin now has a read-only Servos section. The existing "Tuning the servos" section in Software/README.md (around line 937) lists GET /servo-params; add a sentence there saying where the owner sees it on /admin and when it shows a sentence instead (409 while someone drives, arm unreachable). Fix this first.
- Both doors: src/tty.ts is untouched, so the owner can read the registers on the page but not in the terminal. Either add the same owner-gated read to the terminal (using readServos for the same parsing, and a test that a guest sees nothing), or state in the pull why the terminal has no admin view. If the second, say so in the README.
Smaller: the preview /admin returned 404 to me without identity, which is expected, so I could not see the table as the owner; the unit and relay tests cover it.
/admin has a read-only Servos section for the owner, and the terminal has a matching /servos command. I ran terminal.test.ts and servo-panel.test.ts, and both pass. The earlier full run had passed before the terminal change, and I did not rerun it.
- README: the "Tuning the servos" section in
Software/README.mdnow says the owner sees the registers in/admin's Servos section and as/servosin the terminal. It also says that while someone drives (the 409) or when the arm doesn't answer, both show one sentence instead of a table, and that moderators and everyone else see neither. - Terminal:
/servosprints one line per joint, with its registers and any error. It usesreadServosfor the same parsing as the page, andsrc/tty.tsnow wires it up. The owner sees the same sentences as on the page for a 409 or an unreachable arm. A guest gets "servos are for the owner", and a door without a reader says "not available here". A new test interminal.test.tscovers all of these, including control characters being stripped.
I only filter for the owner. /servos goes through the relay's owner-only GET /servo-params, so the 404 for non-owners comes from the server, not the terminal.
I merged main into the branch and pushed it. The only conflict was in src/terminal.ts.
I kept both sides in both places:
- Help text: it now lists
/zero <joint> [deg] (owner)frommainand/servos (owner)from this branch. Typedunion: it has thezerovariant and theservosvariant.
terminal.test.ts and servo-panel.test.ts pass (38 tests), and tsc reports nothing in the files I touched. I did not rerun the full suite after the merge, so the rest rides on the forge's check.
I merged main into the branch again and pushed. The conflict was in src/terminal.ts, in the same two places as last time.
- Help text: I took
main's version, which now has/table here|touch 1|2|3|<mm>, and kept/servos (owner)in it. Typedunion: I tookmain'stablevariant, which now allows{ touch: 1 | 2 | 3 }, and kept theservosvariant.
terminal.test.ts and servo-panel.test.ts pass (39 tests), and tsc shows no errors in the files I touched. I did not rerun the full suite after the merge, so the rest rides on the forge's check.
Owner-only read-only Servos table on /admin plus /servos in the terminal. Every arm-supplied value is type-checked, length-capped, stripped of control characters and escaped. The relay gates the owner, and the tests cover a 404 for non-owners. The 409 sentence, the per-row errors and the terminal door are covered too. The README is updated. The preview answers 404 to an anonymous /admin, as expected, but I could not sign in as the owner to see the table itself. Two things I would do next: (1) the /admin GET now waits up to 3 s on the arm for the owner, so load it after the page paints or cache the read for a few seconds; (2) add a short caption or wrapper note for narrow phones so the wide register table scrolls with a visible hint.
/adminnow has a Servos section. It shows one row per joint and one column per register, with the arm'sGET /servo-paramsread on the server each time the page loads. I ran the wholeSoftware/so101test suite (755 pass). I addedservo-panel.test.tsfor this, and it passes.bun x tsc --noEmitreports errors in other files, but none in the files I touched.src/webis untouched, so I did not run design-lint./adminwithout it, and anyone else gets 404.The page logic is in the new
src/servo-panel.ts.src/relay.tsfetches/servo-paramswith a timeout of at most 3 seconds and passes it throughsrc/admin-routes.tstosrc/admin-page.ts.The new tests cover the table from a fixture, including escaping and the per-row errors, and the 409 sentence. They also cover the owner-versus-moderator-versus-404 behaviour against a fake arm.
Closes #443