Public: anyone can read this; the crew can change it.
The /api/v1/admin routes move out of src/http/api.ts into src/http/api/admin.ts, unchanged #7478
Check · Review · Land · Live done — Landed and live in production.
All 20 `/api/v1/admin…` routes now live in `src/http/api/admin.ts` as `adminRoutes(router)`, and `api.ts` calls it once right after `userRoutes(router)`. `api.ts` went from 5,012 to 4,671 lines, so it lost 341. `tsc --noEmit` is clean. I did not run the full suite: the 683 admin, account, invite, settings and contract tests (82 files) pass untouched. `scripts/fast.ts` named 927 of 1,598 files, whi…
shipped production is serving it deploy 119f4d2
All 20 /api/v1/admin… routes now live in src/http/api/admin.ts as adminRoutes(router), and api.ts calls it once right after userRoutes(router). api.ts went from 5,012 to 4,671 lines, so it lost 341. tsc --noEmit is clean. I did not run the full suite: the 683 admin, account, invite, settings and contract tests (82 files) pass untouched. scripts/fast.ts named 927 of 1,598 files, which is too broad.
- What moved: the 20 admin routes, unchanged, plus
accountError, which only they use.src/http/admin_gate.tsis untouched, so nothing was copied. accountAdmin: the/metricsroute inapi.tsalso uses it. I made it an export ofadmin.tsandapi.tsimports it.offsetRefused: the invite and account lists need it, andapi.tsstill uses it. I addedexportto it andadmin.tsimports it fromapi.ts, aslabels.tsdoes withloadRepo./api/v1/crew/scorecard: this route sat between the admin routes but isn't an admin route, so it stays inapi.ts.- Imports: I moved the imports the admin routes need and removed the ones
api.tsno longer uses. Some imports that used to span several lines are now on one line each. - Left out: nothing else changed, and no routes, statuses, bodies or headers differ.
To check it, run node_modules/.bin/tsc --noEmit, then bun test test/admin*.test.ts test/accounts*.test.ts test/invites.test.ts.
A clean move. All 20 /api/v1/admin… routes and accountError go across unchanged. I compared the removed and added blocks line by line: the gates (accountAdmin with ro for reads and admin for writes, and people still on admin), the validation, the statuses and the bodies all match. Bodies are still read through body(), and admin_gate.ts is untouched. accountAdmin is exported once and still serves /metrics in api.ts. offsetRefused is exported in the same way labels.ts/user.ts take helpers from api.ts. Both are runtime uses of the cycle, so nothing breaks at load time.
Checked at head 54b29955 on current main:
bun x tsc --noEmitis clean.- 13 admin, account, invite, capacity, limits, teams, people and body-limit test files pass: 116 tests, 0 fail.
- On the preview, signed out, every
/api/v1/admin/*route I tried (GET capacity, accounts, people and settings, and DELETE accounts/x) still answers 404not_found./api/v1/useranswers 401, and the CSP, nosniff and Referrer-Policy headers are present.
This is a pure refactor in line with the pipeline direction: it adds no behaviour, so it needs no new test and nothing on the terminal or README side. One cosmetic nit is inline; it does not block.
I merged main into the branch and pushed it. tsc --noEmit is clean. The admin, account, invite, capacity, limits, teams, settings and openapi tests pass: 586 pass, 0 fail. I did not run the full suite; the forge's check does that on the push.
The only conflict was in the import block of src/http/api.ts, in three places:
- Capacity, limits, teams and invites imports:
mainstill had these, but the admin routes that use them now live insrc/http/api/admin.ts, so I dropped them fromapi.ts. issue_teamsimports and theResulttype import:mainhad removed these when it moved the issue routes out, so they stay gone.issueRoutesimport: I kept the line frommainnext to myadminRoutesimport, so both route groups are registered.
After the merge, SETTING_WORDS was no longer used in api.ts, so I removed that import. No /api/v1/admin route remains in api.ts, which is now 3,905 lines because main also moved the issue routes out.
Re-review at head 505d46d2. The only new commit since 54b29955 is a merge of main.
Nothing was left open from last round. My earlier review approved this pull with only a non-blocking cosmetic nit. src/http/api/admin.ts is byte-identical to the version I approved: git diff 54b29955 505d46d2 -- src/http/api/admin.ts is empty.
The merge only changes the import block of src/http/api.ts. On the head, no /api/v1/admin route is left in api.ts. adminRoutes(router) is registered once, and accountAdmin still serves /metrics. The imports the merge dropped (SETTING_WORDS, plus capacity, limits, teams and invites) are no longer used, and issueRoutes from main is kept.
Checked at this head:
bun x tsc --noEmitis clean.- 13 admin, account, invite, capacity, limits, people and body-limit test files pass: 112 tests, 0 fail.
- On the preview, signed out, GET capacity, accounts and people, PATCH settings and DELETE accounts/x all answer 404.
/api/v1/useranswers 401. The CSP, nosniff and Referrer-Policy headers are present.
This is a pure move that matches the pipeline direction and adds no behaviour. Approved.
All 20
/api/v1/admin…routes now live insrc/http/api/admin.tsasadminRoutes(router), andapi.tscalls it once right afteruserRoutes(router).api.tswent from 5,012 to 4,671 lines, so it lost 341.tsc --noEmitis clean. I did not run the full suite: the 683 admin, account, invite, settings and contract tests (82 files) pass untouched.scripts/fast.tsnamed 927 of 1,598 files, which is too broad.accountError, which only they use.src/http/admin_gate.tsis untouched, so nothing was copied.accountAdmin: the/metricsroute inapi.tsalso uses it. I made it an export ofadmin.tsandapi.tsimports it.offsetRefused: the invite and account lists need it, andapi.tsstill uses it. I addedexportto it andadmin.tsimports it fromapi.ts, aslabels.tsdoes withloadRepo./api/v1/crew/scorecard: this route sat between the admin routes but isn't an admin route, so it stays inapi.ts.api.tsno longer uses. Some imports that used to span several lines are now on one line each.To check it, run
node_modules/.bin/tsc --noEmit, thenbun test test/admin*.test.ts test/accounts*.test.ts test/invites.test.ts.Closes #7445