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

Boards, step 2: /boards/data draws a query as a line chart an admin can edit in place #1732

Closed opened this
Closed without merging

/boards/data now draws a query as a line chart and lets an admin edit the query in place. bun test on the three suites I touched passes (boards-page, boards-query, check-list: 45 tests) and tsc is clean. I did not run the whole gate; the forge runs that on push.

Notes

stopped closed without shipping

opened this

/boards/data now draws a query as a line chart and lets an admin edit the query in place. bun test on the three suites I touched passes (boards-page, boards-query, check-list: 45 tests) and tsc is clean. I did not run the whole gate; the forge runs that on push.

  • Chart: src/boards/chart.ts draws the line as server-rendered SVG with no dependencies. The viewBox is fixed at 720×260, so there is no layout shift. Labels are cleaned, clamped and escaped, and the colour comes from the page.
  • Page: src/web/pages/boards.ts is the new /boards/data route.
    • A GET form sets source, aggregate, column, group by, from/to and one filter, so a query is a link.
    • It shows the chart, a table of the points, and a list of sources with their columns.
    • A bad query shows the refusal on the page instead of an error.
  • Access: only an admin who is a person can open it (an agent token gets 404, like everyone else). A "Boards" entry sits in the header's user menu for such an admin.
  • Rows behind a point: each point links to the same query narrowed to that point's time window (or, when grouped by a column, that value), listed by the source's first column with no chart. This reuses runQuery, so it shows that key column with a count, not every column of each row.
  • Tests: test/boards-page.test.ts is added to GATE in scripts/gate.ts. It checks:
    • seeded runs give one path with one point per day;
    • a point's link leads to the table without a chart;
    • a refused query and hostile params are handled;
    • a non-admin and a stranger get 404, and only the admin's menu shows the Boards link;
    • the chart escapes labels and keeps its size.
  • Left out: only one filter in the form (runQuery accepts up to 16), no saved boards, no bar charts, and no x-axis time scaling (points are spaced evenly).
  • Try it: sign in as the admin, open /boards/data?source=runs&by=day, change a field and press Draw.

Closes #1560

commented

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

commented

The preview deploy failed because boards was missing from the reserved top-level names. The reserved names test requires every top-level page of the forge to be on that list, and my new /boards/data route wasn't. I added boards to src/core/reserved.ts, so a user or organisation can no longer take that name. The reserved-names and boards-page tests pass, tsc is clean, and I pushed the fix.

I couldn't get the deploy log, so I found this by running the full bun test locally. Four other tests also failed there:

  • the scaffolded-app typecheck (no network to download typescript)
  • the capacity admin test
  • the SSH-port-taken test in main.ts
  • the Chromium capture test

I didn't investigate them. The first, third and fourth look like sandbox limits, but I didn't check whether the capacity failure is one too or whether it comes from my change. If the preview still fails, the next log should say which.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs