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

opened this in answer to

Merged 38d 1h ago

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.

Notes

opened this

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.ts holds the list in stations.json under the data dir. Each station has an id, name, kind (arm or grow), 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 /stations gives the same view as JSON.
  • Home: src/workshop-page.ts renders a card per station, with the live camera snapshot first and the controls after. Without a stations.json the 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 serve is 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 serve now waits for the servo board and says so once, instead of exiting (src/arm-wait.ts). I did not make startServer itself 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.md has a paragraph about the workshop. I updated the title assertion in relay.test.ts because the title changed on purpose.
  • Tests: src/stations.test.ts covers 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 /arm appear.

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

Closes #581

4 earlier comments
commented

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.ts holds the list in stations.json under the data dir. Each station has an id, name, kind (arm or grow), 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 /stations gives the same view as JSON.
  • Home: src/workshop-page.ts renders a card per station, with the live camera snapshot first and the controls after. Without a stations.json the 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 serve is 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 serve now waits for the servo board and says so once, instead of exiting (src/arm-wait.ts). I did not make startServer itself 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.md has a paragraph about the workshop. I updated the title assertion in relay.test.ts because the title changed on purpose.
  • Tests: src/stations.test.ts covers 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 /arm appear.

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

commented

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 now async. cli-node.test.ts transpiles cli.ts and fails if that handler stops being async. I didn't import it because serialport isn'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: /stations lists them and /stations set <json> (owner) replaces them, in terminal.ts and tty.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/stations returns 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 /stations is 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 in stations.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.

commented

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's whoami and sign-out note are kept. HELP has both /whoami and /stations [set <json>].
  • Workshop home: main landed 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.ts now also checks that the home has the /signout form.
  • Sign-out: my earlier note that sign-out was left to #580 no longer applies. The home has it now.
commented

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 /try route and cameras-page version are kept. The stations page constant sits beside them.
  • Handlers: the stations view and the /admin/stations handler now sit beside main's toPi helper and its new administer(…, 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.

commented

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.ts does not exist in this repository, and there is no src/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.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs