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

The API's contents read names its Server-Timing phases: session, git, render #5671

Closed opened this
Closed without merging

The check on #5671 hadn't produced a log when I looked, so I found no failure in this change to fix. Its run was still queued, and the preview deploy had already succeeded. Nothing new is pushed because I made no code change.

Notes

stopped closed without shipping deploy 5458191

opened this

The check on #5671 hadn't produced a log when I looked, so I found no failure in this change to fix. Its run was still queued, and the preview deploy had already succeeded. Nothing new is pushed because I made no code change.

  • Type check and timing tests: bun x tsc --noEmit is clean, and test/api-contents-timing.test.ts (3 tests) passes.
  • Full bun test: 15 tests fail, none near the contents route or Server-Timing. They are the real-browser and screenshot suites, the SSH-port test, a pull-review test, and the board's forge-strip tests. The browser and screenshot failures are most likely this sandbox. The sandbox also refused network calls to *.forge.test hosts during the run.
  • Board tests on main: test/board.test.ts fails the same 5 tests on a clean origin/main worktree, so those are not from this change. I did not run the other failing suites against main.
  • Local edits: src/http/api.ts showed an uncommitted edit that removed the route_timing import. Restoring it left the tree clean, and the branch matches what the forge has.

For the pull description: GET /api/v1/repos/:owner/:name/contents now reports Server-Timing phases session, git and render. git covers the type probe plus the tree or blob read, and render covers encoding and JSON. A 404 reports only session and git, and the 413 too-large response reports all three. test/api-contents-timing.test.ts covers this. I did not time any other API route.

If the forge's check fails again, send me its log: I could not see the one that failed.

Continues #5671

7 earlier comments · 2 events
commented

GET /api/v1/repos/:owner/:name/contents[/path] now names its Server-Timing phases: session, git and render. I ran test/api-contents-timing.test.ts (3 tests, passing), the test/api tests (116, passing) and tsc --noEmit (clean). I didn't run the forge's full check.

  • session: noted first, so a 404 still names it.
  • git: the cat-file -t probe plus listTree or blobForRender, added up. It is also noted on the two notFound() returns that follow the git work.
  • render: encoding and JSON. The JSON bodies are unchanged.
  • Test: the new test asserts the phase names for a directory, a file and a 404.
  • Scope: only contentsHandler changed. The one other edit in api.ts is removing a duplicate route_timing import that came in with the merge of main. The first push had that type error. The second push, 066c6a68, fixes it.
  • Left out: contentsHandler sums git time with its own small timer instead of calling timePhaseAsync, because the probe and the read have to add into one phase. I did not rewrite it to use the helper.

To try it, request a directory and a file from the contents endpoint and read the Server-Timing header.

🤖 Generated with Claude Code

commented

The check on #5671 hadn't produced a log when I looked, so I found no failure in this change to fix. Its run was still queued, and the preview deploy had already succeeded. Nothing new is pushed because I made no code change.

  • Type check and timing tests: bun x tsc --noEmit is clean, and test/api-contents-timing.test.ts (3 tests) passes.
  • Full bun test: 15 tests fail, none near the contents route or Server-Timing. They are the real-browser and screenshot suites, the SSH-port test, a pull-review test, and the board's forge-strip tests. The browser and screenshot failures are most likely this sandbox. The sandbox also refused network calls to *.forge.test hosts during the run.
  • Board tests on main: test/board.test.ts fails the same 5 tests on a clean origin/main worktree, so those are not from this change. I did not run the other failing suites against main.
  • Local edits: src/http/api.ts showed an uncommitted edit that removed the route_timing import. Restoring it left the tree clean, and the branch matches what the forge has.

For the pull description: GET /api/v1/repos/:owner/:name/contents now reports Server-Timing phases session, git and render. git covers the type probe plus the tree or blob read, and render covers encoding and JSON. A 404 reports only session and git, and the 413 too-large response reports all three. test/api-contents-timing.test.ts covers this. I did not time any other API route.

If the forge's check fails again, send me its log: I could not see the one that failed.

commented

The branch is up to date with main and in sync with origin, so I pushed nothing this run. tsc --noEmit is clean and test/api-contents-timing.test.ts passes (3 tests). I didn't run the forge's full check.

The issue has no new comments. The only one is the old "parked" note from #3792.

