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

Boards: starting boards shipped with the forge — Throughput, Usage, Crew, Releases, Apps, Security #1892

opened this

Parked 50d 21h ago

The forge now seeds six boards into forge/boards — Throughput, Usage, Crew, Releases, Apps and Security — but Releases has no dark-seconds or ask→live panel. Ask→live and dark seconds have no record behind them, so I left them out.

Notes

opened this

The forge now seeds six boards into forge/boards — Throughput, Usage, Crew, Releases, Apps and Security — but Releases has no dark-seconds or ask→live panel. Ask→live and dark seconds have no record behind them, so I left them out. bun test over the 24 files near the changes passes (286 tests) and the type check is clean. I did not run the whole suite or boot the app.

What changed

  • Seeding: seedBoards (in src/actions/boards.ts) runs at boot and then every minute. It waits until an admin who is a person exists, then commits each missing board as that admin. The slugs already done are kept in forge_setting under boards.seeded. A deleted board is never re-made, and an edited one is never touched.
  • Boards: the six are plain data in src/boards/starting.ts. After seeding they are ordinary boards, so an admin can edit, duplicate or delete them.
  • Tally for Apps and Security: a new tally table counts, per hour, sign-ins, failed sign-ins, tokens used by scope, requests and errors per app, wakes and sleeps per app, and refused pushes. It stores only a kind, a subject (a scope or an app slug) and a count. Failed sign-ins keep no name and no password, and a test checks that. It keeps 35 days and is pruned on the seeding timer.
  • Where the counts come from:
    • Sign-ins come from createSession and failed sign-ins from verifyPassword.
    • Token use comes from verifyToken, at most once a minute per token, because the existing code avoids a write on every request.
    • Requests and errors come from proxyApp, where a 5xx or a thrown error counts as an error.
    • Wakes and sleeps come from the runtime's awake and resting hooks.
    • Refused pushes are any 403 from the pre-receive hook.
  • New sources: tally, items (issues and pulls), releases and admin_actions (events whose actor is an admin). I added no dependencies.
  • Test: test/boards-starting.test.ts checks that every starting board parses and every panel runs against a fresh forge. It also checks that seeding waits for an admin, happens once, and keeps a deleted board deleted, and that the tally counts correctly.

What I left out or approximated

  • Releases: it shows releases per day, preflight failures, a total, landings by pull, and pulls landed. Add those two panels once something records them.
  • Throughput: the panels are derived from existing tables (opened, runs started, reviews, landed, deploys serving, releases), not from flow/throughput.ts. "Checks started" is approximated with deploy runs.
  • Crew: runs are grouped by agent, kind, state and outcome, not by reason, because a run's reason is free text that sources deliberately exclude.
  • Refusals and wakes: "sentinel refusals" is counted as refused pushes, and a "wake" is any time an environment begins serving, including a deploy.
  • Per-cell Usage panels: they group by target but don't filter to one app or check.
  • Not tried live: I did not render the seeded boards in a browser.

To try it: boot the forge with an admin account, wait up to a minute, and open /boards.

Closes #1577

7 earlier comments
commented

I merged main into the branch and pushed it. The merge conflicted only in src/core/schema.ts, and the type check and the schema, boards and tally tests pass. I didn't run the full bun test here; the forge runs it on the push.

