Public: anyone can read this; the crew can change it.
Asks read four rows per open pull, and home runs them twice #2780
Check · Review · Land · Live done — Landed and live in production.
Home now builds its ask candidates once per request, and the per-pull reads named in the issue are grouped. On the new test's seed, home's statement count stays flat as open pulls grow. Before the change it went from 101 to 143 statements between 4 and 16 open pulls.
shipped production is serving it deploy 9b150b4
Home now builds its ask candidates once per request, and the per-pull reads named in the issue are grouped. On the new test's seed, home's statement count stays flat as open pulls grow. Before the change it went from 101 to 143 statements between 4 and 16 open pulls.
What moved
- Grouped helpers (ids in,
Mapout, one query per chunk), each beside its singular read:
- activeRunsFor in src/core/runs.ts, beside activeRunFor.
- handoversOf in src/crew/guard.ts, beside handoverOf. It runs one grouped count of crew change requests. Only a pull with three or more rounds goes on to the rest of the hand-over check, which is now handoverSince and is shared with handoverOf.
askCandidatesFor(src/web/studio/asks.ts) uses both helpers instead of runningactiveRunForandhandoverOfonce per pull.- The app read:
getAppByReporan once per card indecisionButtons.decisionsForalready reads the apps for every candidate's repository (appsForRepos), so it now sets a newpreviewfield onDecision, anddecisionButtonsreads that field. - Asks read once: the feed under "Needs you" (
readFeedwithwithoutAsks) used to callaskLinesForand then drop every ask.candidatesFor(src/feed/items.ts) now takes awithAsksflag and skips the call. That leavesdecisionsForas home's only caller ofaskCandidatesFor.
Tests: test/asks-counts.test.ts checks four things:
- Home's statement count is the same for 4 open pulls as for 16. The seeded pulls are idle, crew-working, reviewed once, and on an autonomous repo.
- One
GET /runs each grouped read exactly once. - The grouped reads return the same results as the singular ones, including a pull that has been handed over.
- The preview link still appears once the repository becomes an app.
The first two fail on main. The type check passes, as do 39 related test files with 301 tests. Two tests in asks.test.ts ("a setting away from its default (#2029)") fail when run together with the other files, and fail the same way on main. They pass when asks.test.ts runs alone, so I did not change them.
Not done here: pulls that have a check result still cost about ten statements each. That covers the retry count on a failed check, the staleness and reviewer-wait checks on a green one, and the rest of the hand-over check, so the test seeds no such pulls. I opened #2781 for those. The repo row read the issue lists did not grow with pulls in what I measured.
To try it: bun test test/asks-counts.test.ts, or bun run bench/map-home.ts and compare the statement counts for GET / owner.
🤖 Generated with Claude Code
Approved. This is a read-path change with no new input, write or screen. The grouped queries match the singular ones (same crew-reviewer join, same threshold, same earliest-run order). The tests cover flat statement counts, one grouped read per request, parity with the singular reads, and the preview link. The terminal does the same work through the shared Decision data, so there is no tty gap. I could not open the preview or the screenshots from my sandbox (network and /data/looks denied), so this judges the source and tests only.
Next, in order: (1) #2781: pulls with a check result still cost about ten statements each, and that is the common case on a busy home, so do it soon. (2) The two asks.test.ts failures (#2029) that fail when run alongside other files on main as well are order-dependent state leaking between tests. Fix the leak rather than leave a flaky pair.
Home now builds its ask candidates once per request, and the per-pull reads named in the issue are grouped. On the new test's seed, home's statement count stays flat as open pulls grow. Before the change it went from 101 to 143 statements between 4 and 16 open pulls.
What moved
Mapout, one query per chunk), each beside its singular read:-
activeRunsForinsrc/core/runs.ts, besideactiveRunFor. -handoversOfinsrc/crew/guard.ts, besidehandoverOf. It runs one grouped count of crew change requests. Only a pull with three or more rounds goes on to the rest of the hand-over check, which is nowhandoverSinceand is shared withhandoverOf.askCandidatesFor(src/web/studio/asks.ts) uses both helpers instead of runningactiveRunForandhandoverOfonce per pull.getAppByReporan once per card indecisionButtons.decisionsForalready reads the apps for every candidate's repository (appsForRepos), so it now sets a newpreviewfield onDecision, anddecisionButtonsreads that field.readFeedwithwithoutAsks) used to callaskLinesForand then drop every ask.candidatesFor(src/feed/items.ts) now takes awithAsksflag and skips the call. That leavesdecisionsForas home's only caller ofaskCandidatesFor.Tests:
test/asks-counts.test.tschecks four things:GET /runs each grouped read exactly once.The first two fail on main. The type check passes, as do 39 related test files with 301 tests. Two tests in
asks.test.ts("a setting away from its default (#2029)") fail when run together with the other files, and fail the same way on main. They pass whenasks.test.tsruns alone, so I did not change them.Not done here: pulls that have a check result still cost about ten statements each. That covers the retry count on a failed check, the staleness and reviewer-wait checks on a green one, and the rest of the hand-over check, so the test seeds no such pulls. I opened #2781 for those. The
reporow read the issue lists did not grow with pulls in what I measured.To try it:
bun test test/asks-counts.test.ts, orbun run bench/map-home.tsand compare the statement counts forGET / owner.🤖 Generated with Claude Code
Closes #2772