GET /api/v1/repos/:owner/:name/contents[/*path] now names its Server-Timing phases:

  • session: noted first, so a 404 still names it.
  • git: the cat-file -t probe plus listTree or blobForRender, added up.
  • render: encoding and JSON. The JSON bodies are unchanged.
  • Test: test/api-contents-timing.test.ts asserts the phase names for a directory, a file and a 404.
  • Scope: only contentsHandler changed, apart from removing a duplicate route_timing import left by a merge of main.
  • Left out: git time is summed with a small local timer instead of timePhaseAsync, because the probe and the read must add into one phase.

To try it, request a directory and a file from the contents endpoint and read the Server-Timing header.

🤖 Generated with Claude Code

Approved — before the latest push

Clean, small observability change (priority 3), scoped to contentsHandler. session is noted before loadRepo, so a private or unknown repo gives a guest the same session-only header, with no git phase that would show the repo exists. Phase names are fixed tokens and the JSON bodies are unchanged. Nothing here reads input, writes anything, or adds a dependency. test/api-contents-timing.test.ts passes at 066c6a68 (3/3), and it would fail without the change. On the preview, the contents route returns server-timing: app, session on a 404. The preview has no repos, so I couldn't exercise the 200 path there; the test covers it. One nit below, not blocking. The pull description has been overwritten by the builder's second status message; whoever lands it may want the first message back as the description.

commented

The contents read already named its Server-Timing phases on this branch. This run only merged the latest main and pushed, as 54581912. tsc --noEmit is clean and test/api-contents-timing.test.ts passes (3 tests). I didn't run the forge's full check.

GET /api/v1/repos/:owner/:name/contents[/*path] (contentsHandler in src/http/api.ts) names:

  • session: noted first, so a 404 still names it.
  • git: the cat-file -t probe plus listTree or blobForRender, added up.
  • render: encoding and JSON. The JSON bodies are unchanged.

test/api-contents-timing.test.ts asserts the phase names for a directory, a file and a 404.

I left timePhaseAsync out of git. contentsHandler adds the probe and the read into one phase with a small local timer, and I did not rewrite it to use the helper. No other handler in api.ts is touched, apart from a duplicate route_timing import left by an earlier merge, which I removed.

To try it, request a directory and a file from the contents endpoint and read the Server-Timing header.

🤖 Generated with Claude Code

commented

The contents read already names session, git and render in its Server-Timing header on this branch, so there was nothing new to push this run. The branch is up to date with main and with origin. tsc --noEmit is clean and test/api-contents-timing.test.ts passes (3 tests). I didn't run the forge's full check.

  • session: noted first, so a 404 still names it.
  • git: the cat-file -t probe plus listTree or blobForRender, added up with a small local timer. I did not rewrite it to use timePhaseAsync.
  • render: encoding and JSON. The JSON bodies are unchanged.
  • Test: test/api-contents-timing.test.ts asserts the phase names for a directory, a file and a 404.
  • Scope: only contentsHandler changed, plus removal of a duplicate route_timing import left by an earlier merge.

To try it, request a directory and a file from the contents endpoint and read the Server-Timing header.

🤖 Generated with Claude Code

commented

The contents read on this branch already names its Server-Timing phases, so I pushed nothing this run. The branch is up to date with main and with origin. tsc --noEmit is clean and test/api-contents-timing.test.ts passes (3 tests). I didn't run the forge's full check.

GET /api/v1/repos/:owner/:name/contents[/*path] (contentsHandler in src/http/api.ts) names three phases:

  • session: noted first, so a 404 still names it.
  • git: the cat-file -t probe plus listTree or blobForRender, added up with a small local timer. I did not rewrite it to use timePhaseAsync.
  • render: encoding and JSON. The JSON bodies are unchanged.

test/api-contents-timing.test.ts asserts the phase names for a directory, a file and a 404.

Only contentsHandler changed, apart from removing a duplicate route_timing import left by an earlier merge.

To try it, request a directory and a file from the contents endpoint and read the Server-Timing header.

🤖 Generated with Claude Code

commented

The contents read on this branch already names its Server-Timing phases, so I pushed nothing this run. The branch is up to date with main and with origin. tsc --noEmit is clean and test/api-contents-timing.test.ts passes (3 tests). I didn't run the forge's full check.

GET /api/v1/repos/:owner/:name/contents[/*path] (contentsHandler in src/http/api.ts) names three phases:

  • session: noted first, so a 404 still names it.
  • git: the cat-file -t probe plus listTree or blobForRender, added up with a small local timer. I did not rewrite it to use timePhaseAsync.
  • render: encoding and JSON. The JSON bodies are unchanged.

test/api-contents-timing.test.ts asserts the phase names for a directory, a file and a 404.

Only contentsHandler changed, apart from removing a duplicate route_timing import left by an earlier merge.

To try it, request a directory and a file from the contents endpoint and read the Server-Timing header.

🤖 Generated with Claude Code

Approved

Approved. contentsHandler now notes session first, git as the sum of the cat-file -t probe plus listTree/blobForRender, and render as the JSON building, on the 200, 413 and git-side 404 paths. The JSON bodies, auth (loadRepo), ref/path validation and the security headers are untouched; nothing new reads the request, so there is no new input to check. It follows the same pattern as the other API handlers (notePhase(ctx.request, "session", takeSessionTime(...))). I applied the diff on main 35d1086: test/api-contents-timing.test.ts gives 3 pass, and 3 fail without the api.ts change, so the test really covers the behaviour. On the preview, /api/v1/repos/trevato/forge/contents answers 404 with server-timing: app;dur=…, session;dur=…. The preview has no repositories, so I could not watch the git/render phases live; the test covers them. There is no page or tty side to this change; it is a header on a JSON route.

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