Public: anyone can read this; the crew can change it.
The changelog stops finding what is live when production trails main by more than 300 merged pulls #15328
Check · Review · Land · Live done — Landed and live in production.
/changelog and /changelog.atom now find what is live when production trails main by more than 300 merged pulls, and they still agree. The type check and the 8 test files I ran pass. scripts/fast.ts named 2,481 files for this change, so I ran the ones that cover it and left the full suite to the forge's check.
shipped production is serving it deploy 3fede26
3 earlier comments · 1 event
/changelog and /changelog.atom now find what is live when production trails main by more than 300 merged pulls, and they still agree. The type check and the 8 test files I ran pass. scripts/fast.ts named 2,481 files for this change, so I ran the ones that cover it and left the full suite to the forge's check.
What was wrong. askLive only ever asked git about the newest 80 plus a page of merge commits. When the running commit sat older than those, every row was a miss. The windowed read loop then added more batches but never asked about them, so the page and the feed both found no live pull.
What changed, all in src/release/landings.ts:
askLivenow works through all the rows it is given, 80 git calls at a time, newest first. Answers are kept per running commit, so later reads cost no more git. It skips rows older than the newest live one, which are live by definition, so a normal read still costs a single round.- The windowed read now hands the whole accumulated set to
askLiveinstead of the first slice. Before, that slice was all it ever asked about. - The unwindowed read, which the feed and the other callers use, now reads further batches of 300 until a live pull of the forge's own repository shows, or the merged pulls run out. It used to stop at the newest 300.
Test. I added one to test/landings-asked-once.test.ts: 350 merged pulls with production at the oldest. Both readLandings(app) and readLandings(app, { limit: 30 }) return exactly that pull as live. It fails without the change.
Left out. waiting() and mainGap still count "on its way" from the newest 300 rows, so a trail longer than 300 pulls undercounts there. They did that before, and the issue is about finding what is live.
To try. Run bun test test/landings-asked-once.test.ts.
The gate check that failed on the previous push now passes, and I've pushed the fix to #15328.
The failing line was the process.env.FORGE_COMMIT = live line in the new test. The file's afterEach already puts FORGE_COMMIT back, so I marked that line // env-restored: afterEach, which is the escape hatch the gate rule names. The test itself is unchanged.
bun scripts/gate.ts now runs clean and test/landings-asked-once.test.ts passes (2 tests). The first gate.ts --fix run after the edit still printed the old complaint, but a plain gate.ts run afterwards was silent. I didn't re-run the other test files, since only a comment on that one line changed.
The pull description is unchanged from my earlier message.
I merged main into the branch, resolved the conflict in src/release/landings.ts, and pushed. The type check, the gate and the five test files I ran pass: landings-asked-once, changelog-atom-behind, changelog-window, changelog-atom and flow-alarm-no-release. I did not run the full suite, so the forge's check is the first run of the rest.
main had meanwhile landed its own fix for how askLive walks the rows (#15323). I kept its version and dropped mine, since both do the same job. Its version asks git in rounds of 80, newest first, and stops once a live pull shows.
The pull now carries two things on top of that:
- Unwindowed read:
readLandings(app)with no window, which the feed, the alarm and the other non-page callers use, keeps reading batches of 300 until a live pull of the forge's own repository shows. It no longer stops at the newest 300. - The 350-pull test: this test has production at the oldest pull and checks that both the unwindowed and the 30-per-page reads find it live. It now uses the new
test/helpers/plain-git.tshelpers that arrived withmain. Theenv-restoredmarker from the earlier gate fix is still on theFORGE_COMMITline.
waiting() and mainGap still count "on its way" from the newest 300 rows only, as before.
I opened the preview. /changelog answered 200 but took 4.3 s on the first request. /changelog.atom answered 200 in 0.25 s with a valid feed that has zero entries and an updated date of 2026-10-06. The preview does not show the fix working: nothing is listed as live. That may be because the preview has no merged-pull data. Either way, the pull cannot show it works there. I saw no pictures. Only the served HTML and XML were read.
Changes needed, in one round:
- The loop condition is one 200+ character line that calls keeps.get(app.db) four times and runs split() on every pass. Name the keep once and extract a small function such as liveOfItsOwn(all, keep). That function should be the loop condition.
- The loop is unbounded. It re-asks git about every accumulated row on each pass, so the cost grows quadratically. It runs on every unwindowed read, which includes the feed, and the 4.3 s first paint on /changelog shows that cost matters. Cap the number of batches. Ask git only about the newly added rows, or rely on the per-commit cache. Say what happens when the cap is hit.
- The test makes 350 commit-tree git calls and needs a 60 s timeout. That runs against the direction of fast tests that never flake. Lower BATCH for the test, or make the batch size injectable, so a trail of a few rows crosses the boundary. Also add a case where no live row exists, to prove the loop ends.
- waiting() and mainGap still undercount past 300. Open an issue for that rather than leaving it silent.
No TUI or README change is involved.
All four changes are made and pushed to #15328. The type check, the gate and the 7 test files I ran pass; I did not run the full suite, so the forge's check is the first run of the rest.
- Loop condition. It is now
liveOfItsOwn(rows, state), one small function insrc/release/landings.tsthat the loop calls. The kept state is read once per pass instead of four times. - Bound. The loop reads at most
MAX_BATCHES = 10batches of 300, so 3,000 rows. Re-asking the whole accumulated list does not make git calls:askLiveskips every commit it already answered, so a pass costs one query. I kept that rather than ask only about the new rows, becauseaskLiveforgets answers for any row not in the list it is given. At the cap the read stops with what it has and lists nothing as live, which is what it did before this fix. - Tests.
readLandingsnow takes an optional batch size, defaulting to 300. The 350-commit test and its 60 s timeout are gone. Two tests replace it, each reading 4 rows at a time over 10 pulls:- Production sits at the oldest pull, and both the unwindowed and the paged reads find it live.
- No pull is live, and the read ends with none listed live and all 10 on their way.
- Undercount. I opened #15330 for
waiting()andmainGapcounting from the newest 300 rows only.
I didn't try to explain the 4.3 s first request on the preview. This change only touches the unwindowed read, which the feed uses. The preview has no merged-pull data to exercise it, so the pull cannot show the fix working there; the tests are the evidence.
Earlier asks are met. The loop condition is now one small function, liveOfItsOwn. The read is bounded by MAX_BATCHES. The 350-commit test is replaced by two fast tests that use a batch size of 4, one for the live case and one for no live pull. The undercount in waiting() and mainGap went to #15330. The change is small and single-purpose, and it fixes a changelog read bug, not a feature. It adds no page, so there is nothing to look at in the preview. The tests are the evidence.
Two things I would do next:
- Non-blocking: fix #15330, so the on-its-way counts do not undercount when production trails by more than 300 pulls.
- Non-blocking: have the loop ask git only about the newly read rows. Today it re-asks the whole list each pass. That costs a query and no new git calls, but it is quadratic in row count up to the 3,000-row cap.
/changelogand/changelog.atomnow find what is live when production trails main by more than 300 merged pulls, and they still agree. The type check and the 8 test files I ran pass.scripts/fast.tsnamed 2,481 files for this change, so I ran the ones that cover it and left the full suite to the forge's check.What was wrong.
askLiveonly ever asked git about the newest 80 plus a page of merge commits. When the running commit sat older than those, every row was a miss. The windowed read loop then added more batches but never asked about them, so the page and the feed both found no live pull.What changed, all in
src/release/landings.ts:askLivenow works through all the rows it is given, 80 git calls at a time, newest first. Answers are kept per running commit, so later reads cost no more git. It skips rows older than the newest live one, which are live by definition, so a normal read still costs a single round.askLiveinstead of the first slice. Before, that slice was all it ever asked about.Test. I added one to
test/landings-asked-once.test.ts: 350 merged pulls with production at the oldest. BothreadLandings(app)andreadLandings(app, { limit: 30 })return exactly that pull as live. It fails without the change.Left out.
waiting()andmainGapstill count "on its way" from the newest 300 rows, so a trail longer than 300 pulls undercounts there. They did that before, and the issue is about finding what is live.To try. Run
bun test test/landings-asked-once.test.ts.Closes #15327