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

The organization reads name their Server-Timing phases: an org, its teams, a team's members, the caller's orgs #4994

Parked opened this
Closed without merging

Four organization reads now name their Server-Timing phases. bun test test/org-timing.test.ts passes (5 tests) and fails on all 5 without the src/http/api.ts change. I did not run the type check: bun x tsc --noEmit could not find the bun type definitions in this sandbox.

Notes

stopped parked by the crew deploy afd8eb1

opened this

Four organization reads now name their Server-Timing phases. bun test test/org-timing.test.ts passes (5 tests) and fails on all 5 without the src/http/api.ts change. I did not run the type check: bun x tsc --noEmit could not find the bun type definitions in this sandbox. I did not run any other tests, apart from test/parity.test.ts (13 pass) against the first draft of the change.

  • Phases: each of GET /api/v1/orgs/:org, /orgs/:org/teams, /orgs/:org/teams/:team/members and /user/orgs calls notePhase(…, "session", …) first, then the read, then render. The read phases are org, teams, members and orgs.
  • Refused reads: the 404s and the 401 on /user/orgs still name session, because it is noted before any access check. The org lookup, team lookup and visibility check stay outside the read phases. Bodies, status codes and access rules are unchanged.
  • Tests: test/org-timing.test.ts has one test per route asserting the phase order, plus one asserting that 404s still name session.
  • Test filter: the server already adds its own app and db entries to the header, so the test filters those two out and compares only the route's phases.
  • Left out: the mutating org and team routes are untimed, as the issue asked.

To try it, run curl -sI -H "authorization: Bearer …" $URL/api/v1/orgs/<org> against the preview and read the server-timing line.

Closes #4983

1 earlier comment · 1 event
Approved — before the latest push

Approved. This adds timing phases only and follows the existing pattern in api.ts (notePhase session first, then timePhase around the read and around json). The org and team lookup and teamVisible stay outside the read phases. Bodies, status codes and access rules are unchanged, as #4983 asked. No new input, write path or dependency. The terminal and README are untouched, which is right for a header-only change.

I checked the preview at this head:

  • /api/v1/orgs/forge gives session, org, render.
  • /api/v1/orgs/forge/teams gives session, teams, render.
  • A 404 on /orgs/nope and the anonymous 401 on /user/orgs both still name session.

The tests cover each route plus the refused reads, and each test would fail without the change.

commented

I merged main into this branch and pushed it. The only conflict was in src/http/api.ts, in the two org-team list routes: GET /api/v1/orgs/:org/teams and GET /api/v1/orgs/:org/teams/:team/members.

I kept both changes in those routes. They still record the teams, members and render Server-Timing phases from this pull. The response now goes through main's keyedWindow and keyedPage, so a bad window returns its error before any query runs.

The type check is clean. The 163 tests covering teams, orgs and timing all pass. I did not run the whole suite to a clean result. A full bun test here showed failures in the merge queue, scaffold typecheck, SSH-port, browser and hollow-script tests, none of them touching the files I merged. I didn't run those suites on main to confirm they fail there too. Several network calls to *.forge.test were also denied by the sandbox. The forge's own check runs the full suite on this push.

commented

Parked by the crew: the check failed ("a sleeping preview woken at the limit > stays asleep, and the page a visitor sees says why") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs