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

The rosters: generate the route table roster from one file per member (child of #14248) #14439

Merged opened this

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

Merged

The route marks, which are the forge's roster of its route table, are now built from a directory, one file per head. They're in src/http/marks/, 171 files. The tests I ran pass and tsc is clean.

Notes

shipped production is serving it deploy 4ec2c16

opened this

The route marks, which are the forge's roster of its route table, are now built from a directory, one file per head. They're in src/http/marks/, 171 files. The tests I ran pass and tsc is clean. I did not run bun scripts/fast.ts.

What moved where

  • HEADS and ROUTES in src/http/route_marks.ts were two hand-edited tables of about 400 lines. They now come from readMembers(), which reads src/http/marks/*.json in file-name order.
  • Each file holds { head, mark }. Where the mark is mixed, it also holds that head's routes, with each route's mark. Every entry of the old ROUTES sits in the file of its own head.
  • I checked that the rebuilt HEADS and ROUTES equal the old literals entry for entry. Matching, markOf, isAdminRoute and the admin gate are unchanged, so no behaviour moved.
  • A pull that adds a route head now adds one file. It no longer edits a shared list.
  • docs/ROLES.md points at the directory.

Test

  • test/route-marks-roster.test.ts checks that HEADS equals the directory's heads, each once. It checks that ROUTES equals the directory's routes, each under its own head. It also checks that a mixed head lists routes and that no file is hidden or not .json.
  • test/route-marks.test.ts, open-routes-floor, security-floor-routes and mutations-same-origin pass unchanged.

What I left out

  • The route table in server.ts still has its 608 router.add calls. Route order there matters, because the first match wins, so I did not split it. The marks were the roster pulls collide on.
  • I dropped the one inline comment on /api/v1/runner ("A runner's own door…"). The JSON files have no comment field.
  • Two file names are not obvious from the head: /__forge is forge.json and /- is dash.json. / is root.json and the trailing-slash /api/v1/ is api-v1-slash.json. The files are keyed by their head field, not their name.

How to try it Add src/http/marks/<name>.json with {"head":"/new","mark":"open"}. A route under /new is then marked, and test/route-marks.test.ts stops reporting it as unmarked.

I pushed an empty "Try:" commit because the pre-push hook asked for one. The pull is the one the forge opens from this branch.

Closes #14437

commented

The route marks, which are the forge's roster of its route table, are now built from a directory, one file per head. They're in src/http/marks/, 171 files. The tests I ran pass and tsc is clean. I did not run bun scripts/fast.ts.

What moved where

  • HEADS and ROUTES in src/http/route_marks.ts were two hand-edited tables of about 400 lines. They now come from readMembers(), which reads src/http/marks/*.json in file-name order.
  • Each file holds { head, mark }. Where the mark is mixed, it also holds that head's routes, with each route's mark. Every entry of the old ROUTES sits in the file of its own head.
  • I checked that the rebuilt HEADS and ROUTES equal the old literals entry for entry. Matching, markOf, isAdminRoute and the admin gate are unchanged, so no behaviour moved.
  • A pull that adds a route head now adds one file. It no longer edits a shared list.
  • docs/ROLES.md points at the directory.

Test

  • test/route-marks-roster.test.ts checks that HEADS equals the directory's heads, each once. It checks that ROUTES equals the directory's routes, each under its own head. It also checks that a mixed head lists routes and that no file is hidden or not .json.
  • test/route-marks.test.ts, open-routes-floor, security-floor-routes and mutations-same-origin pass unchanged.

What I left out

  • The route table in server.ts still has its 608 router.add calls. Route order there matters, because the first match wins, so I did not split it. The marks were the roster pulls collide on.
  • I dropped the one inline comment on /api/v1/runner ("A runner's own door…"). The JSON files have no comment field.
  • Two file names are not obvious from the head: /__forge is forge.json and /- is dash.json. / is root.json and the trailing-slash /api/v1/ is api-v1-slash.json. The files are keyed by their head field, not their name.

How to try it Add src/http/marks/<name>.json with {"head":"/new","mark":"open"}. A route under /new is then marked, and test/route-marks.test.ts stops reporting it as unmarked.

I pushed an empty "Try:" commit because the pre-push hook asked for one. The pull is the one the forge opens from this branch.

Approved

Clean. The route-mark tables move to one JSON file per head with no behaviour change. The preview boots, / answers 200, and an admin route (/settings/trusted) still redirects an unauthenticated caller. The roster test covers the heads, the routes, and hidden or non-json files. Admin and open marks are carried over entry for entry, and the readers only touch repo files, with no user text. Two small non-blocking notes: the ROLES.md line is now very long and could be rewrapped, and the dropped comment on /api/v1/runner could live in the ROLES.md or the test.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs