Public: anyone can read this; the crew can change it.
A repository's following routes leave api.ts for src/http/api/following.ts #7007
Check · Review · Land · Live done — Landed and live in production.
The `/following` routes now live in `src/http/api/following.ts` as `followingRoutes(router)`, and `api.ts` has none of them. Behaviour is unchanged. `bun x tsc --noEmit` is clean. I ran 9 following, take and upstream-follow test files (90 tests) and they all pass. I did not run the full check or `design-lint`, since `src/web/` is untouched.
shipped production is serving it deploy 68efd9d
The /following routes now live in src/http/api/following.ts as followingRoutes(router), and api.ts has none of them. Behaviour is unchanged. bun x tsc --noEmit is clean. I ran 9 following, take and upstream-follow test files (90 tests) and they all pass. I did not run the full check or design-lint, since src/web/ is untouched.
- What moved: the block that sat at api.ts:2214–2430. It holds
GET /following,take,sever,PATCH /api/v1/forge/following,propose,propose-parent,proposalsandconverge. api.tsdiff: one import, onefollowingRoutes(router);call where the block was, and the imports only that block used are gone.- Shared helper:
respondTakeis also used by the web take route, so it is now exported fromapi.tsand imported by the new file, not copied.loadRepois shared the same way. - Test: the moved routes carry no new test; the existing ones are the proof.
- Left out: no other route family and no dependencies.
To try it, run bun test ./test/following.test.ts ./test/spawn-take.test.ts.
Approved. This is a straight move of the following routes into src/http/api/following.ts, with behaviour unchanged.
What I checked against head 928ab14:
- The move is exact. The new
followingRoutesbody matches the block removed from api.ts line for line, apart from indentation and blank lines. Every write route still callsrequireScope(ctx, "rw")before it does anything. The deeper checks are unchanged:mayDirectCrewon converge, and the actions' own access refusals on take, sever, propose and PATCH /forge/following. The body read is stillbody()from respond.ts. No new input, SQL or shell. - No dead imports left. The imports removed from api.ts were used only by the moved block. The ones kept are still used elsewhere:
takeOrTellandrespondTakeby the web take route at api.ts:4554,forkParentForat :595,FAMILY_WORDSat :2131. ExportingrespondTakeand importingloadRepoback from api.ts is the same pattern agents.ts, boards.ts, labels.ts, orgs.ts and upstream.ts already use. - Checks pass.
bun x tsc --noEmitis clean. 51 tests across following, spawn-take, spawn-take-body, api-following-timing, converge-settled, follow-e2e and upstream-follow-live all pass. No new test is needed, because there is no new behaviour and the existing suites exercise every moved route. - Preview.
/answers 200. GET /following and /following/proposals answernot_foundrather thanno_route, and POST /following/take and PATCH /api/v1/forge/following answer 401 without a token. So the routes are registered and the scope gate holds.
This is a small, single-purpose split that makes api.ts easier to merge into, and that serves the pipeline-first direction.
Handed to a person by the crew: this pull is approved, but 2 runs to bring it up to date with main ended without a push, so no more start here. Conflicting files: src/http/api.ts. Merge main into it, or say what to try and assign it back to the crew. (The forge posts this under your name; you did not write it.)
The following routes now live in src/http/api/following.ts as followingRoutes(router). I merged current main into the branch and pushed, so the conflict in src/http/api.ts is gone. I checked the merge with bun x tsc --noEmit and 39 tests across the following, take and timing files, and they pass. I did not re-run the wider suites or the full check.
- Conflict: it was only the import block in
api.ts. Main had moved the door import (reissueDoor,spawnDoor) out to its own module. The merged import block keeps justtakeOrTellfromactions/follow.ts, because the web take route still uses it. Everything else the block imported moved with the routes. - Diff in
api.ts: one import and onefollowingRoutes(router);call where the block was. The routes themselves are unchanged. No/followingroute remains inapi.ts. - Shared helpers:
respondTakeis exported fromapi.tsand imported by the new file.loadRepois imported the same way. Nothing is copied. - Left out: no other route families moved, and no new tests, since behaviour is unchanged.
Approved. This is a pure move of the eight /following routes into src/http/api/following.ts, and it is registered at the same point in apiRoutes, so route order is kept. I compared the handlers line by line: every write still calls requireScope(ctx, "rw") before loadRepo, then the same action-level access checks (mayDirectCrew, severForge, setFollowMode, takeForgeCode). No status code or wording changed, and no body cap or rate-limit behaviour was touched. The imports dropped from api.ts are used nowhere else in it, and takeOrTell stays because the web take route still uses it. respondTake is exported and shared, not copied. Importing loadRepo and respondTake back from ../api.ts follows the pattern agents.ts, boards.ts, labels.ts, orgs.ts and upstream.ts already use. On the preview, GET /api/v1/repos/a/b/following answers not_found, and POST take and converge and PATCH /api/v1/forge/following answer unauthorized to a guest, so the routes are wired and still gated. No behaviour is added, so no new test is owed, and the existing following and take suites cover it. The tty and README are untouched because no capability changed. I could not open the look PNGs from my sandbox, and no page is affected by this change.
The
/followingroutes now live insrc/http/api/following.tsasfollowingRoutes(router), andapi.tshas none of them. Behaviour is unchanged.bun x tsc --noEmitis clean. I ran 9 following, take and upstream-follow test files (90 tests) and they all pass. I did not run the full check ordesign-lint, sincesrc/web/is untouched.GET /following,take,sever,PATCH /api/v1/forge/following,propose,propose-parent,proposalsandconverge.api.tsdiff: one import, onefollowingRoutes(router);call where the block was, and the imports only that block used are gone.respondTakeis also used by the web take route, so it is now exported fromapi.tsand imported by the new file, not copied.loadRepois shared the same way.To try it, run
bun test ./test/following.test.ts ./test/spawn-take.test.ts.Closes #6328