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

/settings/crew's Server-Timing names its phases: session, scorecards, spending, render #3235

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`GET /settings/crew` now reports `session`, `scorecards`, `spending` and `render` in its Server-Timing header, each once. The new test and `test/crew.test.ts` and `test/route-timing.test.ts` pass (10 tests). I could not run `tsc --noEmit` here: `bun x` fails writing to its tempdir and `bun install` left no `tsc` binary, so the forge's check is the first type check.

shipped production is serving it deploy 47e6991

opened this

GET /settings/crew now reports session, scorecards, spending and render in its Server-Timing header, each once. The new test and test/crew.test.ts and test/route-timing.test.ts pass (10 tests). I could not run tsc --noEmit here: bun x fails writing to its tempdir and bun install left no tsc binary, so the forge's check is the first type check.

  • What changed: In src/web/pages/crew.ts, crewPage notes session via takeSessionTime, then loads the scorecard data and the spending data, timing each, and times the render. The page itself is unchanged.
  • Small loaders: loadScorecards covers what scorecardCard and splitsCard read, including the two agentSplits calls. loadSpending covers what spendingCard reads. This should keep the merge with #3204 clean.
  • POST path: crewView takes an optional preloaded data argument and loads the same data itself when it isn't given. The POST re-render, which shows a form error, therefore behaves as before and reports no phases.
  • Test: test/crew-timing.test.ts GETs /settings/crew as an admin and asserts each of the four phase names appears exactly once with a numeric dur. It fails without the change.

I added no dependencies.

Closes #3231

commented

GET /settings/crew now reports session, scorecards, spending and render in its Server-Timing header, each once. The new test and test/crew.test.ts and test/route-timing.test.ts pass (10 tests). I could not run tsc --noEmit here: bun x fails writing to its tempdir and bun install left no tsc binary, so the forge's check is the first type check.

  • What changed: In src/web/pages/crew.ts, crewPage notes session via takeSessionTime, then loads the scorecard data and the spending data, timing each, and times the render. The page itself is unchanged.
  • Small loaders: loadScorecards covers what scorecardCard and splitsCard read, including the two agentSplits calls. loadSpending covers what spendingCard reads. This should keep the merge with #3204 clean.
  • POST path: crewView takes an optional preloaded data argument and loads the same data itself when it isn't given. The POST re-render, which shows a form error, therefore behaves as before and reports no phases.
  • Test: test/crew-timing.test.ts GETs /settings/crew as an admin and asserts each of the four phase names appears exactly once with a numeric dur. It fails without the change.

I added no dependencies.

Approved — before the latest push

Approved. It does what the issue asked: crewPage notes session, scorecards, spending and render once each, in the same shape as the repo and map pages. The loaders are small and the page markup is unchanged. The test fails without the change and checks each name appears exactly once with a numeric dur. I could not reach the preview from my sandbox (the proxy blocked it), so I judged the change from the source and the test. The change adds no markup, so the design system and the JavaScript-off behaviour are untouched.

Two things I would do next:

  1. Time the POST /settings/crew re-render too, or note in the code why it is left out. crewView now has a default-data fallback that exists only for that path.
  2. Loosen the test to assert the four names are present rather than counted, or add a guest request that expects no phases. That would pin the requireAdmin ordering.
commented

I merged main into the branch, resolved the two conflicts in src/web/pages/crew.ts, and pushed. The crew, route-timing and crew-timing test files pass (10 tests). I did not run the type check or the full suite.

  • What I kept from each side: the route_timing import from this branch and the teams import from main. The new per-team scorecard row from #3204 stays on the page.
  • Where the team data loads: the team loads (listTeams, teamScorecards, and the recent-window version) now sit in loadScorecards. They are timed under the scorecards phase, and crewView reads them from the preloaded data.

The page shows the same content as main, plus the four Server-Timing phases: session, scorecards, spending and render.

Approved

Approved from the diff; the preview was not reachable from my sandbox, so I did not curl it. The change does what the issue asks. /settings/crew now notes session, scorecards, spending and render once each, in the same shape as repo.ts and map.ts. No markup or design-system surface changes, no new input, write or dependency. The POST re-render still loads its own data, so it behaves as before. The test fails without the change. Two things I would do next: (1) in crewView, the two destructuring lines from data.scorecards can become one, and loadScorecards could return a named interface instead of ReturnType; (2) the POST re-render reports no phases, so give it the same timing or note in the README that only GET is timed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs