fix(calibration): add explicit "Save port" button so ports can be updated without recalibrating (#53)#59
Conversation
SO-101 serial ports change on reconnect, and the only *visible* way to update a robot's port was to redo the entire calibration. The port already autosaves on blur (027575b), but with no button or confirmation users don't realize it — hence issue huggingface#53 ("Missing save button during calibration"). Add a visible "Save" button next to the port field that persists the port to the robot record and shows a confirmation toast, plus a hint line noting ports can change on reconnect. persistPort() now returns a result so the button can report success/failure. No backend change — POST /robots/{name} already supports partial (port-only) updates. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nicolas-rabault
left a comment
There was a problem hiding this comment.
Thanks for digging into this. The root-cause analysis is spot on. But I think it points to a lighter fix than the button.
As you note, persistPort() already autosaves the port on blur and on re-detection (handlePortDetected), keyed by the robot config name. So the port already updates independently of calibration; #53's "only way is to recalibrate" was stale by the time it was written. The reporter just didn't get any feedback that the save happened.
Given that, the real gap is visibility, not a missing action — and a Save button duplicates the onBlur autosave that already fires. I'd rather not add a manual save step for something that already saves on its own.
Proposal, minus the button:
- Move the confirmation toast into
persistPort()itself, fired only when the value actually changed (it already early-returns onunchanged). Then editing or re-detecting the port shows "Saved<port>for the leader/follower, no recalibration needed" with zero extra clicks. - Keep the one-line hint under the field. That's the part that actually closes the discoverability gap.
- Drop the Save button and the
handleSavePorthandler.
Keeping persistPort's "saved" | "unchanged" | "skipped" | "error" return is still useful for the toast logic. Net result is the same UX #53 asked for (visible confirmation, no recalibration) with less surface area.
WDYT?
Problem
Fixes #53.
The SO-101 uses serial, so its port (
/dev/tty.usbmodem…,COM…) changes when the arm is unplugged/reconnected. As the issue reports, the only visible way to update a robot's saved port was to redo the entire calibration.Root cause
The port already does autosave:
persistPort()inCalibration.tsxwrites the port to the robot record on input blur and on port-detection (added in 027575b, ~2 weeks before this issue was filed). But it's silent — no button, no confirmation — so users don't realize the change was saved and reasonably assume recalibration is the only path. Hence "Missing save button during calibration."Fix (frontend only)
Saved <port> for the leader/follower — no recalibration needed).persistPort()now returns"saved" | "unchanged" | "skipped" | "error"(and checksres.ok) so the button can report success/failure. The existing silent onBlur / on-detect autosave is unchanged.No backend change —
POST /robots/{name}already does partial (port-only) merges viasave_robot_record.Testing
npm run build✓ andeslint src/pages/Calibration.tsx✓ (clean).frontend/dist/intentionally not committed — CI (build_frontend.yml) rebuilds it on merge.🤖 Generated with Claude Code