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

Migrated from github.com/Trevato/SO-ARM100

The relay keeps the arm's first /servo-params read as the factory baseline under FORGE_APP_DATA, owner-only at GET /servo-params/factory #462

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

The relay now records the arm's first complete /servo-params read as servo-factory.json under FORGEAPPDATA. The owner can fetch it at GET /servo-params/factory. The new tests, src/relay.test.ts, src/admin-relay.test.ts and src/relay-restart.test.ts pass.

Notes

shipped merged

opened this

The relay now records the arm's first complete /servo-params read as servo-factory.json under FORGE_APP_DATA. The owner can fetch it at GET /servo-params/factory. The new tests, src/relay.test.ts, src/admin-relay.test.ts and src/relay-restart.test.ts pass. I did not run the whole bun --cwd Software/so101 test suite; the forge runs that check on the push. The type check could not run here because bun x tsc --noEmit can't find the bun types.

  • Recording: src/servo-baseline.ts holds a small ServoBaseline class that writes the file atomically and never overwrites it. It refuses a read where any servo has an error. The relay reads once per connect (recordBaseline in src/relay.ts), only when the link is live and the arm server has reported its run id (armRun). It gives up quietly if someone holds a turn or the read fails, and tries again on the next connect. It is on only where baselineFile is given, and bench/fake-serve.ts now gives it one.
  • Route: GET /servo-params/factory returns the file to the owner. It returns 404 to everyone else, and to the owner until a baseline exists.
  • Tests: src/servo-baseline.test.ts uses a fake arm server and covers these cases:

- The first connect records the file. - A second connect leaves it unchanged. - A partial read is not saved and is retried on the next connect. - A restart keeps the file. - A non-owner gets 404. - Nothing is read while a turn is held.

  • README: Software/README.md has a new "Servo factory baseline" section saying where the file lives and that #450's factory restore and the tuning pulls read from it.

🤖 Generated with Claude Code

Closes #459

commented

The relay now records the arm's first complete /servo-params read as servo-factory.json under FORGE_APP_DATA. The owner can fetch it at GET /servo-params/factory. The new tests, src/relay.test.ts, src/admin-relay.test.ts and src/relay-restart.test.ts pass. I did not run the whole bun --cwd Software/so101 test suite; the forge runs that check on the push. The type check could not run here because bun x tsc --noEmit can't find the bun types.

  • Recording: src/servo-baseline.ts holds a small ServoBaseline class that writes the file atomically and never overwrites it. It refuses a read where any servo has an error. The relay reads once per connect (recordBaseline in src/relay.ts), only when the link is live and the arm server has reported its run id (armRun). It gives up quietly if someone holds a turn or the read fails, and tries again on the next connect. It is on only where baselineFile is given, and bench/fake-serve.ts now gives it one.
  • Route: GET /servo-params/factory returns the file to the owner. It returns 404 to everyone else, and to the owner until a baseline exists.
  • Tests: src/servo-baseline.test.ts uses a fake arm server and covers these cases:

- The first connect records the file. - A second connect leaves it unchanged. - A partial read is not saved and is retried on the next connect. - A restart keeps the file. - A non-owner gets 404. - Nothing is read while a turn is held.

  • README: Software/README.md has a new "Servo factory baseline" section saying where the file lives and that #450's factory restore and the tuning pulls read from it.

🤖 Generated with Claude Code

Approved

Approved. The baseline is recorded atomically and never overwritten. A partial read is refused and retried on the next connect. Nothing is read while a turn is held. The route is owner-only and returns 404 to everyone else, including before a baseline exists. The entry forge.json runs (fake-serve.ts) passes baselineFile, so the feature is on in the app. Four tests cover the behaviours and would fail without the change. The README section is there. The preview answers 404 to an anonymous GET /servo-params/factory, as intended. I could not check the owner path there because I have no owner identity. There is no new dependency and no UI, so nothing for the terminal door to mirror.

Two things to do next:

  1. Make recorded() tolerate a corrupt or empty servo-factory.json. Today existsSync treats it as recorded, so it is never replaced and the owner route serves garbage. Validate the JSON in text() or recorded().
  2. The README should name servo-factory.json next to the other files kept under FORGE_APP_DATA, and a test should show the baseline file is not written when baselineFile is omitted.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs