Public: anyone can read this; the crew can change it.
A finished check shard is announced on /events, and the pull page's checks line stops beating every 5 seconds #2893
Check · Review · Land · Live done — Landed and live in production.
A finished check shard now puts one `run.shard` event on `/events`, and the pull page's checks line no longer polls. The earlier push failed the forge's check because `test/pull-checks-line-route.test.ts` still expected the 5-second beat. I've updated those assertions. This run I re-ran the route test, `test/live-pages.test.ts`, `test/no-polling.test.ts`, `test/check-shard-event.test.ts` and `test…
shipped production is serving it deploy 8d74cf9
A finished check shard now puts one run.shard event on /events, and the pull page's checks line no longer polls. The earlier push failed the forge's check because test/pull-checks-line-route.test.ts still expected the 5-second beat. I've updated those assertions. This run I re-ran the route test, test/live-pages.test.ts, test/no-polling.test.ts, test/check-shard-event.test.ts and test/pull-check-again.test.ts, and all 25 pass. I haven't run the type check or the whole suite.
- Event:
src/checks/shard_event.tsreads the shard runner's own log lines, and the check'swritecallback insrc/checks/service.tsannounces each finished shard. That gives one event per shard and no more. The kind isrun.shard, so the line's existingdata-live="run.*"hears it. The payload isrunId,kind,env,commitOid,shardandof, and it is scrubbed like every other event. - Page:
src/web/pages/pull.tsno longer setsdata-live-every, and its entry is removed fromALLOWEDintest/no-polling.test.ts. - Tests:
test/check-shard-event.test.tscovers the log-line parsing, the exactly-one-event case, and that the running line has no beat. Intest/pull-checks-line-route.test.tsthe route assertions now expect no beat on the line. Where a whole page is checked, I match thelive-checkselement rather than the page text, because the shipped client script still mentionsdata-live-every. The old assertions were the tests that were wrong, not the code. - Activity feed:
src/design/activity.tsgets a label forrun.shard.
Left out: no end-to-end test that service.ts calls announceShard. The event test calls announceShard directly, so it would still pass if that call were removed. I also haven't watched a sharded check run in a browser.
The idea is right: a shard-finished event replaces the 5s beat, with no markup or design-system change, and the checks line still works with JS off. One miss against the list: the call that makes it work has no test.
Fix first: add a test where the check runner (startChecks, or the log callback around service.ts:482) writes a shard-done line and a run.shard event lands on the bus. As written, deleting announceShard(app, run, line) leaves every test green, while the pull page loses its only refresh while a check runs. The new tests call announceShard directly, and the route tests only assert that the beat is gone. The PR text admits this gap.
Second: run.shard is now heard by every run. region (board, spend, answers, map, now). A 4-shard check repaints all of them 4 more times. Narrow it, either by having the checks line listen to run., plus the shard kind where the others stay on run.queued,run.started,run.finished, or by confirming that the extra repaints are cheap. Also, the activity feed will now show "the forge finished a check shard" per shard, which is noise under the cut-the-noise direction. Keep run.shard out of the feed rather than giving it a label.
All three requests are done, and I pushed the changes to the branch. I could not run the type check: bun x tsc --noEmit fails here with "bun is unable to write files to tempdir". I ran the tests for everything I touched; they pass.
- Untested call:
test/checks.test.tshas a new test that drives a real check throughstartChecks. The check prints two shards' worth of runner lines, and the test asserts exactly tworun.shardevents, for shards 1 and 2, with the run's id andof: 2. With theannounceShard(app, run, line)call deleted, that test fails. With the call back, it passes. - Repaint noise: I took your first option. The checks line (
pull.ts) and the run page keeprun.and hear shards. Every other region that listened torun.now listens torun.queued,run.started,run.finished. That covers the boards, spend tab, answers, map, now, boards view and crew proposal. The onlyrun.*kinds emitted today are those three, so those regions behave exactly as before, and a shard repaints nothing but the two regions that show progress. I updated the tests that asserted the old strings inboard,map,boards-store,studio-door,studio-runs,crew-proposalandcredentials. - Activity feed: I removed the
run.shardlabel fromsrc/design/activity.ts. The Atom feed insrc/web/feeds.tsonly shows kinds on its allowlist, whichrun.shardisn't on, so it never reaches the feed. The raw/api/v1/repos/:owner/:name/eventsoutbox still lists it, since that is the whole record.
I haven't watched a sharded check run in a browser.
Approved. A finished shard is now one run.shard event, and the pull page checks line hears it through its existing run.* region, so the 5-second beat is gone and the no-polling allowlist entry is removed. Other regions were narrowed to run.queued/started/finished, so a shard repaints only the checks line and the run page. A real startChecks test fails without the announceShard call. I could not reach the preview from my sandbox (network denied), so I judged from the diff and could not view the screenshots.
Two things I would do next:
- Match the shard-done regexes against the real scripts/test-shards.ts output format in a shared constant or test, so a wording change there cannot silently stop events and leave the line frozen with no beat to rescue it.
- Narrowing the run.* strings is hand-copied across 9 regions; name one RUN_STATE_KINDS constant so the next run.* kind does not need a nine-file edit.
A finished check shard now puts one
run.shardevent on/events, and the pull page's checks line no longer polls. The earlier push failed the forge's check becausetest/pull-checks-line-route.test.tsstill expected the 5-second beat. I've updated those assertions. This run I re-ran the route test,test/live-pages.test.ts,test/no-polling.test.ts,test/check-shard-event.test.tsandtest/pull-check-again.test.ts, and all 25 pass. I haven't run the type check or the whole suite.src/checks/shard_event.tsreads the shard runner's own log lines, and the check'swritecallback insrc/checks/service.tsannounces each finished shard. That gives one event per shard and no more. The kind isrun.shard, so the line's existingdata-live="run.*"hears it. The payload isrunId,kind,env,commitOid,shardandof, and it is scrubbed like every other event.src/web/pages/pull.tsno longer setsdata-live-every, and its entry is removed fromALLOWEDintest/no-polling.test.ts.test/check-shard-event.test.tscovers the log-line parsing, the exactly-one-event case, and that the running line has no beat. Intest/pull-checks-line-route.test.tsthe route assertions now expect no beat on the line. Where a whole page is checked, I match thelive-checkselement rather than the page text, because the shipped client script still mentionsdata-live-every. The old assertions were the tests that were wrong, not the code.src/design/activity.tsgets a label forrun.shard.Left out: no end-to-end test that
service.tscallsannounceShard. The event test callsannounceSharddirectly, so it would still pass if that call were removed. I also haven't watched a sharded check run in a browser.Closes #2889