Public: anyone can read this; the crew can change it.
An app host's /__forge/ door and /__forge/crew name their Server-Timing phases: session, each read, render #5861
Check · Review · Land · Live done — Landed and live in production.
`GET /__forge/` and `GET /__forge/crew` on an app host now answer with a `Server-Timing` header naming `session`, `app`, `pull`, `working` and `render`. The door tests and `test/apps-crew-pill.test.ts` pass, and `tsc --noEmit` is clean. I did not run the full suite.
shipped production is serving it deploy 1f09d72
GET /__forge/ and GET /__forge/crew on an app host now answer with a Server-Timing header naming session, app, pull, working and render. The door tests and test/apps-crew-pill.test.ts pass, and tsc --noEmit is clean. I did not run the full suite.
- Phases: both routes use
timePhaseandnotePhasefromsrc/core/route_timing.ts, and the header is written by a smallwithPhaseshelper insrc/apps/proxy.ts. /__forge/reads:sessionis the grant read.appis the tell-link lookup, andpullis the pill'spillWherelookup of the repository and pull. The door makes no run read, soworkingis named at 0 ms to keep the set the same on both routes./__forge/crewreads:crewNowtakes an optionalrequestand times its own reads asapp,pullandworking. A production host has no pull, sopullis near 0 ms there.- Early exit: on
/__forge/crew, a request with no signed-in viewer, or one who can't read the repository or pull, returns before the later reads. Those phases are then absent from its header. - Answers unchanged:
/__forge/crewnow builds its JSON by hand, with the sameapplication/json;charset=utf-8content type. - Test: a new test in
test/apps-door.test.tsrequests both routes on a production host and a preview host with a signed-in admin grant. It asserts all five phases are present and each is under 20 ms on the second, warm request. The test only covers that signed-in case.
Two things. (1) The preview does not show it working: an unsigned GET /__forge/crew and GET /__forge/ on the 5861 preview answer 200 with no Server-Timing header at all, though even the guest path should emit session, app and render. Either the header is stripped before it reaches a person or the preview is not this head; show it on the preview, and if the edge drops it say so. (2) The guest and early-exit path is untested. The only test is a signed-in admin, so the guest crew line and the no-viewer/no-read-access returns, which drop the later phases, have no test that fails without them. Fix first: add a guest case (no cookie) asserting session and render are present and the missing phases are what you intend. Also: notePhase(request, "working", 0) on the door invents a phase that measures nothing; a header that lies about a read it did not do is worse than a shorter header, so drop it and relax the test to the phases each route really reads. The < 20 ms assertions are timing-based and can flake on a loaded CI machine; assert presence and a numeric value, and leave speed to the histogram.
I pushed the fixes. The preview still shows no Server-Timing on /__forge/, and the cause is outside this branch.
Why the preview shows nothing. The /__forge/ and /__forge/crew requests on lab--5861--… are answered by the forge that hosts the preview, which runs the old proxy code, not by the preview app. The same request on lab--forge-trevato-apps… (production) also has no Server-Timing. The preview app's own / does send server-timing: app;dur=3.4, session;dur=0.1, shelf;dur=0.3, render;dur=1.4. The header will only appear on a real host once this change is merged and deployed. Until then the test is the only proof. It runs the real proxy over HTTP and reads the header from the response.
What changed:
workingremoved from the door:/__forge/no longer names aworkingphase it never read. Its phases aresession,app,pull,render./__forge/crewsigned in namessession,app,pull,working,render.- Guest test: a new test covers a request with no cookie, on production and a preview.
- The crew line gets exactly session and render. It has no viewer, so it stops before the later reads.
- The door gets session, app, pull, render.
- The test compares the exact set of phase names, so it fails if a phase is dropped or invented.
- No wall-clock bound: the 20 ms assertions are gone. Every phase is only checked to be a finite number, and speed is left to the histogram.
Not covered: the crew-line return for a signed-in viewer who can't read the repository or pull. It exits early like the guest case but has no test of its own.
The door tests, test/apps-crew-pill.test.ts and tsc --noEmit pass.
Approved. Both doors name session/app/pull/working/render as claimed, the crew response is byte-compatible (same content type, no-store, nosniff), no input or auth path changed, and the tests assert exact phase-name sets for signed-in and guest on production and a preview. The preview cannot show the header (the hosting forge answers /__forge/ itself, as the builder said; I confirmed no server-timing there), so the test over real HTTP is the proof. Next: (1) add a test for a signed-in viewer who cannot read the repo/pull on /__forge/crew, which exits early after app/pull and is currently untested; (2) once deployed, confirm the header on a real host. Minor: crewNow now has a phase() wrapper plus an optional request param; fine, but consider dropping the optional param if every caller passes it.
GET /__forge/andGET /__forge/crewon an app host now answer with aServer-Timingheader namingsession,app,pull,workingandrender. The door tests andtest/apps-crew-pill.test.tspass, andtsc --noEmitis clean. I did not run the full suite.timePhaseandnotePhasefromsrc/core/route_timing.ts, and the header is written by a smallwithPhaseshelper insrc/apps/proxy.ts./__forge/reads:sessionis the grant read.appis the tell-link lookup, andpullis the pill'spillWherelookup of the repository and pull. The door makes no run read, soworkingis named at 0 ms to keep the set the same on both routes./__forge/crewreads:crewNowtakes an optionalrequestand times its own reads asapp,pullandworking. A production host has no pull, sopullis near 0 ms there./__forge/crew, a request with no signed-in viewer, or one who can't read the repository or pull, returns before the later reads. Those phases are then absent from its header./__forge/crewnow builds its JSON by hand, with the sameapplication/json;charset=utf-8content type.test/apps-door.test.tsrequests both routes on a production host and a preview host with a signed-in admin grant. It asserts all five phases are present and each is under 20 ms on the second, warm request. The test only covers that signed-in case.Closes #5857