main had taken migration 91 for the run placement and node columns (#1815). I kept that migration as it is and renumbered the tally table from 91 to 92, so it now comes after it. Nothing else in the migration list changed.

What this pull does:

  • It seeds six starting boards once into forge/boards.
  • It adds the hourly tally table that feeds the Apps and Security boards (#1577).

Not in this pull: nothing new was added or dropped in the merge.

To try it, open the Boards page on the preview at https://lab--1892--forge-trevato-apps.open-platform.sh.

🤖 Generated with Claude Code

commented

This pull adds six starting boards to forge/boards, seeded once, plus an hourly tally that the Apps and Security boards read. It now merges into main again.

  • Cause of the failure: main moved migrations out of src/core/schema.ts into one file each under src/core/migrations/ (#1837). Our migration 92 for the tally table conflicted with that.
  • Fix: I took main's schema.ts and moved the tally table into src/core/migrations/20261015100000-the-tally.ts. The table definition is the same as before.
  • Stamp choice: I first stamped it 20261015120000, but that collided with a fixture in test/schema-migrations.test.ts, so I used …100000. The test is unchanged.
  • Tests: test/boards-starting.test.ts and test/schema-migrations.test.ts pass (19 tests). A full bun test and tsc --noEmit run timed out in the sandbox and I didn't re-run them, so the forge's check is the first full run of the merged tree.
commented

Taken over by nobody; stopped @sentinel.

commented

Parked by the crew: this issue started its day's share of runs without landing, so nothing more starts here until a person says what to try.

commented

Every tally call site sentinel listed now has a test, and the gate failure is fixed. The branch is pushed. I ran test/boards-starting.test.ts (8 pass), test/apps-sleep.test.ts (2 pass) and scripts/gate.ts, but not the full bun test or tsc --noEmit. The forge's check will be the first full run of this tree.

What changed since the last push

  • Gate: test/boards-starting.test.ts is now listed in GATE in scripts/gate.ts. The check had failed on that.
  • New tests in test/boards-starting.test.ts:
    • pruneTally: a row survives a prune 34 days ahead and is gone at 36 days.
    • token_used: verifying the same token twice within a minute counts 1, under the token's scope.
    • refusal: a hook push to refs/pull/1/head is refused with 403 and counts 1; an accepted push to refs/heads/feature counts nothing.
    • request and request_error: I called proxyApp with a stubbed runtime. A forge-answered 303 counts only request. A "nothing running" 5xx counts both. A thrown handler counts both and the error still propagates.
  • test/apps-sleep.test.ts: the existing sleep-then-wake test now also asserts sleep, wake and request counts for the app's slug. It goes through a real deploy, so those two call sites are covered end to end.

What I did not change

  • Hot-path write: I left the per-request write as it is. It's one upsert, and the table can hold at most one row per kind, app and hour, so the write doesn't grow with traffic. The tally has no readers except the boards. Batching in memory would lose counts on a crash and add a flush path to main.ts for a saving I haven't measured. If the write shows up in profiling, batching can be added behind tally() without touching the call sites.
  • Preview check: I haven't looked at the preview by eye, and the sandbox can't reach it. That still needs a person.
commented

This pull adds the six starting boards — Throughput, Usage, Crew, Releases, Apps and Security — seeded once each into forge/boards, so a deleted board stays deleted. It also adds the hourly tally table that the Apps and Security boards read.

tsc --noEmit is clean and 11 tests pass in test/tui-deploys.test.ts and test/boards-starting.test.ts. I didn't run the full bun test, and I haven't looked at the preview, since the sandbox can't reach it.

Fix to main's type check: the last check failed in src/tui/screens/deploys.ts, which this pull doesn't touch. Main is broken on its own. #1770 deleted carriedByRuns and carriesText from src/core/carried.ts as unused, while #1762's deploys screen was calling them. I restored the two functions with a revert of that deletion. If you'd rather fix main separately, drop the commit 616eeb1f (the tally pull doesn't depend on it) and rebase once main is fixed.

Tests: every place the forge writes a tally count has a test now.

  • pruneTally and its 35-day window.
  • token_used and its once-a-minute limit.
  • refusal on a refused hook push, and no count on an accepted one.
  • request and request_error on an ordinary answer, a 5xx and a thrown handler.
  • wake and sleep, asserted inside the existing sleep-then-wake test.

Migration: with #1837 moving migrations to one file each, the tally table is src/core/migrations/20261015100000-the-tally.ts.

Left out:

  • Per-request write: each proxied app request does one SQLite upsert for the tally, and the table holds at most one row per kind, app and hour. I did not batch the counts in memory. Batching would lose counts on a crash and add a flush step in main.ts, for a saving nobody has measured. It can go behind tally() later without touching the call sites.
  • Preview: the six boards still need a look by eye on the preview.
commented

Parked by the crew: the check failed ("migrations are additive across a roll > the release record is newest first and never ahead of the schema") and the decider saw no point in another try

commented

Parked by the crew: the check failed and the decider saw no point in another try

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs