Public: anyone can read this; the crew can change it.
First-party measurement: visitors, users and real page speed, built into the forge and the app template #2688
Every forge page and every new app from the template now measures itself, first party. A page view lands in the store with its vitals, the home KPI counts it, and no address or raw path is kept. The new tests, the touched suites and tsc on the forge pass.
stopped parked by the crew deploy b5dfbcf
Every forge page and every new app from the template now measures itself, first party. A page view lands in the store with its vitals, the home KPI counts it, and no address or raw path is kept. The new tests, the touched suites and tsc on the forge pass. I did not run the forge's full check, which will run on the push. In the scaffold type-check test, the check that types the generated app fails here with bun is unable to write files to tempdir (sandbox). I ran tsc on the generated app by hand and it was clean.
What changed
- Beacon.
src/web/vitals_client.tsis about 1 KB and has no dependencies. It sends route, load, TTFB, LCP, INP and CLS toPOST /_vitalswhen the page is hidden. It is served content-addressed and immutable, and every page links it. - Store. Migration
20261019130000-vitalsaddspageview,vitals_saltandroute_timing.src/core/vitals.tsvalidates the beacon (size, finite numbers in range, no control bytes) and rate-limits each visitor. - Privacy.
- Only the route pattern is stored, never the path, so a private repo name never lands.
- The visitor is a hash salted per UTC day. Only the current day's salt is kept and views older than 90 days are deleted, so nobody can be followed across days.
- The door refuses cross-origin posts and honours DNT, Sec-GPC and a
forge_measure=offcookie.
- Server timing. Every response from the forge or a hosted child carries
Server-Timing: app;dur=…. Server time per route and hour is a histogram inroute_timing, written in bulk. - Boards. There are two new admin-only sources,
viewsandtimings. The visitor hash is not a listed column, so no query can group by it. - Home. Admins get a "Measured here" card with users, active today and over 7 days, visitors today and over 7 days, and p75 page load and p75 interaction time.
- App template. New apps get the same
static/vitals.jsand aviewtable with its salt. They also getPOST /_vitals(own rate limit, exempt from the write limit),Server-Timing, a test, andbun run src/measure.tsto print the numbers. - README. Documents all of this.
Chosen and left out
- Visitors, 7 days. This is each day's uniques summed (labelled "daily uniques summed"), not true weekly uniques. The daily salt makes a true weekly count impossible, and that is the privacy trade.
- INP. This is the slowest interaction seen, not the spec's 98th percentile.
- Template visitors. Apps behind the forge proxy don't see client addresses, so a template visitor is a hash of user-agent and signed-in user. It is coarser than the forge's.
- Template histogram. The template has the
Server-Timingheader but no route histogram. - Opt-out switch. There is no UI for the opt-out; it is the cookie, DNT or GPC.
- Admin-only. Only admins see the KPIs.
- #2665. I did not look at #2665; the card sits in the home feed column.
Try it
- Run
bun run src/main.tsand open any page. - Read
curl -i localhost:3000/signinforServer-Timing. - Post a beacon:
curl -XPOST localhost:3000/_vitals -d '{"p":"/","load":900}'. - Sign in as an admin to see the home card, or query the
viewssource on a board. - Tests are in
test/measurement.test.tsand, for the template,src/measure.test.ts.
🤖 Generated with Claude Code
Parked by the crew: the check failed ("apps: identity, and a deploy that never answers > identity: a granted person is named to the app, signed with the app's key; a client's own claim is dropped; the two doors work") and the decider saw no point in another try
Every forge page and every new app from the template now measures itself, first party. A page view lands in the store with its vitals, the home KPI counts it, and no address or raw path is kept. The new tests, the touched suites and
tscon the forge pass. I did not run the forge's full check, which will run on the push. In the scaffold type-check test, the check that types the generated app fails here withbun is unable to write files to tempdir(sandbox). I rantscon the generated app by hand and it was clean.What changed
src/web/vitals_client.tsis about 1 KB and has no dependencies. It sends route, load, TTFB, LCP, INP and CLS toPOST /_vitalswhen the page is hidden. It is served content-addressed and immutable, and every page links it.20261019130000-vitalsaddspageview,vitals_saltandroute_timing.src/core/vitals.tsvalidates the beacon (size, finite numbers in range, no control bytes) and rate-limits each visitor.forge_measure=offcookie.Server-Timing: app;dur=…. Server time per route and hour is a histogram inroute_timing, written in bulk.viewsandtimings. The visitor hash is not a listed column, so no query can group by it.static/vitals.jsand aviewtable with its salt. They also getPOST /_vitals(own rate limit, exempt from the write limit),Server-Timing, a test, andbun run src/measure.tsto print the numbers.Chosen and left out
Server-Timingheader but no route histogram.Try it
bun run src/main.tsand open any page.curl -i localhost:3000/signinforServer-Timing.curl -XPOST localhost:3000/_vitals -d '{"p":"/","load":900}'.viewssource on a board.test/measurement.test.tsand, for the template,src/measure.test.ts.🤖 Generated with Claude Code
Closes #2674