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

Migrated from github.com/Trevato/SO-ARM100

The queue order, the current driver with their turn end, and the hold state survive a restart, kept under FORGE_APP_DATA #249

Parked opened this
Closed without merging

Turns now keeps the queue order, the driver with their turn end, and the hold in a file, and restores them on start. The turns tests pass (19, including the new file ones). The full suite ran once before a last test fix, with 485 pass and 2 fail.

Notes

stopped parked by the crew deploy c6cbbcf

opened this

Turns now keeps the queue order, the driver with their turn end, and the hold in a file, and restores them on start. The turns tests pass (19, including the new file ones). The full suite ran once before a last test fix, with 485 pass and 2 fail. One failure is in src/server.test.ts, where the vendored three.js route returns 404, and I didn't touch that code. I didn't identify the other. I didn't re-run the full suite after the final test fix. The type check didn't run: bun x tsc errors here because bun can't write to its tempdir.

  • What's kept: src/turns.ts takes an optional file and writes the queue, the driver (id, name, start, turn end, bonus time) and paused atomically on every emitted change. paused is the only hold state Turns has; there is no separate E-stop state. A failed write is logged and doesn't break a turn.
  • Restoring: a turn that ended during the downtime is dropped, and the head of the queue then takes over unless the hold is on. The restored driver's idle clock restarts at load. Entries that aren't valid people are skipped. A missing or unreadable file starts empty with one logged line.
  • Wiring: Lobby has a new turnsFile option, and bench/fake-serve.ts passes turns.json beside admin.json and chat.json under FORGE_APP_DATA/so101. forge.json is untouched.
  • Tests: src/turns.test.ts uses the injected clock to check three things. A new Turns on the same file has the same queue and driver. An expired turn is dropped and the line moves up. A corrupt or missing file starts empty. A fourth test checks that the hold and the line behind it come back.
  • Hold on restart: Lobby calls setPaused from the admin settings right after it creates the Turns, so on a relay restart the admin paused setting decides the hold. That setting is already persisted.

Closes #233

commented

Turns now keeps the queue order, the driver with their turn end, and the hold in a file, and restores them on start. The turns tests pass (19, including the new file ones). The full suite ran once before a last test fix, with 485 pass and 2 fail. One failure is in src/server.test.ts, where the vendored three.js route returns 404, and I didn't touch that code. I didn't identify the other. I didn't re-run the full suite after the final test fix. The type check didn't run: bun x tsc errors here because bun can't write to its tempdir.

  • What's kept: src/turns.ts takes an optional file and writes the queue, the driver (id, name, start, turn end, bonus time) and paused atomically on every emitted change. paused is the only hold state Turns has; there is no separate E-stop state. A failed write is logged and doesn't break a turn.
  • Restoring: a turn that ended during the downtime is dropped, and the head of the queue then takes over unless the hold is on. The restored driver's idle clock restarts at load. Entries that aren't valid people are skipped. A missing or unreadable file starts empty with one logged line.
  • Wiring: Lobby has a new turnsFile option, and bench/fake-serve.ts passes turns.json beside admin.json and chat.json under FORGE_APP_DATA/so101. forge.json is untouched.
  • Tests: src/turns.test.ts uses the injected clock to check three things. A new Turns on the same file has the same queue and driver. An expired turn is dropped and the line moves up. A corrupt or missing file starts empty. A fourth test checks that the hold and the line behind it come back.
  • Hold on restart: Lobby calls setPaused from the admin settings right after it creates the Turns, so on a relay restart the admin paused setting decides the hold. That setting is already persisted.
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