Public: anyone can read this; the crew can change it.
The pull page runs 117 statements, over its 116 budget #15954
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/15941-the-pull-page-runs-117-statements-over-i → main 0 commits fork
4 files
changed +13
−7
src/flow/next_actor.ts +4 −2
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | import type { Database } from "bun:sqlite"; |
| 8 | 8 | import { getHold } from "../core/holds.ts"; |
| 9 | 9 | import type { Pull } from "../core/pulls.ts"; |
| 10 | import { checkSummary, type RunState } from "../core/runs.ts"; | |
| 10 | import { checkSummary, type CheckSummary, type RunState } from "../core/runs.ts"; | |
| 11 | 11 | import { reviewSummary } from "../core/reviews.ts"; |
| 12 | 12 | import type { Repo } from "../core/repos.ts"; |
| 13 | 13 | import { reviewsOff } from "../crew/review.ts"; |
| @@ -90,6 +90,8 @@ export function nextOfPull( | ||
| 90 | 90 | live: { readonly headOid: string; readonly conflicts: number }, |
| 91 | 91 | /** The pull's repository; without one, reviews count as asked for. */ |
| 92 | 92 | repo: Pick<Repo, "id" | "requireReview"> | undefined, |
| 93 | /** The head's check, when the caller already read it: not read twice. */ | |
| 94 | known?: CheckSummary, | |
| 93 | 95 | ): Next | null { |
| 94 | 96 | if (pull.state !== "open" || pull.mergedAt !== null) return null; |
| 95 | 97 | const reviews = reviewSummary(db, pull.id, live.headOid); |
| @@ -98,7 +100,7 @@ export function nextOfPull( | ||
| 98 | 100 | { |
| 99 | 101 | held: hold === undefined ? null : { by: hold.heldByName, why: hold.why }, |
| 100 | 102 | conflicted: live.conflicts > 0, |
| 101 | check: checkSummary(db, pull.id, live.headOid).state, | |
| 103 | check: (known ?? checkSummary(db, pull.id, live.headOid)).state, | |
| 102 | 104 | changesRequested: reviews.changesRequested, |
| 103 | 105 | approvals: reviews.approvals, |
| 104 | 106 | pushedSince: reviews.stale, |
src/flow/waits_for.ts +4 −2
| @@ -13,7 +13,7 @@ import { pullsByIssueIds, type Pull } from "../core/pulls.ts"; | ||
| 13 | 13 | import { canRead, getRepo, getReposByIds, type Repo } from "../core/repos.ts"; |
| 14 | 14 | import type { User } from "../core/users.ts"; |
| 15 | 15 | import { checkSummary, type CheckSummary } from "../core/runs.ts"; |
| 16 | import { nextOfPull } from "./next_actor.ts"; | |
| 16 | import { nextOfPull, type Next } from "./next_actor.ts"; | |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * The pull's line, or null when it is not a green open pull unlanded past `STALL_MS`. A list that |
| @@ -27,6 +27,8 @@ export function pullWaitsFor( | ||
| 27 | 27 | live: { readonly headOid: string; readonly conflicts: number }, |
| 28 | 28 | now: Date = new Date(), |
| 29 | 29 | known?: CheckSummary, |
| 30 | /** The pull's `nextOfPull`, when the caller already read it: not read twice. */ | |
| 31 | next?: Next, | |
| 30 | 32 | ): WaitsFor | null { |
| 31 | 33 | if (pull.state !== "open" || pull.mergedAt !== null) return null; |
| 32 | 34 | const check = known ?? checkSummary(db, pull.id, live.headOid); |
| @@ -37,7 +39,7 @@ export function pullWaitsFor( | ||
| 37 | 39 | return waitsFor( |
| 38 | 40 | { |
| 39 | 41 | greenAt, |
| 40 | next: nextOfPull(db, pull, live, repo), | |
| 42 | next: next ?? nextOfPull(db, pull, live, repo), | |
| 41 | 43 | held: getHold(db, pull.id) !== undefined, |
| 42 | 44 | conflicted: live.conflicts > 0, |
| 43 | 45 | chapter: chapterHold(db, repo.id, pull), |
src/web/studio/change.ts +4 −2
| @@ -261,7 +261,9 @@ export function changeHead( | ||
| 261 | 261 | // (async: it reads the head's tree when the child attested one, #13645). |
| 262 | 262 | proposal: PullProposalAt | undefined, |
| 263 | 263 | ): Html { |
| 264 | const next = live === null ? null : nextOfPull(ctx.app.db, pull, live, repo); | |
| 264 | // The head's check is read once for the next actor and for what a green pull waits for. | |
| 265 | const check = live === null ? undefined : checkSummary(ctx.app.db, pull.id, live.headOid); | |
| 266 | const next = live === null ? null : nextOfPull(ctx.app.db, pull, live, repo, check); | |
| 265 | 267 | const step = |
| 266 | 268 | live === null && pull.mergedAt === null |
| 267 | 269 | ? null |
| @@ -314,7 +316,7 @@ export function changeHead( | ||
| 314 | 316 | live === null ? null : landingLine(ctx.app.db, pull, repo.id), |
| 315 | 317 | (eta) => html`<p class="muted small" data-landing-eta>${eta.says}</p>`, |
| 316 | 318 | )}${when( |
| 317 | live === null ? null : pullWaitsFor(ctx.app.db, repo, pull, live), | |
| 319 | live === null ? null : pullWaitsFor(ctx.app.db, repo, pull, live, undefined, check, next ?? undefined), | |
| 318 | 320 | (w) => html`<p class="small" data-waits-for="${w.cause}" role="status">${w.line}</p>`, |
| 319 | 321 | )}${ |
| 320 | 322 | // The desk is the crew's: a guest sees no note, not even a hold on a public pull. |
test/pages-budget.test.ts +1 −1
| @@ -56,7 +56,7 @@ const DEFAULT = { statements: 60, git: 8 }; | ||
| 56 | 56 | const HEAVIER: Record<string, { statements?: number; git?: number }> = { |
| 57 | 57 | "/:owner/:name/issues/:number": { statements: 71 }, // +1: whether the repository is archived, so its pages say noindex (#14305) |
| 58 | 58 | "/:owner/:name/next": { statements: 72 }, // to lower: #15940; +2: the waiting offers and the decision check beside the reports (#15887); +1: the size limits of held issues, one read of both (#15845); +2: the waiting outsider reports, the decider check and the list (#15840); +1: whether the repository is archived (#14305); +1: the wallet row, one read of the monthly cap (#13529); +1: the growth line, one read for the week, the open counts and the planner pause (#12290, #12867) |
| 59 | "/:owner/:name/pulls/:number": { statements: 117 }, // to lower: #15941; +1: what a green pull waits for (#15812); +1: whether the reports door is closed, one primary-key read per request, never from memory (#15053); +1: whether the repository is archived (#14305); +1: the desk hold on the pull, one read of the notes that link it (#12536); +1: whether a repository is the forge's own copy, one read of the source setting for the tell box (#12037); +1: the paused sentence, one read of a queued paused run on the pull (#12010); +1: the header Talk count (#10327); +1: the landing line (#10860); +1: whether a reviewer is seated, read only when Require review is off and the pull would otherwise wait on one; the page loads no crew besides (#11666) | |
| 59 | "/:owner/:name/pulls/:number": { statements: 116 }, // +1: whether the reports door is closed, one primary-key read per request, never from memory (#15053); +1: whether the repository is archived (#14305); +1: the desk hold on the pull, one read of the notes that link it (#12536); +1: whether a repository is the forge's own copy, one read of the source setting for the tell box (#12037); +1: the paused sentence, one read of a queued paused run on the pull (#12010); +1: the header Talk count (#10327); +1: the landing line (#10860); +1: whether a reviewer is seated, read only when Require review is off and the pull would otherwise wait on one; the page loads no crew besides (#11666) | |
| 60 | 60 | "/api/v1/asks": { statements: 61 }, // +1: the stopped apps someone asked for, one read of the viewer's archived repositories (#12277) |
| 61 | 61 | "/board": { statements: 72 }, // +1: the forge-copy read for the tell box (#12037); +1: the vitals read the database's growth (#12025); +6: the money line (#510) — one settings read, then the month's and the 30 days' meter, storage and ledger reads; constant in the number of apps |
| 62 | 62 | "/settings/capacity": { statements: 70 }, |
new above
offline