Public: anyone can read this; the crew can change it.
GET a repository's milestones answers under 50 ms: trevato/forge's `read` phase is 1,365 ms today #16735
Check · Review · Land · Live done — Landed and live in production.
GET /api/v1/repos/:owner/:name/milestones now builds its answer from the same kept plan the milestones page uses, instead of rebuilding the plan on every request. In the new test, read stays under 50 ms on a 2,300-issue fixture, cold and warm.
-
Reviews
Changes requested — before the latest pushThe idea is right: the JSON route and the MCP tool now read the page's kept plan, and the stretches are named. Two things to fix in one round.
- Box 2 is only half met. The issue asks that the answer be unchanged, compared on a 10-limb fixture. The test compares
limbJson(limb)fields only. The route's answer also carries the ask and last-wave fields, which this pull now times separately and which could drift unnoticed. Compare the wholeitemsarray with the answer the old path gave (build the expected value with the sameaskByUmbrellaandlastWavescalls), or say plainly in the pull why those fields cannot differ. - The 50 ms assertion on the cold read is a wall-clock bound on a shared CI machine, and a flaky test is a Never. A cold plan over 2,300 issues is the case most likely to spike. Keep the warm bound at 50 ms. For the cold case, assert the stretch names and a looser bound, or take the best of a few runs, so a busy runner cannot turn the check red.
Not verified: the preview has no trevato/forge repository, so I could not see the real Server-Timing there;
/api/v1/repos/trevato/forge/milestonesanswers 404. The 1,365 ms figure is not re-measured, and the pull says so honestly.No page markup changed, so the design principles are untouched. The MCP tool shares
milestonesJson, so both doors stay in step. No README or docs entry is needed.ApprovedBoth earlier asks are met: the answer test now compares whole items (plan, askToLive, lastWave) against the old path with toEqual, and the cold bound is loosened to 1000 ms while warm keeps the strict 50 ms (best of three). No page markup changed, so there is no design or both-doors concern. Next, non-blocking: (1) add a wave to the fixture so lastWave equality is checked as a value, not only as absence; (2) the cold read is only held to 1000 ms, so say so in the pull, or warm the plan on write so the first request is fast too.
- Box 2 is only half met. The issue asks that the answer be unchanged, compared on a 10-limb fixture. The test compares
-
Checks
shipped production is serving it deploy e78d344
-
History
- Test compares the whole answer with the old path's, and loosens the cold timing bound (#6199) e371759
- Test builds the real user, not a cast 47050cd
- Try: GET /api/v1/repos/trevato/forge/milestones and read the Server-Timing header bd2122b
- GET /milestones reads the page's kept plan and names its stretches in Server-Timing (#6199) 9a207b8
- Crew runs can SSH to a device the repository names: an owner-granted host:22 plus a key from the repo's secrets (the arm's Pi) (#16673) 927e520
- small: every list page still printing a bare "No …" takes its reason and next step from src/web/empty_words.ts (#16705) e00ef3f
- Feature flags for apps: a flags file in the app template, values set from the app's settings, FORGE_FLAGS_URL and a one-file client (#16707) c4232ca
- Design: the front page's admin controls draw §5's row, bar and field, and front-admin/pick/pin-any/weights leave §5d (#16703) fbe2465
- Finished run logs archive to the BlobStore (#16710) d6e4708
- Observability 5: one great chart - real size, readable axes, nice ticks, palette, tooltips, synced crosshair, release marks (#16686) 8eb4dc9
- LFS door: batch API and locks on the BlobStore (#16708) e29b657
- Talk says plainly what a cloud machine bills (#16688) 456cda9
- Revert "The repo is durable in the bucket: each push's pack is written to the BlobStore before ack, refs stay in the database with CAS" (#16725) 2e80cb0
- Main's full check prints each step's seconds and share (#16720) 0bb2460
- Builder brief: run gate --explain before --fix, and say the both-doors rule (#16718) 05a2403
- Sampler: count sample times before the grouped row count (#16716) f719db4
- Main green again: the pull folds' empty review state uses the shared words; capture expects the error page (#16714) aa51435
- End-to-end test: anonymous, account, forge live, app included, health answers, each step named (#16704) 81ea93d
- Live triage's comment lookups use an issue index: 3.8 s → 11.5 ms per query (#16713) 53352fb
- Every answer that sends Last-Modified honours If-Modified-Since, or stops sending it (#16685) 32c6d9a
3 earlier comments
GET /api/v1/repos/:owner/:name/milestones now builds its answer from the same kept plan the milestones page uses, instead of rebuilding the plan on every request. In the new test, read stays under 50 ms on a 2,300-issue fixture, cold and warm. I didn't time it against the old code, so I can't say whether the new test would have failed before this change. The 1,365 ms figure on trevato/forge is not re-measured here.
- Which fix: the shared plan, not a batched read.
milestonesJsoninsrc/web/pages/milestones.tsnow callsplanFor, the cached plan the page already builds. It is also the function behind the MCPmilestonestool, so that tool gets the same speed-up. I didn't wait for #6182 or build a second plan. - Server-Timing:
readnow comes with its stretches listed before it:plan-graph,plan-crew,plan-week,plan-spend,plan-limbs,read-askandread-waves. Theplan-*stretches appear only on a cold plan. - Test of the answer:
test/api-milestones-speed.test.tsuses the 10-pillar fixture and checks the items against a fresh, uncachedreadPlanrun throughlimbJson. It checks that each limb's own fields (vialimbJson) match. It doesn't compare the ask-to-live or last-wave fields, which come from separate code that I didn't change. - Test of the speed: the same file seeds 2,000 closed and 300 open issues across the 10 pillars. It asserts
readunder 50 ms, cold and warm, and that the stretches are named. - One existing test changed:
test/api-milestones-timing.test.tsexpected exactlysession, read, render. It was right for the old route and wrong for this change, so it now ignores the new stretch names and checks thatread-askis present.
I ran the milestones tests and tsc --noEmit, and both pass. The gate output wasn't checked. The first push was refused by a pre-push hook that asks for a "Try:" commit, so I added an empty commit carrying it.
I didn't touch the MCP tool or the page.
To try it: curl -si .../api/v1/repos/trevato/forge/milestones | grep -i server-timing.
🤖 Generated with Claude Code
<!-- look-pages bd2122bb6c5a --> Look pages for bd2122b, from the gate:
look pages (inferred): this pull changes src/web/pages/milestones.ts; the forge pictures / (src/web/pages/milestones.ts), /docs (src/web/pages/milestones.ts), /explore (src/web/pages/milestones.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
GET /api/v1/repos/:owner/:name/milestones now builds its answer from the same kept plan the milestones page uses, instead of rebuilding the plan on every request. The 50 ms read bound is asserted only on the 2,300-issue fixture. I never timed the old code, so I can't say whether the new test would have failed before. The 1,365 ms from the issue is not re-measured.
I used the shared plan, not a batched read. milestonesJson in src/web/pages/milestones.ts now calls planFor, the cached plan the page already builds. The MCP milestones tool calls the same function, so it gets the same speed-up. I didn't wait for #6182 or build a second plan.
read now lists its stretches in Server-Timing: plan-graph, plan-crew, plan-week, plan-spend, plan-limbs, read-ask and read-waves. The plan-* ones appear only when the plan is built cold.
test/api-milestones-speed.test.ts has two tests, on a fixture of 10 pillars with 2,000 closed and 300 open issues:
- Same answer: each of the 10 limbs matches a fresh, uncached
readPlanrun throughlimbJson. It doesn't compare the ask-to-live or last-wave fields, which come from code I didn't change. - Under 50 ms:
readstays under 50 ms cold and warm, and the named stretches are present.
I also changed test/api-milestones-timing.test.ts. It expected exactly session, read, render, which was right for the old route. It now ignores the new stretch names and checks that read-ask appears.
The check's gate refused the first push for two reasons, both fixed:
as nevercast: the speed test cast its user. It now passes the real user record.- Both doors: the commit message now carries
No door:andNo look:lines. The edit changes only how the JSON route and the MCP tool read the plan, and the page and terminal show what they showed before.
I re-ran tsc --noEmit and the speed test locally and both pass. scripts/gate.ts --fix still shows the two refusals locally, because they read the commit message that was written afterwards. The 100-column comment note it also prints is not something I touched. I haven't seen the forge's check pass on this push yet.
To try it: curl -si .../api/v1/repos/trevato/forge/milestones | grep -i server-timing.
🤖 Generated with Claude Code
Both review points are fixed in test/api-milestones-speed.test.ts, and the file now passes. bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. I did not re-measure the 1,365 ms figure, and I could not check the real Server-Timing on trevato/forge, because the preview has no such repository.
- Answer unchanged (box 2): the test now builds the expected
itemsthe old way and compares them whole withtoEqual. That means a freshreadPlanplus the samepillarView/askToLiveForandlastWavescalls the route makes. SoaskToLiveandlastWaveare compared along with thelimbJsonfields, over the 10-limb, 2,300-issue fixture. The fixture has no waves, solastWaveis absent from every item; that equality is only checked as absence.askToLiveis asserted present on every item. - Flaky timing bound: the cold read still has to name the
plan-graph,read-askandread-wavesstretches. Its bound is now under 1000 ms, which still catches a return to the old 1.4 s without going red on a busy runner. The warm read keeps the strict 50 ms bound, taken as the best of three reads.
The gate also notes one comment line over 100 columns in src/web/pages/milestones.ts. I left it, since it asks for nothing and the nightly rewrap wraps it on main.
No page markup changed, so there is no review block.
GET /api/v1/repos/:owner/:name/milestonesnow builds its answer from the same kept plan the milestones page uses, instead of rebuilding the plan on every request. In the new test,readstays under 50 ms on a 2,300-issue fixture, cold and warm. I didn't time it against the old code, so I can't say whether the new test would have failed before this change. The 1,365 ms figure on trevato/forge is not re-measured here.milestonesJsoninsrc/web/pages/milestones.tsnow callsplanFor, the cached plan the page already builds. It is also the function behind the MCPmilestonestool, so that tool gets the same speed-up. I didn't wait for #6182 or build a second plan.readnow comes with its stretches listed before it:plan-graph,plan-crew,plan-week,plan-spend,plan-limbs,read-askandread-waves. Theplan-*stretches appear only on a cold plan.test/api-milestones-speed.test.tsuses the 10-pillar fixture and checks the items against a fresh, uncachedreadPlanrun throughlimbJson. It checks that each limb's own fields (vialimbJson) match. It doesn't compare the ask-to-live or last-wave fields, which come from separate code that I didn't change.readunder 50 ms, cold and warm, and that the stretches are named.test/api-milestones-timing.test.tsexpected exactlysession, read, render. It was right for the old route and wrong for this change, so it now ignores the new stretch names and checks thatread-askis present.I ran the milestones tests and
tsc --noEmit, and both pass. The gate output wasn't checked. The first push was refused by a pre-push hook that asks for a "Try:" commit, so I added an empty commit carrying it.I didn't touch the MCP tool or the page.
To try it:
curl -si .../api/v1/repos/trevato/forge/milestones | grep -i server-timing.🤖 Generated with Claude Code
Closes #6199