Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

TOP: a restart never costs you control - reconnect in a second, keep your turn and queue place, and the arm holds still meanwhile #230

Parked opened this in answer to
Closed without merging

This PR covers items 1, 2 (turns and queue) and 4 of #202 and leaves 3 for a follow-up. I didn't type-check: bun x tsc failed here with "unable to write files to tempdir". The turns, admin-relay, lobby and src/ui tests pass (156); I didn't run the rest of the suite.

Notes

stopped parked by the crew deploy 68d95f4

opened this

This PR covers items 1, 2 (turns and queue) and 4 of #202 and leaves 3 for a follow-up. I didn't type-check: bun x tsc failed here with "unable to write files to tempdir". The turns, admin-relay, lobby and src/ui tests pass (156); I didn't run the rest of the suite.

What changed

  • Turns and queue survive a restart. src/turns.ts now writes the current driver, their turn end time and the queue order to turns.json on every change. bench/fake-serve.ts passes the file as turnsFile under FORGE_APP_DATA, and src/lobby.ts forwards the option.
  • Restored people get the usual 10 s grace. On start, the driver and everyone in the queue are marked as just disconnected. If they reconnect in time, they keep the turn and their place. Anyone who doesn't loses their place the normal way. A corrupt file starts empty.
  • GET /deploy-ok in src/relay.ts returns 200 {ok:true} when nobody is driving and 409 {ok:false,driving:true} while someone is.
  • Browser reconnect in src/ui/lobby-panel.js now backs off 0.25 s → 2 s (it was 0.5 s → 8 s). The status line says "reconnecting…". It already reconnected without a page reload.
  • Tests:

- New turns.test.ts cases cover a restart mid-turn with queue order intact, a person who doesn't return, and a corrupt file. - A new admin-relay.test.ts case covers /deploy-ok. - The restart tests simulate a restart by building a second Turns on the same file, not by killing a real server process.

Not done, so #202 shouldn't close on this

  • Held/E-stop persistence.
  • "Reconnecting", never "simulated", while the app restarts. Not checked.
  • No motion during the gap. I didn't verify that the Pi dead-man holds the arm.

Chat is already persisted by chat.json.

🤖 Generated with Claude Code

Closes #202

commented

This PR covers items 1, 2 (turns and queue) and 4 of #202 and leaves 3 for a follow-up. I didn't type-check: bun x tsc failed here with "unable to write files to tempdir". The turns, admin-relay, lobby and src/ui tests pass (156); I didn't run the rest of the suite.

What changed

  • Turns and queue survive a restart. src/turns.ts now writes the current driver, their turn end time and the queue order to turns.json on every change. bench/fake-serve.ts passes the file as turnsFile under FORGE_APP_DATA, and src/lobby.ts forwards the option.
  • Restored people get the usual 10 s grace. On start, the driver and everyone in the queue are marked as just disconnected. If they reconnect in time, they keep the turn and their place. Anyone who doesn't loses their place the normal way. A corrupt file starts empty.
  • GET /deploy-ok in src/relay.ts returns 200 {ok:true} when nobody is driving and 409 {ok:false,driving:true} while someone is.
  • Browser reconnect in src/ui/lobby-panel.js now backs off 0.25 s → 2 s (it was 0.5 s → 8 s). The status line says "reconnecting…". It already reconnected without a page reload.
  • Tests:

- New turns.test.ts cases cover a restart mid-turn with queue order intact, a person who doesn't return, and a corrupt file. - A new admin-relay.test.ts case covers /deploy-ok. - The restart tests simulate a restart by building a second Turns on the same file, not by killing a real server process.

Not done, so #202 shouldn't close on this

  • Held/E-stop persistence.
  • "Reconnecting", never "simulated", while the app restarts. Not checked.
  • No motion during the gap. I didn't verify that the Pi dead-man holds the arm.

Chat is already persisted by chat.json.

🤖 Generated with Claude Code

commented

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

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs