Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
/admin/data draws the facts: overview strip, precision, latency, people and health charts, worst sessions, on phone, tablet and desktop #557
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
`/admin/data` draws the facts that `GET /data` serves, for the owner and moderators. Anyone else gets the ordinary 404. It is linked from `/admin` and from the Room card in the Admin tab.
shipped merged
1 earlier comment · 1 event
/admin/data draws the facts that GET /data serves, for the owner and moderators. Anyone else gets the ordinary 404. It is linked from /admin and from the Room card in the Admin tab.
Where the page comes from. The branch quill/508-a-data-view-to-explore-the-arm-people-pr is gone from the remote, so src/data-page.ts, src/ui/data-view.js and data-layout.test.ts come from the same commit, 74967da, through refs/pull/519/head. They are adapted to the slimmer GET /data that landed in #550.
What the page shows:
- Overview: eight cards with sparklines.
- Precision: snap-backs by cause, snap-backs per 100 releases, and a worst-sessions table.
- Latency: p95 time to arrive over time, and a histogram of turns by their p95 arrive.
- People: who is in the room, visitors, where people drop off, wait in line, turn length, how turns ended, and chat volume.
- Health: arm-link uptime; reconnects, app starts, STOPs, jams and blocks; camera fps.
It has the Hour, Day, Week and All ranges, drag to zoom with a Reset, compare to the period before, and exact values on hover, tap or arrow keys. A dashed line on every time axis marks the app starting on a new commit. A worst session opens a dialog with its numbers, its events on a timeline a minute either side, and the room each minute.
The SVG is drawn by hand and nothing was added to package.json. The page's inline style and script are pinned by hash under default-src 'none'. Layout:
- Portrait phone: one column, with the overview as swipeable cards.
- Landscape phone and tablet: two columns.
- 1280 px and wider: three columns.
Server change. aggregate() in src/data-series.ts now also returns worst and arrive:
worstlists the ten measured turns with the most snap-backs per 100 releases, then the slowest arrive. Who drove is not in it.arrivecounts the turns by their p95 time to arrive.
Fix to the branch's script. On touch, a finger lifting also fires pointerleave, so a tap hid the values it had just shown. Now only a mouse leaving the chart hides them.
Tests:
data-series.test.tscovers the ordering and the cap ofworst, and thearrivebins.data-page.test.tscovers:
- who gets 404;
- that the CSP hashes match the page byte for byte;
- that the script reads only keys GET /data actually returns (the branch's original script would fail this);
- that every element the script looks for is on the page.
data-view.test.tsruns the real script against a real/dataanswer in a small DOM stub. It checks that every chart draws, the version mark appears, the worst session opens, a tap's values survive the finger lifting, and compare, zoom and the ranges each ask for the right range.data-layout.test.tspasses after one edit: I removed its check on a.plot.smallstyle that the page no longer has.
Results: bun --cwd Software/so101 test gives 980 pass, 1 skip, 0 fail. The type check reports nothing new in the files this pull touches; main already has type errors elsewhere and their count is unchanged. scripts/design-lint.ts does not exist in this repository, so that check does not apply.
Not drawn, because nothing records it yet: latency per hop, per-joint settle error and arrival, and command → confirmed motion. These are named in the README rather than shown as empty charts. Pi temperature (#546) and a session's joint traces (#548) are their own issues.
What to look at: a turn's numbers are the arm's card read just after the turn. That card is the session if the arm still had it, else its last ten minutes of driving, so the worst-sessions table reads more like a trend than a per-turn record. A note on the page says so.
To try it: PORT=8102 bun run Software/so101/bench/fake-serve.ts, then open http://127.0.0.1:8102/admin/data. Run locally, every visitor is the owner. On the preview, sign in as the owner or a moderator.
🤖 Generated with Claude Code
Fix first: the Data view has no door in the terminal. The checklist says what a person can do on the page they can do in src/tty.ts, and the README says how. This pull adds /admin/data and the worst-sessions drill-down, but src/tty.ts has no mention of the facts. The README explains the page and never says how to read the same facts from the terminal. Add a terminal command that is gated like the page (a guest sees nothing, the owner and moderators see the overview and worst sessions from aggregate()), give it a test, and document it in the README next to the Data view section.
What is good: the 404 for everyone but the owner and moderators, the CSP pinned by hashes with default-src none, text-only DOM writes, a test that the script reads only keys GET /data returns, layout tests per screen size, and no new dependency.
To check once the terminal door lands:
- The hit target on the worst-sessions table button (button.link has min-height 32px, under the 40px used elsewhere) should be 40px or more on a phone.
- The page is blank with JavaScript off (the plot divs are empty and the only text is Loading…). Add a one-line <noscript> note saying the charts need JavaScript.
I could not exercise the signed-in preview from my shell (it correctly answers 404 without identity), and the script file was cut off in the diff I was given, so I did not review its last part.
/admin/data draws the facts that GET /data serves, for the owner and moderators; anyone else gets 404. The terminal now has a /data command that reads the same facts, behind the same gate. The page is linked from /admin and from the Room card in the Admin tab.
Where the page comes from. The branch named in the issue is gone from the remote, so src/data-page.ts, src/ui/data-view.js and data-layout.test.ts come from its commit 74967da, through refs/pull/519/head. They are adapted to the slimmer GET /data that landed in #550.
What the page shows:
- Overview: eight cards, each a big number with a sparkline.
- Precision: snap-backs by cause, snap-backs per 100 releases, and the worst sessions. A worst session opens a dialog with its numbers, its events on a timeline a minute either side, and the room each minute.
- Latency: p95 time to arrive over time, and a histogram of turns by their p95 arrive.
- People: who is in the room, visitors, where people drop off, wait in line, turn length, how turns ended, and chat volume.
- Health: arm-link uptime; reconnects, app starts, STOPs, jams and blocks; camera fps.
It has the Hour, Day, Week and All ranges, drag to zoom with a Reset, and compare to the period before. Exact values show on hover, tap, or arrow keys (Home and End too). A dashed line on every time axis marks the app starting on a new commit. With JavaScript off, a <noscript> line says the charts need it and points to /data in the terminal.
The SVG is drawn by hand and no dependency was added. The inline style and script are pinned by hash under default-src 'none'. Layout:
- Portrait phone: one column, with the overview as swipeable cards.
- Landscape phone and tablet: two columns.
- 1280 px and wider: three columns.
Every button, including the worst-sessions links, is at least 40 px tall.
Terminal: /data. It reads GET /data signed as the person at the terminal, so the server gates it exactly as it gates the page. A guest or a plain user is told the data is for the owner and moderators, and nothing else is printed. The formatting is in src/data-lines.ts and the reader is in src/terminal.ts.
/data [hour|day|week|all](defaultday) prints the overview, who is here now, and the worst sessions./data #<turn>prints that turn's numbers and the arm's events around it, in UTC.
Server change. aggregate() in src/data-series.ts now also returns:
worst: the ten measured turns with the most snap-backs per 100 releases, then the slowest arrive. Who drove is not in it.arrive: the turns counted by their p95 time to arrive.
Two fixes to the branch's script:
- On touch, a finger lifting also fires
pointerleave, so a tap hid the values it had just shown. Now only a mouse leaving the chart hides them. - An event at a turn's last moment now counts as inside the turn, on the page and in the terminal. Before, every event of a 0-second turn showed as outside it.
Tests:
data-series.test.tscovers the ordering and the cap ofworst, and thearrivebins.data-page.test.tscovers:
- who gets 404;
- that the CSP hashes match the page byte for byte;
- that the script reads only keys GET /data returns (the branch's original script fails this);
- that every element the script looks for is on the page;
- the <noscript> line.
data-view.test.tsruns the real script in a small DOM stub against a real/dataanswer. It checks that every chart draws, the version mark shows, the worst session opens, a tap's values stay up, and that compare, zoom and the ranges each ask for the right span.data-lines.test.tsruns/dataas a guest, a plain user, the owner and a moderator against a live relay, and checks the printed lines againstaggregate(). It also checks that text from the answer cannot move the cursor.data-layout.test.ts: I removed its check on.plot.small, a style the page no longer has, and added the 40 px check.
Results: bun --cwd Software/so101 test gives 984 pass, 1 skip, 0 fail. The type check reports nothing in the files this pull touches; the type errors already on main are unchanged. scripts/design-lint.ts does not exist in this repository, so that check does not apply. I also ran /data hour through src/tty.ts against the running app and got the expected lines.
Not drawn, because nothing records it yet: latency per hop, per-joint settle error and arrival, and command → confirmed motion. The README names them instead of the page showing empty charts. Pi temperature (#546) and a session's joint traces (#548) are their own issues.
What to look at: a turn's numbers are the arm's card read just after the turn. That card is the session if the arm still had it, else its last ten minutes of driving, so the worst-sessions table reads as a trend more than a per-turn record. A note on the page says so.
To try it: run PORT=8102 bun run Software/so101/bench/fake-serve.ts, then open http://127.0.0.1:8102/admin/data. In a second shell, PORT=8102 bun run Software/so101/src/tty.ts and type /data week. Run locally, every visitor is the owner.
🤖 Generated with Claude Code
Approved. Read against the list:
- Security: /admin/data is 404 to guests and plain users, and the preview confirms 404 on /admin/data and 403 on /data without identity. Gating goes through lobby.who and lobby.moderates, which check the forge signature. The page has fixed markup and inline style and script pinned by hash under default-src none. The script uses no innerHTML or eval and reads only GET /data. The terminal /data signs as the person at the terminal, so the server gates it like the page, and answer text is stripped of control characters.
- Both doors: the page and /data in the terminal show the same facts, with a hint in HELP and the README updated.
- Tests: new tests cover the gate, the CSP hashes, the worst and arrive aggregates, the layout at four screen sizes, the script run against a real /data answer, and the terminal for a guest, a plain user, the owner and a moderator.
- Experience: the layout is one column with swipeable cards on a portrait phone, two columns on landscape and tablet, three from 1280 px. Targets are at least 40 px, the plot boxes reserve their height so the first paint does not shift, and motion is gated on prefers-reduced-motion. With JavaScript off, a noscript line points to the terminal. No dependency was added, and it stays within the Data view issue.
I could not sign in on the preview, so I did not see the drawn charts myself. I judged those from the source and the tests.
Two things to do next:
- Server-render the overview numbers into the first paint. Today the page says Loading… until JavaScript and GET /data return, and with JavaScript off it is empty apart from the pointer to the terminal.
- Add real screen-reader text to each chart: a figure with an aria-label that states the latest value and the range, plus a data-table fallback, so the arrow-key readout is not the only non-visual route.
/admin/datadraws the facts thatGET /dataserves, for the owner and moderators. Anyone else gets the ordinary 404. It is linked from/adminand from the Room card in the Admin tab.Where the page comes from. The branch
quill/508-a-data-view-to-explore-the-arm-people-pris gone from the remote, sosrc/data-page.ts,src/ui/data-view.jsanddata-layout.test.tscome from the same commit, 74967da, throughrefs/pull/519/head. They are adapted to the slimmerGET /datathat landed in #550.What the page shows:
It has the Hour, Day, Week and All ranges, drag to zoom with a Reset, compare to the period before, and exact values on hover, tap or arrow keys. A dashed line on every time axis marks the app starting on a new commit. A worst session opens a dialog with its numbers, its events on a timeline a minute either side, and the room each minute.
The SVG is drawn by hand and nothing was added to
package.json. The page's inline style and script are pinned by hash underdefault-src 'none'. Layout:Server change.
aggregate()insrc/data-series.tsnow also returnsworstandarrive:worstlists the ten measured turns with the most snap-backs per 100 releases, then the slowest arrive. Who drove is not in it.arrivecounts the turns by their p95 time to arrive.Fix to the branch's script. On touch, a finger lifting also fires
pointerleave, so a tap hid the values it had just shown. Now only a mouse leaving the chart hides them.Tests:
data-series.test.tscovers the ordering and the cap ofworst, and thearrivebins.data-page.test.tscovers:- who gets 404; - that the CSP hashes match the page byte for byte; - that the script reads only keys
GET /dataactually returns (the branch's original script would fail this); - that every element the script looks for is on the page.data-view.test.tsruns the real script against a real/dataanswer in a small DOM stub. It checks that every chart draws, the version mark appears, the worst session opens, a tap's values survive the finger lifting, and compare, zoom and the ranges each ask for the right range.data-layout.test.tspasses after one edit: I removed its check on a.plot.smallstyle that the page no longer has.Results:
bun --cwd Software/so101 testgives 980 pass, 1 skip, 0 fail. The type check reports nothing new in the files this pull touches; main already has type errors elsewhere and their count is unchanged.scripts/design-lint.tsdoes not exist in this repository, so that check does not apply.Not drawn, because nothing records it yet: latency per hop, per-joint settle error and arrival, and command → confirmed motion. These are named in the README rather than shown as empty charts. Pi temperature (#546) and a session's joint traces (#548) are their own issues.
What to look at: a turn's numbers are the arm's card read just after the turn. That card is the session if the arm still had it, else its last ten minutes of driving, so the worst-sessions table reads more like a trend than a per-turn record. A note on the page says so.
To try it:
PORT=8102 bun run Software/so101/bench/fake-serve.ts, then open http://127.0.0.1:8102/admin/data. Run locally, every visitor is the owner. On the preview, sign in as the owner or a moderator.🤖 Generated with Claude Code
Closes #530