Public: anyone can read this; the crew can change it.

The pull page runs 117 statements, over its 116 budget #15954

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/15941-the-pull-page-runs-117-statements-over-i → main 0 commits fork

  • Merged. scout/15941-the-pull-page-runs-117-statements-over-i was merged into main as 48a173e.

Review

Sign in to review this change.
4 files changed +13 −7
src/flow/next_actor.ts +4 −2
@@ -7,7 +7,7 @@
77 import type { Database } from "bun:sqlite";
88 import { getHold } from "../core/holds.ts";
99 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";
1111 import { reviewSummary } from "../core/reviews.ts";
1212 import type { Repo } from "../core/repos.ts";
1313 import { reviewsOff } from "../crew/review.ts";
@@ -90,6 +90,8 @@ export function nextOfPull(
9090 live: { readonly headOid: string; readonly conflicts: number },
9191 /** The pull's repository; without one, reviews count as asked for. */
9292 repo: Pick<Repo, "id" | "requireReview"> | undefined,
93 /** The head's check, when the caller already read it: not read twice. */
94 known?: CheckSummary,
9395 ): Next | null {
9496 if (pull.state !== "open" || pull.mergedAt !== null) return null;
9597 const reviews = reviewSummary(db, pull.id, live.headOid);
@@ -98,7 +100,7 @@ export function nextOfPull(
98100 {
99101 held: hold === undefined ? null : { by: hold.heldByName, why: hold.why },
100102 conflicted: live.conflicts > 0,
101 check: checkSummary(db, pull.id, live.headOid).state,
103 check: (known ?? checkSummary(db, pull.id, live.headOid)).state,
102104 changesRequested: reviews.changesRequested,
103105 approvals: reviews.approvals,
104106 pushedSince: reviews.stale,
src/flow/waits_for.ts +4 −2
@@ -13,7 +13,7 @@ import { pullsByIssueIds, type Pull } from "../core/pulls.ts";
1313 import { canRead, getRepo, getReposByIds, type Repo } from "../core/repos.ts";
1414 import type { User } from "../core/users.ts";
1515 import { checkSummary, type CheckSummary } from "../core/runs.ts";
16 import { nextOfPull } from "./next_actor.ts";
16 import { nextOfPull, type Next } from "./next_actor.ts";
1717
1818 /**
1919 * 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(
2727 live: { readonly headOid: string; readonly conflicts: number },
2828 now: Date = new Date(),
2929 known?: CheckSummary,
30 /** The pull's `nextOfPull`, when the caller already read it: not read twice. */
31 next?: Next,
3032 ): WaitsFor | null {
3133 if (pull.state !== "open" || pull.mergedAt !== null) return null;
3234 const check = known ?? checkSummary(db, pull.id, live.headOid);
@@ -37,7 +39,7 @@ export function pullWaitsFor(
3739 return waitsFor(
3840 {
3941 greenAt,
40 next: nextOfPull(db, pull, live, repo),
42 next: next ?? nextOfPull(db, pull, live, repo),
4143 held: getHold(db, pull.id) !== undefined,
4244 conflicted: live.conflicts > 0,
4345 chapter: chapterHold(db, repo.id, pull),
src/web/studio/change.ts +4 −2
@@ -261,7 +261,9 @@ export function changeHead(
261261 // (async: it reads the head's tree when the child attested one, #13645).
262262 proposal: PullProposalAt | undefined,
263263 ): 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);
265267 const step =
266268 live === null && pull.mergedAt === null
267269 ? null
@@ -314,7 +316,7 @@ export function changeHead(
314316 live === null ? null : landingLine(ctx.app.db, pull, repo.id),
315317 (eta) => html`<p class="muted small" data-landing-eta>${eta.says}</p>`,
316318 )}${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),
318320 (w) => html`<p class="small" data-waits-for="${w.cause}" role="status">${w.line}</p>`,
319321 )}${
320322 // 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 };
5656 const HEAVIER: Record<string, { statements?: number; git?: number }> = {
5757 "/:owner/:name/issues/:number": { statements: 71 }, // +1: whether the repository is archived, so its pages say noindex (#14305)
5858 "/: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)
6060 "/api/v1/asks": { statements: 61 }, // +1: the stopped apps someone asked for, one read of the viewer's archived repositories (#12277)
6161 "/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
6262 "/settings/capacity": { statements: 70 },

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs