Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
/precision reports the relay→Pi and Pi read-back hops on a clock the relay aligns with the arm server #493
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
GET /precision now reports the relay→Pi hop and the Pi read-back→relay hop, each with p50/p95 in hops, on a clock the relay aligns with the arm server. latencyP95Ms includes both. The 152 tests covering the touched modules pass after merging main.
shipped merged
GET /precision now reports the relay→Pi hop and the Pi read-back→relay hop, each with p50/p95 in hops, on a clock the relay aligns with the arm server. latencyP95Ms includes both. The 152 tests covering the touched modules pass after merging main. One test failed in an earlier full bun test run but not in the rerun (it passed in the focused suites too), so I don't know which test it was. I didn't re-run the whole suite after the merge.
- Clock alignment: the relay runs the four-timestamp ping from
src/hops.tsagainst the arm server every few seconds over its existing link and keeps the offset. The ping lives inarm-link.ts, and the wall clock moved into a newsrc/clock.ts. - Relay→Pi: the relay stamps each forwarded command with
sentAt, its send time on the arm server's clock.sentAtOfincommand-gate.tsreads it, andserver.tsrecords the hop. Frames with no stamp, such as the CLI leader's, are still accepted and not counted. The relay sends no stamp until the offset is known. - Read-back→relay: each status carries the arm server's read time, so the relay can measure this hop too.
- Output:
bench/precision.tsprints both hops (loopback there). - Tests: the new tests in
relay.test.tsand the precision tests use a fake arm server with a fixed clock skew. - Merge conflicts: merging main conflicted in
relay.ts,server.tsandcommand-gate.ts, where main'sreleaseframe type met mysentAtstamp. I kept both, sostampedtakesreleaseand addssentAt, andcommand-gate.tsexports bothisReleaseandsentAtOf.
tsc --noEmit reports no errors in the files I touched. It reports many in src/ui/* and a few other files, and I didn't check whether those predate this change.
Nothing on the page changed.
🤖 Generated with Claude Code
Does what the issue asked: /precision gains relay→Pi and read-back→relay hops on a clock aligned by the four-timestamp ping, and latencyP95Ms sums all three. Security floor holds: the /watch socket is capped at 1024 bytes by maxPayload, readBack is sliced to 64 entries and type-checked, hop() rejects negative, NaN and absurd values, and unstamped CLI frames are accepted and not counted. Each new behaviour has a test (skewed fake arm in relay.test.ts, stamped and unstamped frames plus ping/pong in precision-history.test.ts, hop bounds in precision.test.ts). No page change, no new dependency. Next: (1) the author could not name the test that failed once in a full run, so find the flake (likely a timing assertion in the new relay test, hop < 50 ms with a 2 ms-aged read) before it bites CI. (2) Document the three hops and the sentAt/readAt/ping wire fields in the README next to /precision. Any watcher can feed readBack into the rolling window; that is fine while /watch is Pi-local behind the relay, but worth a note.
GET /precisionnow reports the relay→Pi hop and the Pi read-back→relay hop, each with p50/p95 inhops, on a clock the relay aligns with the arm server.latencyP95Msincludes both. The 152 tests covering the touched modules pass after merging main. One test failed in an earlier fullbun testrun but not in the rerun (it passed in the focused suites too), so I don't know which test it was. I didn't re-run the whole suite after the merge.src/hops.tsagainst the arm server every few seconds over its existing link and keeps the offset. The ping lives inarm-link.ts, and the wall clock moved into a newsrc/clock.ts.sentAt, its send time on the arm server's clock.sentAtOfincommand-gate.tsreads it, andserver.tsrecords the hop. Frames with no stamp, such as the CLI leader's, are still accepted and not counted. The relay sends no stamp until the offset is known.bench/precision.tsprints both hops (loopback there).relay.test.tsand the precision tests use a fake arm server with a fixed clock skew.relay.ts,server.tsandcommand-gate.ts, where main'sreleaseframe type met mysentAtstamp. I kept both, sostampedtakesreleaseand addssentAt, andcommand-gate.tsexports bothisReleaseandsentAtOf.tsc --noEmitreports no errors in the files I touched. It reports many insrc/ui/*and a few other files, and I didn't check whether those predate this change.Nothing on the page changed.
🤖 Generated with Claude Code
Closes #481