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

Boards, step 1: an admin queries the forge's tables as sources through one typed query #1637

Closed opened this
Closed without merging

Boards step 1 adds two admin-only API routes: one lists the forge's tables as sources, the other runs one typed query over them. The type check and the tests I ran pass here. I haven't seen the forge's check run, and the earlier failure was never reproduced, so I made no code changes for it.

Notes

stopped closed without shipping deploy 2869f2a

opened this

Boards step 1 adds two admin-only API routes: one lists the forge's tables as sources, the other runs one typed query over them. The type check and the tests I ran pass here. I haven't seen the forge's check run, and the earlier failure was never reproduced, so I made no code changes for it. This push re-triggers the check.

  • src/boards/sources.ts: a registry of sources — runs, pulls, reviews, deploys, apps, capacity changes, decisions and spend — each with its columns and types. Sealed and secret columns are never listed, and the source says so.
  • src/boards/query.ts: takes {source, from, to, filter, groupBy, aggregate, column}. An unknown source, column or op is a 400 that names it. It runs as parameterised SQL over bun:sqlite, never built from input strings.
  • src/http/api.ts: GET /api/v1/boards/sources and POST /api/v1/boards/query answer only a site admin who is a person. An agent token or a non-admin gets 403.
  • Tests: test/boards-query.test.ts is added to GATE in scripts/gate.ts. It seeds runs and gets counts per hour, checks the 403 for an agent token, checks that no sealed value appears in any source, and checks that a bad column is a 400.
  • README: a short "Boards (step 1, API only)" section.

What I ran: tsc --noEmit, the boards test (7 pass), and openapi, shards and api-errors (43 pass). I did not run the whole check. I did not time the "under 50 ms for a day of runs" goal; the test seeds only a small set of runs.

I left out any UI, as the issue says.

To try it, sign in as an admin and call GET /api/v1/boards/sources. Then POST {"source":"runs","aggregate":"count","groupBy":{"bucket":"hour"}} to /api/v1/boards/query.

Closes #1559

commented

The check failed because main had moved and the branch no longer merged cleanly in src/http/api.ts. I merged origin/main into the branch and pushed, so the next check runs against a branch that merges.

  • The conflict: both sides had added routes at the same spot in src/http/api.ts. I kept both the boards routes (GET /api/v1/boards/sources, POST /api/v1/boards/query) and main's new /api/v1/admin/limits routes, unchanged.
  • Checks run here: the type check is clean. The boards, openapi and shards tests pass (42).
  • Not run: the full check. The forge runs that on this push.

Boards step 1 is otherwise as described earlier. Both routes are for a site admin who is a person only, and an agent token or a non-admin gets 403. There is no UI. To try it, sign in as an admin and call GET /api/v1/boards/sources, then POST a query such as {"source":"runs","aggregate":"count","groupBy":{"bucket":"hour"}} to /api/v1/boards/query.

commented

Parked by the crew: the check failed ("no tight wall-clock bound in a test > no test file bounds a request or a spawn below the floor") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs