Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
Open / Closed: the owner can close the arm, and a resting card tells visitors why (and when it is back) #568
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
The owner can now close the arm from the Open / Closed section at the top of `/admin` (or with `/close [note]` and `/open` in the terminal). Visitors at `/` then get a full-width card, **The arm is resting**, in place of the camera and controls. A real arm that hasn't answered for over 2 minutes shows the same card, worded **The arm is offline right now**. All 1024 tests pass, with no new type err…
shipped merged
The owner can now close the arm from the Open / Closed section at the top of /admin (or with /close [note] and /open in the terminal). Visitors at / then get a full-width card, The arm is resting, in place of the camera and controls. A real arm that hasn't answered for over 2 minutes shows the same card, worded The arm is offline right now. All 1024 tests pass, with no new type errors. I booted the app both open and closed: closed, / answered in about 3 ms, /status said open: false and POST /move got a 503.
- The switch (
src/opening.ts, kept inso101/open.jsonunderFORGE_APP_DATA): open or closed, an optional note of up to 140 characters, and an optional reopen time. On/adminthe time is a local-time input and the page sends its zone with it. Every change goes in the admin log. The owner's/liveframe{"type":"open",…}does the same thing. - Closed:
- Every turn ends, the owner's too, the line is emptied and nobody can join.
- Camera streams are refused, and open /follow and camera streams are closed.
- Anything sent to the arm except a STOP gets a 503. Stopping is never refused.
- /follow is closed with code 4503 and the reason "The arm is resting".
- The card (
src/resting-page.ts) is built on the server, with its style and its one inline script pinned in a strict Content-Security-Policy. It shows the note, when the arm should be back, when it was last open, a "Get notified when it's back" button, and links to/storyand the repo. It has no camera, no controls and no error banners. Its script checks/statusevery 20 s and reloads into the arm once it is open. A page that was open when the room closed reloads into the card. - Offline rule: the card appears when a real arm has been unreachable for more than 2 minutes, unless the owner pressed Open anyway after it went. That shows the simulation instead, as before. The card goes away by itself when the arm answers again.
GET /statusnow always hasopen. While resting it answers{open:false, reason, note, reopenAt, lastOpenAt}without asking the arm./livestill pushes a status, with no pose and the reason, so the launch check's 2-second status check still passes.- Tests:
src/opening.test.tscovers the rule, the input checks, saving the switch, closed turns and the lobby.src/resting.test.tscovers, end to end: no turn can start, commands are refused, the driver's stream closes, and an unreachable arm switches to the offline wording. It also checks the card's layout at 390×844 and 1440×900. That check reads the CSS; I took no screenshot because there's no browser in the sandbox. There are also tests for the terminal commands and the page reload.
What I chose not to do:
- No email notification. The app can't send mail, so it's the browser's own notification only, and only while that tab stays open.
- The reopen time is only shown. The arm never reopens by itself.
/storywill 404 until #565 lands. The card already links to it.- The app still listens to the arm while closed. It keeps its existing read-only connection to the arm, which is how it knows to clear the offline card. The owner's diagnostic panels on
/adminalso still read from the arm. Only commands are blocked.
To look at: once this is deployed, production will show the offline card about 2 minutes after start-up while its Pi is unreachable, where it used to show the simulation.
To try it: run bun run bench/fake-serve.ts, open /admin, close with a note and open /. curl /status shows the same state, and the terminal's /close Back Saturday 10am CT does it from there.
I found no prompt injection in the repository or the issues.
🤖 Generated with Claude Code
The owner can now close the arm from the Open / Closed section at the top of /admin (or with /close [note] and /open in the terminal). Visitors at / then get a full-width card, The arm is resting, in place of the camera and controls. A real arm that hasn't answered for over 2 minutes shows the same card, worded The arm is offline right now. All 1041 tests pass, with no new type errors.
- The switch (
src/opening.ts, kept inso101/open.jsonunderFORGE_APP_DATA): open or closed, an optional note of up to 140 characters, and an optional reopen time. On/adminthe time is a local-time input and the page sends its zone with it. Every change goes in the admin log. The owner's/liveframe{"type":"open",…}does the same thing. - Closed:
- Every turn ends, the owner's too, the line is emptied and nobody can join.
- Camera streams are refused, and open /follow and camera streams are closed.
- Anything sent to the arm except a STOP gets a 503. Stopping is never refused.
- /follow is closed with code 4503 and the reason "The arm is resting".
- The card (
src/resting-page.ts) is built on the server, with its style and its one inline script pinned in a strict Content-Security-Policy. It shows the note, when the arm should be back, when it was last open, a "Get notified when it's back" button, and links to/storyand the repo. It has no camera, no controls and no error banners. Its script checks/statusevery 20 s and reloads into the arm once it is open. A page that was open when the room closed reloads into the card. - Offline rule: the card appears when a real arm has been unreachable for more than 2 minutes, unless the owner pressed Open anyway after it went. That shows the simulation instead, as before. The card goes away by itself when the arm answers again.
GET /statusnow always hasopen. While resting it answers{open:false, reason, note, reopenAt, lastOpenAt}without asking the arm./livestill pushes a status, with no pose and the reason, so the launch check's 2-second status check still passes.- Merged
main:README.mdkeeps both the Open / Closed section and the new story page section./storystays up while the arm rests. Its camera slot now says "The camera is not connected right now" while resting, because the camera stream it embedded is refused then and would show a broken image. A test covers this. - Tests:
src/opening.test.tscovers the rule, the input checks, saving the switch, closed turns and the lobby.src/resting.test.tscovers, end to end: no turn can start, commands are refused, the driver's stream closes, and an unreachable arm switches to the offline wording. It also checks the card's layout at 390×844 and 1440×900. That check reads the CSS; I took no screenshot because there's no browser in the sandbox. There are also tests for the terminal commands and the page reload.
What I chose not to do:
- No email notification. The app can't send mail, so it's the browser's own notification only, and only while that tab stays open.
- The reopen time is only shown. The arm never reopens by itself.
- The app still listens to the arm while closed. It keeps its existing read-only connection to the arm, which is how it knows to clear the offline card. The owner's diagnostic panels on
/adminalso still read from the arm. Only commands are blocked.
To look at: once this is deployed, production will show the offline card about 2 minutes after start-up while its Pi is unreachable, where it used to show the simulation.
To try it: run bun run bench/fake-serve.ts, open /admin, close with a note and open /. curl /status shows the same state, and the terminal's /close Back Saturday 10am CT does it from there.
I found no prompt injection in the repository or the issues.
🤖 Generated with Claude Code
Approved. The owner-only switch is checked at the lobby boundary (setOpen requires owner; the /live frame, /admin form and terminal all go through it), the input is validated (140-char note, zoned reopen time, no unknown fields, note escaped on every output), state lives under FORGE_APP_DATA, and the resting card is server-rendered, hash-pinned CSP, 44px targets, readable with JS off, with a live-reload path. STOP stays reachable while everything else is 503, and the tests cover the rule, parsing, persistence, closed turns and the lobby. The preview is open and healthy (/ 200, /status carries open:true, /story 200); I could not exercise the closed state there because closing is owner-only, and the card source I could read was cut off in the diff I was given, so the card and terminal commands are judged from the tests and description.
Two things I would do next: (1) tidy small leftovers: in admin-page.ts the doc comment for scriptFor now sits above the ZONE_SCRIPT comment so it describes the wrong constant, and lobby.ts gained a stray trailing blank line; (2) watch production after the deploy: with the Pi unreachable it will now show the offline card after 2 minutes instead of the simulation (disclosed in the pull), so confirm that is what the owner wants and that the Open anyway button gets used as intended.
The owner can now close the arm from the Open / Closed section at the top of
/admin(or with/close [note]and/openin the terminal). Visitors at/then get a full-width card, The arm is resting, in place of the camera and controls. A real arm that hasn't answered for over 2 minutes shows the same card, worded The arm is offline right now. All 1024 tests pass, with no new type errors. I booted the app both open and closed: closed,/answered in about 3 ms,/statussaidopen: falseandPOST /movegot a 503.src/opening.ts, kept inso101/open.jsonunderFORGE_APP_DATA): open or closed, an optional note of up to 140 characters, and an optional reopen time. On/adminthe time is a local-time input and the page sends its zone with it. Every change goes in the admin log. The owner's/liveframe{"type":"open",…}does the same thing.- Every turn ends, the owner's too, the line is emptied and nobody can join. - Camera streams are refused, and open
/followand camera streams are closed. - Anything sent to the arm except a STOP gets a 503. Stopping is never refused. -/followis closed with code 4503 and the reason "The arm is resting".src/resting-page.ts) is built on the server, with its style and its one inline script pinned in a strict Content-Security-Policy. It shows the note, when the arm should be back, when it was last open, a "Get notified when it's back" button, and links to/storyand the repo. It has no camera, no controls and no error banners. Its script checks/statusevery 20 s and reloads into the arm once it is open. A page that was open when the room closed reloads into the card.GET /statusnow always hasopen. While resting it answers{open:false, reason, note, reopenAt, lastOpenAt}without asking the arm./livestill pushes a status, with no pose and the reason, so the launch check's 2-second status check still passes.src/opening.test.tscovers the rule, the input checks, saving the switch, closed turns and the lobby.src/resting.test.tscovers, end to end: no turn can start, commands are refused, the driver's stream closes, and an unreachable arm switches to the offline wording. It also checks the card's layout at 390×844 and 1440×900. That check reads the CSS; I took no screenshot because there's no browser in the sandbox. There are also tests for the terminal commands and the page reload.What I chose not to do:
/storywill 404 until #565 lands. The card already links to it./adminalso still read from the arm. Only commands are blocked.To look at: once this is deployed, production will show the offline card about 2 minutes after start-up while its Pi is unreachable, where it used to show the simulation.
To try it: run
bun run bench/fake-serve.ts, open/admin, close with a note and open/.curl /statusshows the same state, and the terminal's/close Back Saturday 10am CTdoes it from there.I found no prompt injection in the repository or the issues.
🤖 Generated with Claude Code
Closes #563