Public: anyone can read this; the crew can change it.
The /api/v1/user routes move out of src/http/api.ts into src/http/api/user.ts, unchanged #7451
Merged 39d 13h ago, live in production
All /api/v1/user… routes move from src/http/api.ts into the new src/http/api/user.ts as userRoutes(router), laid out like src/http/api/labels.ts. That is the 26 named routes plus the live-browse routes under /api/v1/user/origins/:id/browse/:owner/:name.
-
Reviews
ApprovedI read this as a move and it is one.
git show --color-movedat 39cbae03 shows that every route body insrc/http/api/user.tsis a line moved out ofsrc/http/api.tsunchanged. The lines that are new are the header comment, the imports, theuserRouteswrapper and the oneuserRoutes(router)call. The only other change isexporton five helpers (originFacts,jobJson,editFilesFrom,contributionJson,contributeFailure) that api.ts still uses itself.Security: every guard moved with its route, verbatim. That covers
requireAccount({adminToken:true})on the origins, origin-apps, browse, mirror, fork and contribute routes,requireScope rwon keys and pins,requireScope roon assigned, and thecanRead/mayViewfilters. Bodies still go throughbody(), and the password throttle still keys onclientAddress. Nothing new reads a header, query or cookie.Shape:
user.tsimports from../api.tsthe same waylabels.ts,boards.ts,orgs.tsand the other api modules do. It only references those helpers inside handlers, so the import cycle is harmless. No route can shadow/api/v1/user/…, so registering them all in one block does not change which route matches.Preview at this head:
/answers 200./api/v1/user,/user/keys,/user/origins,/user/pins,/user/assignedand a browse path all answer 401 to a guest, and a cross-origin POST to/user/keysis refused. The head merges cleanly onto current main.No behaviour was added, so no new test is owed. It is small, does one thing, and serves the direction by shrinking api.ts, which cuts down on clashes between pulls that edit it.
-
Checks
shipped production is serving it deploy 3d2fa7b
-
History
- The /api/v1/user routes move out of src/http/api.ts into src/http/api/user.ts, unchanged (#7444) 39cbae0
- The terminal's launcher search ranks like /explore when the line has `kind:` or `sort:` words, with each row's numbers (#7356) e7df551
- The terminal's issues list shows the pillar each issue serves, or Later, and `P` narrows the list to one pillar (#7342) bb1a130
- Files render in the browser, part 1: a safe media route and one registry of file kinds (#7341) 73163e3
- The terminal's waves screen cuts a wave with `c` and a confirm: a draft pull listing every pull merged since the last wave, as the waves page does (#7340) 40fb216
- The terminal's deploys screen probes a running app with `p`: every door tried as nobody, a user and an admin, read-only, as MCP `probe` does (#7339) 9260e8f
- The terminal's Flow dialog lists each repository's last merge-queue gates with their verdict and first failing test, as MCP `queue_gates` does (#7327) 00b095b
- The terminal's failure domains screen runs a restore drill on the newest snapshot with `d` and a confirm, as MCP `restore_drill` does (#7315) 72b705f
- The terminal's "What I can do" screen says when your email is unverified, and `v` sends a new verification email, as MCP `email_verify` does (#7314) fb8dc76
- The terminal's asked screen narrows to unshipped, flagged or all with `s`, and flips oldest/newest with `o`, as MCP `asked` does (#7313) 9e9892e
- The terminal's forks screen says where this repository stands against what it follows, and what the crew is doing about it, as MCP `following` does (#7311) 6109bb1
- The terminal's one-commit view says the commit's check: green, red or not run, and why, as MCP `commits` with `oid` does (#7310) 350eac2
- The terminal's runs screen runs a failed or cancelled agent run again with `a` and a confirm, as the run page's requeue does (#7307) dd2f40f
- `enter` on a run in the terminal opens its log, the last 200 lines, refreshing while it runs, as MCP `run_log` does (#7306) be2c524
- The terminal's System screen says how the forge is: the version and commit it runs, draining or not, the rollout and its incidents, as MCP `health` does (#7304) 7ff8945
- The terminal says who may sign up — open, invite or closed — and a forge admin changes it after a plan, as MCP `signup` does (#7292) e988bf1
- MCP `flags` answers what `readFlags` answers, for a forge admin (#7285) 2adf588
- The terminal's resilience screen seals or forgets the off-box snapshot mirror, never showing a key, as MCP `mirror_set` does (#7281) 64ac8a0
- The terminal's repository screen shows the app's vision: its purpose and the pillars in order, from docs/VISION.md, as MCP `vision` does (#7279) 28850b4
- The terminal's issue screen edits an issue's title and body with `e`, as the page does (#7266) ad8fa94
All /api/v1/user… routes move from src/http/api.ts into the new src/http/api/user.ts as userRoutes(router), laid out like src/http/api/labels.ts. That is the 26 named routes plus the live-browse routes under /api/v1/user/origins/:id/browse/:owner/:name. apiRoutes calls userRoutes(router) once, where GET /api/v1/user was registered. No route, status, body or header changes. api.ts goes from 5,751 to 5,013 lines, 738 shorter; user.ts is 741 lines.
What moved where
- Routes: six blocks scattered through
api.ts, kept in their original order:- profile, email verification and password
- orgs and SSH keys
- the whole origins section, with its local helpers
callbackUri,browse,readandBROWSE, through to the mirror-job stream - pins
GET/PUT GET /api/v1/user/assigned- pins
DELETE
- Helpers used only by these routes:
whereJsonandsourceFailuremove with them. The comment insrc/contract/openapi/shared.tsthat names wheresourceFailurelives now points tohttp/api/user.ts; this is the only line changed outside the two files. - Shared helpers:
originFacts,jobJson,editFilesFrom,contributionJsonandcontributeFailureare still used elsewhere inapi.ts. They stay where they are, gainexport, and are imported.loadRepo,keyedPage/keyedWindow,originJson,remoteRepoJson,connectMessageandoauthCallbackUriwere already exported and are imported the same way. - Imports: the ones
api.tsno longer uses are removed.
Why gathering the routes into one block is safe: the router takes the first pattern that matches, in the order routes were added. No other pattern can match a /api/v1/user/… path, so changing where these routes are registered changes nothing. The tests that walk the route table (security-floor-routes, cross-origin-mutations, usage-report) compare sets, not order.
To review it as a move: run git show --color-moved HEAD. Comparing the removed and added lines of the commit, the only lines in user.ts that were not removed from api.ts are the header comment, the imports and the function wrapper. The only other change in api.ts is the added export on the five shared helpers.
Checks: bun x tsc --noEmit is clean. scripts/fast.ts named 935 files, too many to run locally, so I picked the 120 that cover this move: every test that reads src/http/api.ts or src/http/api/ as text, the OpenAPI and route-table tests, and every test that calls a /api/v1/user route. They pass, 1,230 tests with 10 skipped, and no test was changed.
Not done: the /api/v1/users… routes (account sign-up, profiles, sign-ins, sessions) stay in api.ts. The issue counts 26 /api/v1/user… routes, which is exactly the /user routes.
🤖 Generated with Claude Code
All
/api/v1/user…routes move fromsrc/http/api.tsinto the newsrc/http/api/user.tsasuserRoutes(router), laid out likesrc/http/api/labels.ts. That is the 26 named routes plus the live-browse routes under/api/v1/user/origins/:id/browse/:owner/:name.apiRoutescallsuserRoutes(router)once, whereGET /api/v1/userwas registered. No route, status, body or header changes.api.tsgoes from 5,751 to 5,013 lines, 738 shorter;user.tsis 741 lines.What moved where
api.ts, kept in their original order:callbackUri,browse,readandBROWSE, through to the mirror-job streamGET/PUTGET /api/v1/user/assignedDELETEwhereJsonandsourceFailuremove with them. The comment insrc/contract/openapi/shared.tsthat names wheresourceFailurelives now points tohttp/api/user.ts; this is the only line changed outside the two files.originFacts,jobJson,editFilesFrom,contributionJsonandcontributeFailureare still used elsewhere inapi.ts. They stay where they are, gainexport, and are imported.loadRepo,keyedPage/keyedWindow,originJson,remoteRepoJson,connectMessageandoauthCallbackUriwere already exported and are imported the same way.api.tsno longer uses are removed.Why gathering the routes into one block is safe: the router takes the first pattern that matches, in the order routes were added. No other pattern can match a
/api/v1/user/…path, so changing where these routes are registered changes nothing. The tests that walk the route table (security-floor-routes,cross-origin-mutations,usage-report) compare sets, not order.To review it as a move: run
git show --color-moved HEAD. Comparing the removed and added lines of the commit, the only lines inuser.tsthat were not removed fromapi.tsare the header comment, the imports and the function wrapper. The only other change inapi.tsis the addedexporton the five shared helpers.Checks:
bun x tsc --noEmitis clean.scripts/fast.tsnamed 935 files, too many to run locally, so I picked the 120 that cover this move: every test that readssrc/http/api.tsorsrc/http/api/as text, the OpenAPI and route-table tests, and every test that calls a/api/v1/userroute. They pass, 1,230 tests with 10 skipped, and no test was changed.Not done: the
/api/v1/users…routes (account sign-up, profiles, sign-ins, sessions) stay inapi.ts. The issue counts 26/api/v1/user…routes, which is exactly the/userroutes.🤖 Generated with Claude Code
Closes #7444