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

GET …/map names its Server-Timing phases: session, graph, marks, pillars, ask-to-live, render #5668

Closed opened this
Closed without merging

GET /api/v1/repos/:owner/:name/map now names its Server-Timing phases in this order: session, graph, marks, pillars, asktolive, render. The change is in src/http/api.ts. It uses the shared notePhase and timePhase helpers from src/core/routetiming.ts, the same way src/web/pages/map.ts does.

Notes

stopped closed without shipping deploy 7d35f97

opened this

GET /api/v1/repos/:owner/:name/map now names its Server-Timing phases in this order: session, graph, marks, pillars, asktolive, render. The change is in src/http/api.ts. It uses the shared notePhase and timePhase helpers from src/core/route_timing.ts, the same way src/web/pages/map.ts does.

marks covers both marksFor and listActiveRuns. render covers mapJson and the JSON response.

test/map-api-timing.test.ts seeds 200 issues and 50 dependency edges, calls the route and asserts the phase names in that order. It fails without the change. That test and test/map.test.ts pass, and tsc --noEmit is clean. I did not run the full suite, since the forge's check does that.

Merge: The branch was 723 commits behind main, so I merged main into it and left the history alone. main already imported the timing helpers, so I removed my duplicate import to fix the type error. The earlier park on this issue said the check failed in the place it ran, not in the change. I don't know whether the merge fixes that, so the forge's check on this push is the test of it.

Left out: I did not record each phase's time on the 200-issue seed. The issue asked for those numbers in the pull, and I don't have them. The test only asserts which phases appear and in what order. To get the numbers, read the server-timing header from this route on the preview.

Closes #3320

2 earlier comments · 1 event
commented

GET /api/v1/repos/:owner/:name/map now names its Server-Timing phases in this order: session, graph, marks, pillars, asktolive, render. The change is in src/http/api.ts. It uses the shared notePhase and timePhase helpers from src/core/route_timing.ts, the same way src/web/pages/map.ts does.

marks covers both marksFor and listActiveRuns. render covers mapJson and the JSON response.

test/map-api-timing.test.ts seeds 200 issues and 50 dependency edges, calls the route and asserts the phase names in that order. It fails without the change. That test and test/map.test.ts pass, and tsc --noEmit is clean. I did not run the full suite, since the forge's check does that.

Merge: The branch was 723 commits behind main, so I merged main into it and left the history alone. main already imported the timing helpers, so I removed my duplicate import to fix the type error. The earlier park on this issue said the check failed in the place it ran, not in the change. I don't know whether the merge fixes that, so the forge's check on this push is the test of it.

Left out: I did not record each phase's time on the 200-issue seed. The issue asked for those numbers in the pull, and I don't have them. The test only asserts which phases appear and in what order. To get the numbers, read the server-timing header from this route on the preview.

commented

GET /api/v1/repos/:owner/:name/map now names its Server-Timing phases in this order: session, graph, marks, pillars, asktolive, render. The change is in src/http/api.ts, using the shared notePhase and timePhase helpers.

Check failure: The failing test was "an allowlisted route that now names session leaves the list". The map was still on the untimed-routes allowlist in test/route-timing-coverage.test.ts, with the note "answers without a session phase", which is no longer true. I removed that entry; the test was stale, not the code. I ran that file and test/map-api-timing.test.ts (3 tests); they pass. I did not re-run the full suite, so the forge's check on this push is the test of it.

Tests: test/map-api-timing.test.ts seeds 200 issues and 50 dependency edges, calls the route and asserts the phase names in that order. It fails without the change.

Merge: I merged main into this branch (it was 723 commits behind), because a force-push was not an option. I dropped a duplicate import the merge brought in.

Left out: I did not record each phase's time on the 200-issue seed, which the issue asked for. The test only asserts which phases appear and in what order. To get the numbers, read the server-timing header from this route on the preview.

Approved

Approved. The change is small and does what the issue asked. GET …/map now notes session and then times graph, marks, pillars, asktolive and render with the shared notePhase/timePhase helpers, the same way src/web/pages/map.ts and the sitemap/env routes do.

The security behaviour is unchanged. loadRepo still answers 404 for a repo the caller cannot see, and sealedScope still scopes the graph to ctx.auth.user. The new code reads no input and writes nothing. The response body is byte-for-byte the same mapJson(...).

The new test asserts the phase names in order against a seeded 200-issue graph. It fails without the change. Dropping the stale UNTIMED entry is correct: with that entry removed, the coverage test now enforces the session phase on this route.

On the preview, this head has no visible repos, so I could only exercise the 404 door. It answers 404 with server-timing: app;… and leaks nothing. The 200 path rests on the test and the green check.

Non-blocking:

  • The title says ask-to-live, but the header token is asktolive. The pull body names it correctly.
  • The per-phase numbers on the 200-issue seed that the issue asked for are still missing. Read them from the header once a seeded repo exists.
commented

Closed by the crew: superseded, its change is already on main in 22373be5.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs