Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
The workshop: one Pi, several stations (the arm and the grow box), each with cameras and controls; works with the arm unplugged #592
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
The home becomes a workshop with one card per station, and the arm no longer has to be plugged in. I ran only the tests near the change, and they pass. The full local run had 3 failures and 2 errors. I looked at two of them and didn't run the full suite on `main` to compare, so I can't say they were already failing. I did not typecheck: `tsc` couldn't find the `bun` type definitions here.
shipped merged
4 earlier comments · 2 events
The home becomes a workshop with one card per station, and the arm no longer has to be plugged in. I ran only the tests near the change, and they pass. The full local run had 3 failures and 2 errors. I looked at two of them and didn't run the full suite on main to compare, so I can't say they were already failing. I did not typecheck: tsc couldn't find the bun type definitions here.
- Stations config:
src/stations.tsholds the list instations.jsonunder the data dir. Each station has an id, name, kind (armorgrow), camera ids, and controls (a label and a path on this app). The owner edits it at/admin/stations/edit, linked from the admin bar.GET /stationsgives the same view as JSON. - Home:
src/workshop-page.tsrenders a card per station, with the live camera snapshot first and the controls after. Without astations.jsonthe config is the arm alone, so/is the viewer as before. Once any non-arm station is listed,/becomes the workshop. - Arm URL: the viewer is also at
/arm. - Arm unplugged: the arm card reads "The arm: not connected" and shows no controls. It counts as present only while the link to the Pi's
so101 serveis live. It comes back by itself when the arm does. A brief reconnect makes the card flicker to "not connected". - Serve with no serial port:
so101 servenow waits for the servo board and says so once, instead of exiting (src/arm-wait.ts). I did not makestartServeritself run without a bus. That is a larger split, and the wait is what keeps the service alive. - Title and story: the viewer title is now "Workshop · the arm".
docs/story.mdhas a paragraph about the workshop. I updated the title assertion inrelay.test.tsbecause the title changed on purpose. - Tests:
src/stations.test.tscovers validation, the config file, and the wait loop. It also boots the relay with no arm, checks that the grow card renders and its camera serves, then starts a fake arm and checks the arm card and/armappear.
The two failures I looked at are in server.test.ts (the vendored three file returns 404) and the STOP-interleaving relay test. Neither is in code I touched. I didn't look at the third failure or the two errors.
To get the grow box on the home, the owner has to add it on /admin/stations/edit. I did not seed it by default. I didn't run bench/fake-serve.ts (production's entry point) or design-lint.
🤖 Generated with Claude Code
First fix: src/cli.ts serve is (values) => { (not async) but now contains await waitForArm(...). That is a syntax error, so so101 serve (and the whole CLI module) cannot load. Make it async (values) => and add a test that loads/exercises it; the green tests missed it because none import cli.ts.
Also required:
- Both doors: stations are page and HTTP only. Nothing in src/tty.ts lists stations or lets the owner edit them, and the README says nothing about stations, the workshop home or /arm. Add both.
- Tests: nothing covers /admin/stations (401 for a guest, 403 for a non-owner, 400 on bad JSON, an oversized body, an owner PUT that persists) or the GET /stations gating. Each of those needs a test that fails without the code.
- Direction: the preview's
/is still the 'arm is offline' page, because nothing seeds a grow station. The pull's title promises the arm and the grow box, and the preview does not show it working. Seed a grow station (or show it by default) so it is visible without hand-editing JSON. - The workshop home has no 'signed in as' or sign-out (#580 asks for it on every page), no skip link or landmark nav, and it ignores the resting/closed state, so a closed arm still shows its card as present. It is also served before the resting page, so the owner's Open now button is unreachable from the home.
- Clean: the 'The owner's changes to the camera list.' doc comment now sits above stationViews; the import in stations.test.ts is stranded below a const; bench/fake-serve.ts is edited without need. The edit page is JS-only with a raw JSON textarea, which is poor on a phone; at least say so in the README.
I've fixed everything in the review except sign-out and the fake-serve.ts edit, and pushed to the branch. The tests I ran on the touched areas pass: stations, the CLI check, relay, terminal, resting, admin, story and README. I didn't run tsc (the sandbox has no bun types), the full suite or design-lint.
so101 serve: the handler is nowasync.cli-node.test.tstranspilescli.tsand fails if that handler stops being async. I didn't import it becauseserialportisn't installed in the sandbox.- Seeded grow box: with no
stations.json, the config is now the arm (camera 1) and the grow box (camera 2), so the preview's/is the workshop. The grow box's camera id is a guess, because I don't know which of the two cameras faces the box. The owner can correct it on the edit page. - Home page:
- Closed arm: it shows as not present, with its resting words and no cameras. The owner gets Open now on the card, and a guest or visitor does not.
- Navigation: the page has a skip link and a landmark nav.
- Who is looking: it shows "Signed in as …", or "Watching as a guest · Sign in".
- Sign-out: I didn't add it. /signout is #580's job and doesn't exist yet, so I left it there.
- Stations in the terminal:
/stationslists them and/stations set <json>(owner) replaces them, interminal.tsandtty.ts. - README: a new section covers the workshop home,
/arm, the config file and the three ways in. It says the edit page is a raw JSON box that needs JavaScript and is awkward on a phone. - Tests:
/admin/stationsreturns 401 for a guest, 403 for a visitor, 400 for bad JSON or a bad station, 413 for a body over 16 KB, and 405 for POST. The owner's PUT persists.GET /stationsis covered while the arm is closed and live, and so are the terminal commands. - Clean-up: I moved the orphaned comment back above
administer, grouped the imports instations.test.ts, and gave the oversized body a 413 instead of a generic error.
I kept the bench/fake-serve.ts edit. It is the only place the hub gets stations.json under FORGE_APP_DATA, so without it the owner's edits would not persist.
I also changed how an arm-only config behaves. The relay's own default is arm-only, so every existing test and any bare startRelay still serves the arm's page at /. The workshop default applies only through fake-serve.ts.
I merged main into the branch and pushed; the branch now merges cleanly. The stations, relay, terminal, admin-page, resting and CLI tests pass (98 pass, 0 fail). I didn't run the full suite or tsc.
admin-page.ts:main's signed-in line sits under the header, and my Stations link stays in the admin bar.terminal.ts:main'swhoamiand sign-out note are kept.HELPhas both/whoamiand/stations [set <json>].- Workshop home:
mainlanded the shared sign-in line (#587) while this pull was open. The home now uses it, so it shows "Signed in as … (this app/forge)", Sign out and "Switch forge account", or "Watching as a guest · Sign in". I removed my own copy of that line.stations.test.tsnow also checks that the home has the/signoutform. - Sign-out: my earlier note that sign-out was left to #580 no longer applies. The home has it now.
I merged main into the branch and pushed. The one conflict was in relay.ts, in three places.
- Imports: both sides kept, the stations imports and
main's camera-profile import. - Camera admin route:
main's/tryroute and cameras-page version are kept. The stations page constant sits beside them. - Handlers: the stations view and the
/admin/stationshandler now sit besidemain'stoPihelper and its newadminister(…, trying)signature.
The stations, relay, terminal, resting and CLI tests pass (90 pass, 0 fail). I haven't run the full suite.
The camera tests (src/camera*) pass except one failure that is an environment problem. The sandbox lacks the serialport package that cli.ts imports. That is the same missing package that stopped me importing cli.ts in a test earlier. I didn't run that file on main, so I haven't confirmed it fails there too.
Security, terminal parity, tests and README look sound: /admin/stations is owner-only (401/403 tested), body capped at 16 KB by bytes read, hrefs restricted to local paths, the terminal has /stations and /stations set, and the arm card comes back by itself. Two experience problems block it.
Fix first: the preview's home shows the Grow box as a bare heading. GET /stations on the preview gives grow present:true with cameras:[] (the seed guesses camera 2, which does not exist) and no controls, so a person sees a card with nothing in it and no words. A present station with no listed camera must say why (e.g. "No camera set up yet", and for the owner a link to /admin/stations/edit and /admin/camera-list). Add a test for that card.
Second: the orange pill buttons/links use white text on #f0883e in dark mode (about 2.3:1), which fails contrast. Use dark text on the accent in dark mode or a darker accent; design-lint was also not run.
Next after that: the stations editor is a raw JSON textarea that needs JS and is poor on a 360px phone; and a reconnect flicker makes the arm card say not connected, so consider a short grace before dropping it.
I fixed the two blocking problems and the reconnect flicker, and pushed. The stations editor is unchanged. The stations, relay and resting tests pass (47 pass, 0 fail). I haven't run the full suite.
- Grow box card with no camera: a present station with no listed camera now says "No camera set up yet." Controls still show when it has any. The owner also gets links to Cameras (
/admin/camera-list) and Stations (/admin/stations/edit). A test covers the guest and owner versions. - Contrast: buttons and control links now use dark text (
#1a1206) on the orange accent in dark mode, and white on the darker accent in light mode. Plain links use a readable blue in both. I didn't measure the contrast ratios. I did add a test that the dark-mode text colour is in the page. - Reconnect flicker: the arm's card now stays for 10 seconds after the link leaves live, as long as the link is reconnecting. A test closes the arm server and checks the card is still shown. After 10 seconds without recovery, or once the link goes offline, it drops as before.
- Stations editor: I did not change it. It is still a raw JSON box that needs JavaScript, and the README says so. A proper no-JS form with one row per station is a separate piece of work. I'd rather do it in a follow-up than grow this pull.
- design-lint: I couldn't run it.
scripts/design-lint.tsdoes not exist in this repository, and there is nosrc/web/here. - Seed camera: the grow box's seeded camera id (2) is still a guess, but the card now explains itself when that camera isn't listed.
Approved. The preview shows the workshop with the arm unplugged. The arm card says "The arm is offline right now" and has no controls. The grow box card is present. /stations answers for a guest. The home has a skip link, a landmark nav and the guest sign-in line, and the card grid fits a 360px phone. Writes are owner-gated through the signed identity, the body is capped by bytes read (413 tested), href is restricted to local paths, and the terminal has /stations and /stations set. The tests would fail without the change.
Two things to do next:
- The grow box is seeded with camera 2, which is a guess. On the preview it reads "No camera set up yet." and the guest sees a dead card. Seed the grow box from the camera list by name, or have the owner pick the camera on the card. Also replace the raw-JSON, JavaScript-only stations editor with a per-station form that works on a phone.
administerStationsis open to everyone whenlobbyis null (if (lobby && !who?.owner)). Production always has a lobby, but a write path should fail closed. Refuse writes when no lobby is configured. The home thumbnails are single snapshots, not live; refresh them every few seconds, or say they are stills.
The home becomes a workshop with one card per station, and the arm no longer has to be plugged in. I ran only the tests near the change, and they pass. The full local run had 3 failures and 2 errors. I looked at two of them and didn't run the full suite on
mainto compare, so I can't say they were already failing. I did not typecheck:tsccouldn't find thebuntype definitions here.src/stations.tsholds the list instations.jsonunder the data dir. Each station has an id, name, kind (armorgrow), camera ids, and controls (a label and a path on this app). The owner edits it at/admin/stations/edit, linked from the admin bar.GET /stationsgives the same view as JSON.src/workshop-page.tsrenders a card per station, with the live camera snapshot first and the controls after. Without astations.jsonthe config is the arm alone, so/is the viewer as before. Once any non-arm station is listed,/becomes the workshop./arm.so101 serveis live. It comes back by itself when the arm does. A brief reconnect makes the card flicker to "not connected".so101 servenow waits for the servo board and says so once, instead of exiting (src/arm-wait.ts). I did not makestartServeritself run without a bus. That is a larger split, and the wait is what keeps the service alive.docs/story.mdhas a paragraph about the workshop. I updated the title assertion inrelay.test.tsbecause the title changed on purpose.src/stations.test.tscovers validation, the config file, and the wait loop. It also boots the relay with no arm, checks that the grow card renders and its camera serves, then starts a fake arm and checks the arm card and/armappear.The two failures I looked at are in
server.test.ts(the vendoredthreefile returns 404) and the STOP-interleaving relay test. Neither is in code I touched. I didn't look at the third failure or the two errors.To get the grow box on the home, the owner has to add it on
/admin/stations/edit. I did not seed it by default. I didn't runbench/fake-serve.ts(production's entry point) ordesign-lint.🤖 Generated with Claude Code
Closes #581