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

Boards: Grafana-like dashboards inside the forge — every admin-visible table is a queryable source, editable panels (line, bar, area, number, table, heat), saved boards in git, starting boards for throughput, usage, crew, releases, apps and security #1578

Closed opened this in answer to
Closed without merging

This pull covers the first part of #1557. Every table an admin can see can now be queried and drawn as a chart, both on a new page, /boards/data, and through the API. Saved boards, the starting boards and the machine sampler are split into #1575, #1576 and #1577, and #1557 now waits on all three.

Notes

stopped closed without shipping deploy ce51f70

opened this

This pull covers the first part of #1557. Every table an admin can see can now be queried and drawn as a chart, both on a new page, /boards/data, and through the API. Saved boards, the starting boards and the machine sampler are split into #1575, #1576 and #1577, and #1557 now waits on all three.

What changed

  • Sources (src/boards/sources.ts): runs, deploys, pulls, reviews, apps, awake (each app's wake-to-sleep stretch), capacity, ledger, spend, crew, sessions, tokens and audit. Each source is a fixed SQL FROM with a fixed list of allowed columns. A query only names columns from that list and every value is a bound parameter, so nothing typed reaches the SQL. Each source lists what it withholds: password, token and session hashes, encrypted values (*_enc), a sealed pull's title (shown as (sealed)), and event payloads.
  • Query (src/boards/query.ts): one parser checks every query, whether it comes from a URL, a form or JSON. A query has:
    • a range: the last 1 h to 30 d, or from/to
    • up to eight filters, written column:op:value
    • an x axis: a minute, hour or day bucket in UTC, or a column
    • an optional split into series
    • one aggregate: count, sum, avg, p50, p95 or max

    It reads the rows once and aggregates them exactly in JS, because SQLite has no percentile. Percentiles are nearest-rank, so a p95 is always a value that occurred. Durations are rounded to milliseconds to remove julianday float error.

  • Charts (src/boards/charts.ts): line, bar, stacked area, number with sparkline, table and heat strip, drawn as SVG on the server with no chart library. All text goes through the html tag, so it is escaped. Every point links to the rows behind it.
  • Page: /boards/data puts the query form above the chart; changing a select redraws it. The URL holds the whole panel, so a link shares it. The rows behind any point are available as a page, as CSV (formula characters defused) and as JSON. The page is linked from Settings → Boards.
  • API: GET /api/v1/boards/sources, GET|POST /api/v1/boards/query and GET /api/v1/boards/rows.
  • Access (src/actions/boards.ts): an agent gets 403 whatever its token. Anyone else who isn't an admin gets 404, like the other admin pages. Nothing here writes data.
  • boards is now a reserved name, the README has a Boards section, and no dependency was added.

What to look at

  • test/boards.test.ts is new and added to the gate. bun scripts/flake-hunt.ts admit ran it 10 times in random order under load (seeds 2632897135, 2859813479, 1209679435, 913944414, 4250159354, 3475420391, 3754347369, 2435578730, 985799189, 1343201104), and all 10 passed. It checks:
    • per-hour counts, sums, p50, p95, avg and max on seeded runs against hand-calculated numbers
    • that the rows behind a point are exactly the rows that made it
    • that an agent gets 403 on every source's query and rows, and on the source list
    • that a member gets 404 and an anonymous caller 401
    • that no source returns a secret, a hash or a sealed title
  • bun x tsc --noEmit is clean, and the boards, reserved-names, studio, shards, check-list and hollow tests pass.
  • test/capacity.test.ts has one test that fails here. It fails the same way on main without this change, so it isn't caused by this pull.

What this doesn't do

  • No /boards list and no saved boards in git yet; that is #1575. I left out a /boards redirect because nothing linked to it yet, which the hollow check flags.
  • No pod or node sampling (#1576) and no starting boards (#1577, which also waits on #1554 for its stages).
  • Auto-refresh comes with saved boards. Printing hides the form and the source list.

To try it: sign in as an admin and open Settings → Boards. Pick runs, split by kind, choose Stacked area, then click any point to see its rows.

🤖 Generated with Claude Code

Closes #1557

commented

Parked by the crew: the check failed ("web ui > the composer, the verdicts and the settings sections carry their keys") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs