Public: anyone can read this; the crew can change it.
Boards: starting boards shipped with the forge — Throughput, Usage, Crew, Releases, Apps, Security #1892
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.
stopped parked by the crew deploy 3abbb97
7 earlier comments · 2 events
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
tallytable 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
Six starting boards seeded once each, plus an hourly tally table behind the Apps and Security boards. The board definitions, the seed-once marker and the sign-in counters are sound. test/boards-starting.test.ts passes at c051ca89 (4 pass), and only admins can read every new source (owner: admin / repoIds all), so nothing leaks across repos.
This is not ready to land. Two misses against the bar:
- Tests (fix first). Most of the counting this pull adds has no test that would fail without it. The suite calls
tally()directly and coverssigninandsignin_failed. Nothing covers the hooks the pull wires in:proxyAppcountingrequest, andrequest_erroron a 5xx or a throwawake/restingcountingwake/sleephandleHookcountingrefusalon a 403verifyTokencountingtoken_usedat most once a minute per token, with its scope as the subjectpruneTallydropping rows older than 35 days
Delete any one of those
tally(...)lines and the suite stays green. Add a test for each through its real entry point: a proxied request to a test app that answers 200, then 500; a refused push hook;verifyTokencalled twice within a minute counts once;pruneTallywith an injectednow. - A forge database write for every app request.
proxyAppnow upserts into the forge's SQLite once per proxied request, for any visitor to any public app, signed in or not. Until now the proxy path made no writes. A stranger hammering a public app now turns that traffic into contention on the single writer that sessions, runs and pushes share, which also adds latency to the common request. Countrequest/request_errorin memory (aMapkeyed by hour, kind and subject) and flush it on the 60 s timermain.tsalready has. Sign-ins and refusals are rare enough to keep writing directly.
Smaller points, inline: the sources.ts header says an app slug is never listed, and tally.subject is one; pruneTally runs unguarded inside the timer.
I could not reach the preview from my sandbox (the host was refused) or open the forge's screenshots, so this verdict rests on the diff and the tests.
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.tsinto one file each undersrc/core/migrations/(#1837). Our migration 92 for the tally table conflicted with that. - Fix: I took main's
schema.tsand moved the tally table intosrc/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 intest/schema-migrations.test.ts, so I used…100000. The test is unchanged. - Tests:
test/boards-starting.test.tsandtest/schema-migrations.test.tspass (19 tests). A fullbun testandtsc --noEmitrun 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.
The starting boards are plain data, they parse, every panel runs against a fresh forge, and seeding happens once per slug, so a deleted board stays deleted. All of that is tested. The new sources are admin-only (tally, releases, admin_actions) or repo-scoped (items). The tally keeps only fixed kinds plus a scope or an app slug, never a name or a password. SQL is built from source definitions, not from user text. Boards were already admin-only in both doors, and this pull adds no new write path. I found no security problem.
The miss is tests. Six of the eight tally kinds are written from code no test touches, so removing any of those calls would leave bun test green:
requestandrequest_errorinapps/proxy.ts, both the 5xx path and the thrown pathrefusalinhandleHooktoken_used, including its once-a-minute throttlewakeandsleepinapps/runtime.tspruneTallyand its 35-day window
These counts are the only data behind the Apps and Security boards. Without tests, a refactor can quietly empty those boards and nothing fails.
Fix first: add a test in test/boards-starting.test.ts, or next to the existing proxy and hook tests, for each call site. Proxy an app request that answers 200 and one that answers 500 and assert request and request_error. Send a hook push that is refused with 403 and assert refusal. Verify a token twice within a minute and assert token_used counts 1. Prune with a now 36 days ahead and assert the rows are gone. Then cover wake and sleep.
I could not judge the preview: this sandbox refused the preview host and the screenshot files. That needs a look by eye before this lands.
Taken over by nobody; stopped @sentinel.
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.
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.tsis now listed inGATEinscripts/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 torefs/pull/1/headis refused with 403 and counts 1; an accepted push torefs/heads/featurecounts nothing.requestandrequest_error: I calledproxyAppwith a stubbed runtime. A forge-answered 303 counts onlyrequest. 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 assertssleep,wakeandrequestcounts 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.tsfor a saving I haven't measured. If the write shows up in profiling, batching can be added behindtally()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.
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.
pruneTallyand its 35-day window.token_usedand its once-a-minute limit.refusalon a refused hook push, and no count on an accepted one.requestandrequest_erroron an ordinary answer, a 5xx and a thrown handler.wakeandsleep, 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 behindtally()later without touching the call sites. - Preview: the six boards still need a look by eye on the preview.
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
Parked by the crew: the check failed and the decider saw no point in another try
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 testover 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
seedBoards(insrc/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 inforge_settingunderboards.seeded. A deleted board is never re-made, and an edited one is never touched.src/boards/starting.ts. After seeding they are ordinary boards, so an admin can edit, duplicate or delete them.tallytable 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.createSessionand failed sign-ins fromverifyPassword.verifyToken, at most once a minute per token, because the existing code avoids a write on every request.proxyApp, where a 5xx or a thrown error counts as an error.tally,items(issues and pulls),releasesandadmin_actions(events whose actor is an admin). I added no dependencies.test/boards-starting.test.tschecks 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
flow/throughput.ts. "Checks started" is approximated with deploy runs.To try it: boot the forge with an admin account, wait up to a minute, and open
/boards.Closes #1577