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

src/http/server.ts hands each route family to its own small module, with the same answers #16782

Merged opened this

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

Merged

This is the first pull for #15367. It moves the /forges…, /family, /pricing… and /templates… routes, plus "+ New forge" (/forges/new, /forges/start), out of src/http/server.ts into a new src/http/forgesroutes.ts. That is 39 registrations with the same handlers in the same order, so the routes answer as before.

Notes

opened this

This is the first pull for #15367. It moves the /forges…, /family, /pricing… and /templates… routes, plus "+ New forge" (/forges/new, /forges/start), out of src/http/server.ts into a new src/http/forges_routes.ts. That is 39 registrations with the same handlers in the same order, so the routes answer as before. server.ts goes from 3,556 to 3,508 lines. The file follows the pattern of infra_routes.ts and pinned_routes.ts: forgesRoutes(router) is called at the spot where the block used to sit, above /:owner.

The order is unchanged because the router matches in registration order. The literal /forges/new has to stay beside /forges/:name/… and /forges/name/:name.

I removed the imports in server.ts that only this block used, and bun x tsc --noEmit is clean. I ran 39 test files covering the touched routes, including body-caps, forges-, pricing- and new-forge-. They give 230 pass and 0 fail. I did not run the whole suite, and the forge runs the full check on push. Three outbound connections to .forge.test hosts were denied by the sandbox during those runs, and the tests still passed.

I added no new function, so there was nothing to reuse from similar.ts. The gate rewrapped comments in two files; nothing is left uncommitted. The commit line says No door:, because nothing was added.

Family order for the next pulls, each from server.ts, one per pull:

  1. Sign-in, sign-up, claim and join (/signin, /signup, /claim, /welcome, /first-admin, /join, /verify, /logout).
  2. /asks… and the /board family.
  3. /design… and /packs….
  4. The well-known and static files (/.well-known/, /assets/, icons, robots.txt, llms.txt).
  5. /maintenance…, /fleet… and the admin pages.
  6. The per-repository routes under /:owner/:name, which are the bulk of the file.

I did not touch resolveAuth, the request pipeline or the handler code, since this pull is about routes only. I also did not start the other families, to keep this diff reviewable.

To try: bun test test/forges-refused.test.ts test/pricing-order.test.ts test/new-forge-stranger.test.ts. On the preview, open /forges, /pricing, /templates and /forges/new.

🤖 Generated with Claude Code

Closes #15367

2 earlier comments
commented

This is the first pull for #15367. It moves the /forges…, /family, /pricing… and /templates… routes, plus "+ New forge" (/forges/new, /forges/start), out of src/http/server.ts into a new src/http/forges_routes.ts. That is 39 registrations with the same handlers in the same order, so the routes answer as before. server.ts goes from 3,556 to 3,508 lines. The file follows the pattern of infra_routes.ts and pinned_routes.ts: forgesRoutes(router) is called at the spot where the block used to sit, above /:owner.

The order is unchanged because the router matches in registration order. The literal /forges/new has to stay beside /forges/:name/… and /forges/name/:name.

I removed the imports in server.ts that only this block used, and bun x tsc --noEmit is clean. I ran 39 test files covering the touched routes, including body-caps, forges-, pricing- and new-forge-. They give 230 pass and 0 fail. I did not run the whole suite, and the forge runs the full check on push. Three outbound connections to .forge.test hosts were denied by the sandbox during those runs, and the tests still passed.

I added no new function, so there was nothing to reuse from similar.ts. The gate rewrapped comments in two files; nothing is left uncommitted. The commit line says No door:, because nothing was added.

Family order for the next pulls, each from server.ts, one per pull:

  1. Sign-in, sign-up, claim and join (/signin, /signup, /claim, /welcome, /first-admin, /join, /verify, /logout).
  2. /asks… and the /board family.
  3. /design… and /packs….
  4. The well-known and static files (/.well-known/, /assets/, icons, robots.txt, llms.txt).
  5. /maintenance…, /fleet… and the admin pages.
  6. The per-repository routes under /:owner/:name, which are the bulk of the file.

I did not touch resolveAuth, the request pipeline or the handler code, since this pull is about routes only. I also did not start the other families, to keep this diff reviewable.

To try: bun test test/forges-refused.test.ts test/pricing-order.test.ts test/new-forge-stranger.test.ts. On the preview, open /forges, /pricing, /templates and /forges/new.

🤖 Generated with Claude Code

commented

server.ts now hands the /forges, /family, /pricing and /templates routes to src/http/forges_routes.ts. The routes keep their original order, so each one answers as before.

The gate failed because this pull changes src/http/forges_routes.ts and src/http/server.ts but adds no test. This is a pure move, so I didn't write one. I added an empty commit with a No test: line explaining that, which the gate accepts for changes that alter no behaviour. I pushed it and haven't seen the forge's check result for the new commit. I didn't run bun test or tsc this turn.

To try it, open /forges, /pricing, /templates and /forges/new on the preview. Each should render exactly as it did on main.

commented

The /forges, /family, /pricing and /templates routes now live in src/http/forges_routes.ts, registered from server.ts in the same order, so every page answers as before. The check's failures came from tests that scan the router source as text and didn't know about the new file. I haven't seen the forge's check result for this push.

  • Tests changed: test/design-audit.test.ts, test/guide.test.ts, test/openapi.test.ts and test/server-timing-sweep.test.ts now read forges_routes.ts alongside server.ts and settings_routes.ts. The tests were wrong only in where they looked for routes. Their assertions are unchanged.
  • Verified here: those four plus test/pages-budget.test.ts pass (57 tests), and tsc --noEmit is clean.
  • Left alone: "/llms.txt stays under its byte budget for each role" is red on main too, so it isn't from this pull.
  • Left alone: the earlier gate failure about a missing test is covered by the No test: commit.

To try it, open /forges, /pricing, /templates and /forges/new on the preview. Each should render as it does on main.

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs