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

Migrated from github.com/Trevato/SO-ARM100

The relay's minute sample records pi:temp and pi:undervolt from the arm's GET /health/pi into facts (no chart) #551

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's minute sample now records the Pi's temperature and under-voltage flag from the arm's GET /health/pi. I ran bun test src/facts.test.ts src/relay.test.ts (36 pass) and have pushed. I did not run bun --cwd Software/so101 test, the full suite.

Notes

shipped merged

opened this

The relay's minute sample now records the Pi's temperature and under-voltage flag from the arm's GET /health/pi. I ran bun test src/facts.test.ts src/relay.test.ts (36 pass) and have pushed. I did not run bun --cwd Software/so101 test, the full suite. tsc --noEmit couldn't resolve the bun type definitions in this sandbox, so I have no type-check result.

  • Sampling: before each sample, the relay fetches /health/pi from the live arm (or the simulation) with a timeout of at most 1 s. If the arm is unreachable, slow, non-OK or answers nulls, the sample lands without those two values.
  • Storage: samples gains nullable pi_temp and pi_undervolt columns, added to an existing facts.sqlite on open. samples() returns piTemp and piUndervolt only when they were recorded. A new parsePiHealth in src/facts.ts keeps only a finite tempC and a boolean underVoltage. The wiring is in src/relay.ts.
  • Tests: in src/facts.test.ts, a fake arm gives a sample with both values. An unreachable arm, a null answer and a 404 each give a sample with neither value and the other fields intact.
  • Scope: there is no page or chart change.

Closes #545

commented

The relay's minute sample now records the Pi's temperature and under-voltage flag from the arm's GET /health/pi. I ran bun test src/facts.test.ts src/relay.test.ts (36 pass) and have pushed. I did not run bun --cwd Software/so101 test, the full suite. tsc --noEmit couldn't resolve the bun type definitions in this sandbox, so I have no type-check result.

  • Sampling: before each sample, the relay fetches /health/pi from the live arm (or the simulation) with a timeout of at most 1 s. If the arm is unreachable, slow, non-OK or answers nulls, the sample lands without those two values.
  • Storage: samples gains nullable pi_temp and pi_undervolt columns, added to an existing facts.sqlite on open. samples() returns piTemp and piUndervolt only when they were recorded. A new parsePiHealth in src/facts.ts keeps only a finite tempC and a boolean underVoltage. The wiring is in src/relay.ts.
  • Tests: in src/facts.test.ts, a fake arm gives a sample with both values. An unreachable arm, a null answer and a 404 each give a sample with neither value and the other fields intact.
  • Scope: there is no page or chart change.
Approved

Does what #540/#539 left open and nothing more: the minute sample stores pi_temp and pi_undervolt from the arm GET /health/pi. No page, no chart, no dependency. The fetch follows the same pattern as the neighbouring arm reads (1 s cap, no-store, errors swallowed). parsePiHealth keeps only a finite number and a boolean. The new columns are added by migration and are nullable. The tests cover the stored values and the unreachable, null and 404 cases. The preview answers 200. Two things to do next: (1) run the full bun test and tsc, which the builder did not run; (2) sample timestamp is taken after the up-to-1s fetch, so take it before the await if exact minute alignment matters.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs