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

Migrated from github.com/Trevato/SO-ARM100

When a turn ends, the relay fetches its trace from GET /precision/trace and stores it with the turn in facts (capped, gone at 90 days) #552

Parked opened this
Closed without merging

When a turn ends, the relay now fetches that turn's trace from the arm's `GET /precision/trace` and stores it with the turn's row in facts. I ran the facts, relay and precision suites (74 pass) but not the whole `bun --cwd Software/so101 test`. The type check shows no errors in the files I changed; it reports errors elsewhere in the project, such as `src/ui/zone-notes.js` and `src/visitor-counts.t…

stopped parked by the crew deploy dcba1df

opened this

When a turn ends, the relay now fetches that turn's trace from the arm's GET /precision/trace and stores it with the turn's row in facts. I ran the facts, relay and precision suites (74 pass) but not the whole bun --cwd Software/so101 test. The type check shows no errors in the files I changed; it reports errors elsewhere in the project, such as src/ui/zone-notes.js and src/visitor-counts.ts.

  • Which session: the arm didn't expose a session id, so I added an optional id to the stored session rows in GET /precision's sessions list (src/precision-history.ts). It's the only change on the arm side. The hourly rows get no id.
  • Fetch: right after the existing 1-second card fetch, the relay picks the newest stored session that ended at or after the turn's start and fetches its trace once, with a 2-second timeout. It runs after the turn's row is written, so it never delays the row.
  • 404 or no route: if the arm has no route, the trace fetch returns a non-OK status, or no session matches, nothing is stored. The row and its card are unaffected.
  • Storage: a traces table in src/facts.ts, keyed by turn id. facts.traceFor(turnId) returns the stored trace, or null if there is none.
  • Cap: a trace over 256 KB keeps its first samples per joint and is marked truncated: true.
  • Retention: traces are pruned at 90 days, using the time the turn ended.
  • Tests: new tests in src/facts.test.ts cover the round trip, the cap, retention, and picking the session. A relay test covers the stored trace and the 404 case, where the row is still there.

No API or page change on the relay.

Closes #547

commented

When a turn ends, the relay now fetches that turn's trace from the arm's GET /precision/trace and stores it with the turn's row in facts. I ran the facts, relay and precision suites (74 pass) but not the whole bun --cwd Software/so101 test. The type check shows no errors in the files I changed; it reports errors elsewhere in the project, such as src/ui/zone-notes.js and src/visitor-counts.ts.

  • Which session: the arm didn't expose a session id, so I added an optional id to the stored session rows in GET /precision's sessions list (src/precision-history.ts). It's the only change on the arm side. The hourly rows get no id.
  • Fetch: right after the existing 1-second card fetch, the relay picks the newest stored session that ended at or after the turn's start and fetches its trace once, with a 2-second timeout. It runs after the turn's row is written, so it never delays the row.
  • 404 or no route: if the arm has no route, the trace fetch returns a non-OK status, or no session matches, nothing is stored. The row and its card are unaffected.
  • Storage: a traces table in src/facts.ts, keyed by turn id. facts.traceFor(turnId) returns the stored trace, or null if there is none.
  • Cap: a trace over 256 KB keeps its first samples per joint and is marked truncated: true.
  • Retention: traces are pruned at 90 days, using the time the turn ended.
  • Tests: new tests in src/facts.test.ts cover the round trip, the cap, retention, and picking the session. A relay test covers the stored trace and the 404 case, where the row is still there.

No API or page change on the relay.

commented

Parked by the crew: the preview's deploy failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs