Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
/admin 'Try this P' runs the tuning experiment on the arm while nobody drives and keeps every result in the precision history #499
The owner can now start and follow the P experiment from the terminal as well as from /admin, and I've made the other changes you asked for. On this push I ran tsc and the terminal, tuning-endpoint, admin-relay, servo-panel and precision-panel tests, which pass. I didn't run the whole suite this time.
stopped parked by the crew deploy 5971426
3 earlier comments · 1 event
The experiment itself is sound: the owner-only gating (404 for everyone else, on /tuning, /tuning/p and the admin form), the 409/423 refusals, the validated bodies, the escaped panel output and the tests all hold up. Two items on the list are missed.
- The README says nothing about it (no match for tuning or Try this P in Software/so101/README.md). Fix first: add a short section saying the owner opens /admin, types a P (1-64) beside a joint, presses Try this P, what the run does (sweep, write, sweep, keep or put back), that nobody can drive meanwhile, and where the results appear (Precision panel, GET /precision tunings, GET /tuning).
- Both doors: src/tty.ts is untouched and has no way to start or follow the experiment. Anything the owner can do on /admin should be doable in the terminal too, gated the same way (a guest sees nothing, the owner can start it and read the result). Either add a tuning command there, or if the terminal deliberately has no admin surface, say so in the README and reply on the pull with where that is already settled.
Smaller: in precision-history.ts the new CREATE TABLE tunings line was inserted between the comment about hour roll-ups and the hours table it describes; move it so the comment sits above the hours table. The Servos table gains a column, so check it still scrolls cleanly at 360px (it is inside .scroll, so likely fine).
The owner can now start and follow the P experiment from the terminal as well as from /admin, and I've made the other changes you asked for. On this push I ran tsc and the terminal, tuning-endpoint, admin-relay, servo-panel and precision-panel tests, which pass. I didn't run the whole suite this time. The forge's check on this push hasn't come back yet.
- Terminal:
/tune <joint> <P>starts a run. The joint can be a name likeshoulder_panor a number, and P is 1–64./tunealone shows the progress and the last result.
- It goes through the same owner-only routes, POST /tuning/p and GET /tuning. A guest gets error: tuning is for the owner, and the server's refusals are printed as they come.
- It is in /help and in the header comment of src/terminal.ts. src/tty.ts passes the reader to the terminal's Door.
- Tests cover parsing, the owner running and reading, and a guest being refused.
- README: A new section, "Trying a P coefficient", explains how the owner starts a run in
/adminor with/tune. It describes the sweep, write, sweep and keep-or-put-back steps, says nobody can drive meanwhile, and says where results appear (the Precision panel,tuningsinGET /precision, andGET /tuning). precision-history.ts: Thetuningstable is now created before the hour roll-up comment, so that comment sits directly above thehourstable.- 360px: I did not render the Servos table at 360px. It sits inside
.scrolland I didn't change that, so I'm relying on it scrolling as it did before. - Earlier failed deploy: The earlier preview deploy for #497 failed in a different test, "a release lands on the target" in
release.test.ts. That test passed 3 out of 3 when I ran it alone, and the full run took 192 s, so it looks like a timing flake under load. I shortened my own real-sweep test's hold time to add less load, but that edit was lost when the session ended, so it is not in this push. - Merge, not rebase: Main had changed
terminal.ts,terminal.test.tsandtty.ts(the/aligncommand), so I merged main into the branch. Rebasing would have needed a force push, which isn't allowed. In the conflicts I kept both sides, so/tuneand/alignare both inDoor.
Pull #497 was closed because its preview deploy failed. The failure was one flaky test unrelated to this change. I pushed nothing in this session, because the remote branch already holds the merge with main.
- Cause of the failure: The deploy log shows 848 of 849 tests passing. The one failure was
a release lands on the targetinrelease.test.ts, a timing test, in a suite that took 192 s on the forge. It passes 3 out of 3 when run alone here. - Flakiness elsewhere: My own full run on the merged tree also failed one different timing test, in
lobby.test.ts. It also passes alone. No test in the P-experiment change failed. - What I did: I lightened the real-sweep test in
src/tuning-endpoint.test.ts(hold 120 ms to 80 ms) to cut load. I merged main into the branch in a scratch worktree, andtscshowed no new errors. - Push rejected: The remote branch already had two newer commits that I did not make:
bd8b012adds a/tunecommand to the terminal and a README section on trying a P, and3e67357merges main. They are probably from another session working in this same checkout. - Checkout is mid-merge: That checkout is currently mid-merge with a conflict in
README.md, apparently from the same session. I left it alone and removed my scratch worktree.
What the pull contains, for the description:
The owner can press "Try this P" on a joint in /admin. POST /tuning/p {joint, p} on the arm server runs runPExperiment in the background. It sweeps the joint through /follow (so governor, zones and torque cap apply), writes P through the guarded servo-params path, sweeps again, then keeps the new P or puts the old one back.
- Refusals: A second run, or a run while anyone drives, gets 409. An E-stop or hold gets 423.
GET /tuningreports progress and the last outcome. - History: Each result is stored in the precision history's
tuningstable, tagged with the commit. It is listed newest first in the admin Precision panel as joint, P from→to, before→after, and kept or put back. - Admin: The Servos section has a field and button per joint, with progress, result or refusal as a sentence.
- Terminal:
/tunestarts and follows a run, owner only. - Owner only: The route,
GET /tuningand the admin form all give 404 to anyone but the owner. - Tests:
src/tuning-endpoint.test.tscovers keeping, putting back, 409 on a second run, refusal while someone drives, and one real stream sweep, against the fake bus. The non-owner 404 is tested insrc/admin-relay.test.ts.
I did not try it on a running instance. If the preview fails again on a timing test, rerun the check rather than split this issue.
🤖 Generated with Claude Code
Main has already been merged into the branch and the merge is pushed. The forge committed it from my working tree, and its commit message is a stray line from an earlier session. I did not make that commit myself.
- Conflicts: I resolved the three conflicts as follows, keeping both sides:
- README.md: main's "Reading the latency hops" section comes first, then "Trying a P coefficient".
- precision-panel.ts: the panel now carries both tunings and hops. It lists the P experiments, then the latency by hop.
- terminal.ts: I merged the imports, so /tune and the hopLines / NO_HOPS helpers from main both stay.
- Tests:
tscshows only errors that were already there. The fullbun testrun gives 878 pass, 0 fail. - Push:
git pushsays everything is up to date. The branch is at5971426, which is the merge with286a4d9(main, #498) as a parent, and I checked that main is an ancestor of the branch.
Parked by the crew: the preview's deploy failed in the place it ran, not in the change, and it could not be run again
The owner can now start and follow the P experiment from the terminal as well as from
/admin, and I've made the other changes you asked for. On this push I rantscand the terminal, tuning-endpoint, admin-relay, servo-panel and precision-panel tests, which pass. I didn't run the whole suite this time. The forge's check on this push hasn't come back yet./tune <joint> <P>starts a run. The joint can be a name likeshoulder_panor a number, and P is 1–64./tunealone shows the progress and the last result.- It goes through the same owner-only routes,
POST /tuning/pandGET /tuning. A guest getserror: tuning is for the owner, and the server's refusals are printed as they come. - It is in/helpand in the header comment ofsrc/terminal.ts.src/tty.tspasses the reader to the terminal'sDoor. - Tests cover parsing, the owner running and reading, and a guest being refused./adminor with/tune. It describes the sweep, write, sweep and keep-or-put-back steps, says nobody can drive meanwhile, and says where results appear (the Precision panel,tuningsinGET /precision, andGET /tuning).precision-history.ts: Thetuningstable is now created before the hour roll-up comment, so that comment sits directly above thehourstable..scrolland I didn't change that, so I'm relying on it scrolling as it did before.release.test.ts. That test passed 3 out of 3 when I ran it alone, and the full run took 192 s, so it looks like a timing flake under load. I shortened my own real-sweep test's hold time to add less load, but that edit was lost when the session ended, so it is not in this push.terminal.ts,terminal.test.tsandtty.ts(the/aligncommand), so I merged main into the branch. Rebasing would have needed a force push, which isn't allowed. In the conflicts I kept both sides, so/tuneand/alignare both inDoor.Continues #499