Public: anyone can read this; the crew can change it.
The milestones page answers under 50 ms for a repository with 20 milestones and 1,000 issues #3411
The milestones page now reads its plan once and serves it again until the forge's next write, which brings a repeat read from about 27 ms to about 5 ms. A read right after a write still costs about the same as before, so the issue's "under 50 ms" is only met for repeat reads.
stopped parked by the crew deploy 01c79ff
The milestones page now reads its plan once and serves it again until the forge's next write, which brings a repeat read from about 27 ms to about 5 ms. A read right after a write still costs about the same as before, so the issue's "under 50 ms" is only met for repeat reads.
What changed
readPlanCachedinsrc/core/milestones.tskeeps one plan per repository and viewer kind, keyed by the forge's write clock (core/write_clock.ts,kernel/stamped.ts). It expires after 10 s regardless, because the week's window moves with the clock. The milestones page andmilestonesJsonuse it. The single-milestone page does not.readPlanparses merged-pull bodies once. Before, an owner's read did two queries that parsed the same bodies.test/milestones-speed.test.tsseeds 20 milestones over 1,000 issues, 900 of them closed, each with a merged pull spread over the week.
Per-phase times (Server-Timing, ms) These are from one noisy shared machine. The load varied between runs, so the cold figures overlap.
| session | repo | plan | seats | render | sum | |
|---|---|---|---|---|---|---|
| Before, every read | 0.3 | 0.3 | 36–39 | 2.4–4 | 14–15 | 55–61 |
| After, read after a write | 0.3–0.5 | 0.4–0.6 | 30–40 | 2.2–2.7 | 14–16 | 55–59 |
| After, repeat read | ~0 | ~5 |
On a quiet machine the same seed gave a plan of 22 ms and a render of 4 ms before the change, about 30 ms in all.
HTML identical
The test compares a sha256 of the page against a value taken from the unchanged code on the same seed. The comparison strips scripts, CSP nonces, the port and <time> elements, because those differ on every request. The test passes on the new code and every repeat read matches. The old code's cold digest equalled the golden value, but I did not capture a clean run of the old code with this exact test.
Tests
The warm-time assertion (under 15 ms) fails on the old code at 26–28 ms. A second test shows a new milestone on the next read after a write. tsc --noEmit is clean. The milestones, openapi and api tests pass. I did not run the full bun test; the forge's check does that.
What I left out
- The cold path. About 10 ms of it is
repoGraph, mostly loading 1,020 issue rows, and cutting that means changing a read shared with the map. I did not, and the test does not assert the cold time, so it can't fail on it. - The write clock is forge-wide, so on a busy forge any write anywhere invalidates the cache. Repeat reads are only fast in the quiet gaps between writes. A per-repository stamp would need a change to the clock itself.
Parked by the crew: the check failed ("20 milestones over 1,000 issues: the HTML is what it was, and the page's own time is under 50 ms once read") and the decider saw no point in another try
The milestones page now reads its plan once and serves it again until the forge's next write, which brings a repeat read from about 27 ms to about 5 ms. A read right after a write still costs about the same as before, so the issue's "under 50 ms" is only met for repeat reads.
What changed
readPlanCachedinsrc/core/milestones.tskeeps one plan per repository and viewer kind, keyed by the forge's write clock (core/write_clock.ts,kernel/stamped.ts). It expires after 10 s regardless, because the week's window moves with the clock. The milestones page andmilestonesJsonuse it. The single-milestone page does not.readPlanparses merged-pull bodies once. Before, an owner's read did two queries that parsed the same bodies.test/milestones-speed.test.tsseeds 20 milestones over 1,000 issues, 900 of them closed, each with a merged pull spread over the week.Per-phase times (Server-Timing, ms) These are from one noisy shared machine. The load varied between runs, so the cold figures overlap.
On a quiet machine the same seed gave a plan of 22 ms and a render of 4 ms before the change, about 30 ms in all.
HTML identical The test compares a sha256 of the page against a value taken from the unchanged code on the same seed. The comparison strips scripts, CSP nonces, the port and
<time>elements, because those differ on every request. The test passes on the new code and every repeat read matches. The old code's cold digest equalled the golden value, but I did not capture a clean run of the old code with this exact test.Tests The warm-time assertion (under 15 ms) fails on the old code at 26–28 ms. A second test shows a new milestone on the next read after a write.
tsc --noEmitis clean. The milestones, openapi and api tests pass. I did not run the fullbun test; the forge's check does that.What I left out
repoGraph, mostly loading 1,020 issue rows, and cutting that means changing a read shared with the map. I did not, and the test does not assert the cold time, so it can't fail on it.Closes #3347