Public: anyone can read this; the crew can change it.
Calm pass: a pull reads as verdict, change and evidence #10467
mason/forge:mason/10300-calm-pass-a-pull-reads-as-verdict-change → main 8 commits fork 4 threads · 4 unresolved
7 files
changed +143
−13
docs/design/areas/pull.md +4
| @@ -19,3 +19,7 @@ The pull page's cards (merge box, review, commits, slices, run-this-code) are `. | ||
| 19 | 19 | ## The conflict resolver (#9713) |
| 20 | 20 | |
| 21 | 21 | `/:owner/:name/pulls/:number/resolve`: each conflict block, the crew proposal and the empty states are a `<section>` with an `<h2>` over rows (no `card`), on the one background. The two sides lose their hairline box; the taps keep theirs (a control). The ours/theirs/both/Mine taps, the text box and `#crew-proposal` are unchanged. No new class; `test/conflicts.test.ts` holds it. |
| 22 | ||
| 23 | ## Evidence in place (#10300) | |
| 24 | ||
| 25 | The change page's checks line sits in `<details id="evidence">` under the check word: shut when the check passed or has not run, open when it is queued, running or failed, so a red check is never hidden. No new class. `test/pull-evidence.test.ts` holds it. |
docs/design/attention-budget.json +4 −4
| @@ -37,13 +37,13 @@ | ||
| 37 | 37 | }, |
| 38 | 38 | "pull": { |
| 39 | 39 | "390": { |
| 40 | "words": 133, | |
| 41 | "blocks": 22, | |
| 40 | "words": 128, | |
| 41 | "blocks": 21, | |
| 42 | 42 | "colours": 4 |
| 43 | 43 | }, |
| 44 | 44 | "1280": { |
| 45 | "words": 133, | |
| 46 | "blocks": 22, | |
| 45 | "words": 128, | |
| 46 | "blocks": 21, | |
| 47 | 47 | "colours": 4 |
| 48 | 48 | } |
| 49 | 49 | }, |
docs/features/attention.md +5 −1
| @@ -24,7 +24,7 @@ reader sees on first view at 390 px and 1280 px: **words**, **text blocks** and | ||
| 24 | 24 | | home | 95 / 20 / 2 | 95 / 20 / 2 | |
| 25 | 25 | | repository | 116 / 18 / 2 | 116 / 18 / 2 | |
| 26 | 26 | | app | 116 / 18 / 2 | 116 / 18 / 2 | |
| 27 | | pull | 133 / 22 / 4 | 133 / 22 / 4 | | |
| 27 | | pull | 128 / 21 / 4 | 128 / 21 / 4 | | |
| 28 | 28 | | issue | 72 / 19 / 2 | 72 / 19 / 2 | |
| 29 | 29 | | issues list | 30 / 7 / 2 | 30 / 7 / 2 | |
| 30 | 30 | | pulls list | 24 / 6 / 1 | 24 / 6 / 1 | |
| @@ -35,3 +35,7 @@ reader sees on first view at 390 px and 1280 px: **words**, **text blocks** and | ||
| 35 | 35 | ## App page, calmed (#10299) |
| 36 | 36 | |
| 37 | 37 | A new app that has not run, and has shipped nothing, shows only its progress: the state line (`docs/features/onboarding-line.md`), the box to tell the crew, and Now (`src/web/studio/fresh.ts` judges it). Past that, the empty This week and Crew cards are gone, and the page's second link row (Map, Issues, Pull requests) is gone because the head's tabs already hold them. Before, on the seeded new app: 197 words / 29 blocks (over its 189 / 28 budget on main); after: 116 / 18. |
| 38 | ||
| 39 | ## Pull page, calmed (#10300) | |
| 40 | ||
| 41 | The change page reads verdict, then change, then evidence. The verdict is the path line, the check word and the decision; the checks line is evidence, in `<details id="evidence">` that is shut while the check has passed or never run and open while it is queued, running or red. On the seeded pull: 133 / 22 words and blocks before, 128 / 21 after, the summary naming the check state. Colours are unchanged (4). |
scripts/unreached-allow.json −1
| @@ -15,7 +15,6 @@ | ||
| 15 | 15 | "src/flow/review_rounds.ts", |
| 16 | 16 | "src/flow/shared_red.ts", |
| 17 | 17 | "src/flow/stale_fold.ts", |
| 18 | "src/kernel/why_now.ts", | |
| 19 | 18 | "src/spawn/pod.ts", |
| 20 | 19 | "src/tui/gallery.ts", |
| 21 | 20 | "src/tui/ui/qr.ts", |
src/web/studio/change.ts +28 −5
| @@ -342,6 +342,16 @@ export async function pullPage(ctx: Ctx): Promise<Response> { | ||
| 342 | 342 | * disagree. Bounded the way the page is: `pullWord` and one `pullStatus`, no |
| 343 | 343 | * diff, no query per comment. |
| 344 | 344 | */ |
| 345 | /** What the evidence summary says about the latest check. */ | |
| 346 | const CHECK_STATE_WORD: Record<string, string> = { | |
| 347 | none: "none yet", | |
| 348 | queued: "queued", | |
| 349 | running: "running", | |
| 350 | ok: "passed", | |
| 351 | failed: "failed", | |
| 352 | cancelled: "cancelled", | |
| 353 | }; | |
| 354 | ||
| 345 | 355 | async function pullPanels(ctx: Ctx, repo: Repo, pull: Pull, spent: Spent = newSpent()) { |
| 346 | 356 | const record: AppRecord | undefined = getAppByRepo(ctx.app.db, repo.id); |
| 347 | 357 | const db = ctx.app.db; |
| @@ -391,10 +401,13 @@ async function pullPanels(ctx: Ctx, repo: Repo, pull: Pull, spent: Spent = newSp | ||
| 391 | 401 | // after, it is production's — the preview's run may already be torn |
| 392 | 402 | // down, and the word above is judged by production regardless. |
| 393 | 403 | let deploy: { id: string; commitOid: string } | undefined; |
| 404 | // Read once: the deploy link above and the evidence disclosure below both | |
| 405 | // come from this value, so they cannot disagree. | |
| 406 | const checkNow = await lap(spent, "checks", async () => | |
| 407 | checkSummary(db, pull.id, pull.headOid), | |
| 408 | ); | |
| 394 | 409 | if (pull.mergedAt === null) { |
| 395 | const run = (await lap(spent, "checks", async () => | |
| 396 | checkSummary(db, pull.id, pull.headOid), | |
| 397 | )).run; | |
| 410 | const run = checkNow.run; | |
| 398 | 411 | if (run) deploy = { id: run.id, commitOid: run.commitOid }; |
| 399 | 412 | } else { |
| 400 | 413 | const production = |
| @@ -442,6 +455,7 @@ async function pullPanels(ctx: Ctx, repo: Repo, pull: Pull, spent: Spent = newSp | ||
| 442 | 455 | conflicted, |
| 443 | 456 | note, |
| 444 | 457 | checkLine, |
| 458 | checkNow, | |
| 445 | 459 | preview, |
| 446 | 460 | }; |
| 447 | 461 | } |
| @@ -483,7 +497,7 @@ async function changeConversation( | ||
| 483 | 497 | const began = performance.now(); |
| 484 | 498 | const spent = newSpent(); |
| 485 | 499 | notePhase(request, "session", takeSessionTime(request)); |
| 486 | const { record, db, base, thread, wordCtx, word, status, conflicted, note, checkLine, preview } = | |
| 500 | const { record, db, base, thread, wordCtx, word, status, conflicted, note, checkLine, checkNow, preview } = | |
| 487 | 501 | await pullPanels(ctx, repo, pull, spent); |
| 488 | 502 | // The check's own line, live, with a running check's counts: the one the |
| 489 | 503 | // Files step draws (`pullChecksLineFor`), for an open change. |
| @@ -730,6 +744,15 @@ async function changeConversation( | ||
| 730 | 744 | spent.reviews += performance.now() - reviewsAt; |
| 731 | 745 | |
| 732 | 746 | // From here on nothing is read: `render` only builds the page. |
| 747 | // The check is evidence behind the verdict word above it: shut while it | |
| 748 | // is quiet or passed, open when it is running, queued or has failed. | |
| 749 | const evidence = when( | |
| 750 | runLine, | |
| 751 | (l) => html`<details class="mt mb" id="evidence" ${checkNow.state === "ok" || checkNow.state === "none" ? null : raw("open")}> | |
| 752 | <summary class="muted small">Checks: ${CHECK_STATE_WORD[checkNow.state] ?? checkNow.state}</summary> | |
| 753 | ${l} | |
| 754 | </details>`, | |
| 755 | ); | |
| 733 | 756 | const body = html`${pageHead.top} |
| 734 | 757 | ${when(siblings.length > 0, () => |
| 735 | 758 | html`<p class="muted small variant-link"> |
| @@ -739,7 +762,7 @@ async function changeConversation( | ||
| 739 | 762 | </p>`, |
| 740 | 763 | )} |
| 741 | 764 | <div id="pull-check">${checkLine}</div> |
| 742 | ${when(runLine, (l) => l)} ${gate} ${decisionSection} | |
| 765 | ${evidence} ${gate} ${decisionSection} | |
| 743 | 766 | ${when(visionPreview, (v) => visionPreviewCard(v))} |
| 744 | 767 | ${look} |
| 745 | 768 | <div class="split"> |
test/pull-evidence.test.ts added +100
| @@ -0,0 +1,100 @@ | ||
| 1 | /** | |
| 2 | * The change page reads verdict, change, evidence (#10300): the checks line | |
| 3 | * is in <details id="evidence">, shut while the check passed or never ran, | |
| 4 | * open while it is queued, running or failed. | |
| 5 | */ | |
| 6 | import { afterAll, beforeAll, expect, test } from "bun:test"; | |
| 7 | import { mkdtempSync, rmSync } from "node:fs"; | |
| 8 | import { tmpdir } from "node:os"; | |
| 9 | import { join } from "node:path"; | |
| 10 | import { openPull } from "../src/actions/pulls.ts"; | |
| 11 | import { commitToBranch, createRepo } from "../src/actions/repos.ts"; | |
| 12 | import { createApp, type App } from "../src/app.ts"; | |
| 13 | import { createUser } from "../src/core/users.ts"; | |
| 14 | import { claimRun, createRun, finishRun } from "../src/core/runs.ts"; | |
| 15 | import { serve, type Servers } from "../src/http/server.ts"; | |
| 16 | import { proveAll } from "./helpers/verified.ts"; | |
| 17 | import { quietLogs } from "./helpers/globals.ts"; | |
| 18 | ||
| 19 | quietLogs(); | |
| 20 | ||
| 21 | let root = ""; | |
| 22 | let app: App; | |
| 23 | let servers: Servers; | |
| 24 | let cookie = ""; | |
| 25 | let url = ""; | |
| 26 | let repoId = ""; | |
| 27 | let head = ""; | |
| 28 | let pullId = ""; | |
| 29 | ||
| 30 | const page = async (): Promise<string> => | |
| 31 | (await fetch(`${servers.url}${url}`, { headers: { cookie } })).text(); | |
| 32 | const OPEN = /\sopen(\s|>)/; | |
| 33 | const evidence = (html: string): string => /<details[^>]*id="evidence"[^>]*>/.exec(html)?.[0] ?? ""; | |
| 34 | ||
| 35 | beforeAll(async () => { | |
| 36 | root = mkdtempSync(join(tmpdir(), "forge-evidence-")); | |
| 37 | app = createApp({ dataDir: root, port: 0, forgeRepo: "alice/forge" }); | |
| 38 | const u = await createUser(app.db, { | |
| 39 | origin: "seed", trusted: true, username: "alice", email: "[email protected]", | |
| 40 | password: "a-good-passphrase", adminIfFirst: true, | |
| 41 | }); | |
| 42 | if (!u.ok) throw new Error(u.error); | |
| 43 | proveAll(app); | |
| 44 | const made = await createRepo(app, { id: u.value.id, username: "alice" } as never, { name: "vault" }); | |
| 45 | if (!made.ok) throw new Error(String(made.error)); | |
| 46 | for (const [branch, path] of [["main", "README.md"], ["feature/x", "x.ts"]] as const) { | |
| 47 | const c = await commitToBranch(app, u.value, made.value, { | |
| 48 | message: "Start", branch, files: [{ path, content: "v\n" }], | |
| 49 | } as never); | |
| 50 | if (!c.ok) throw new Error(JSON.stringify(c.error)); | |
| 51 | } | |
| 52 | const pull = await openPull(app, u.value, made.value, { title: "Add x", baseBranch: "main", headBranch: "feature/x" }); | |
| 53 | if (!pull.ok) throw new Error(String(pull.error)); | |
| 54 | repoId = made.value.id; | |
| 55 | url = `/alice/vault/pulls/${pull.value.number}`; | |
| 56 | head = (app.db.query("SELECT head_oid FROM pull WHERE issue_id = ?1").get(pull.value.id) as { head_oid: string }).head_oid; | |
| 57 | servers = await serve(app); | |
outdated
globalThis for the pull id is a hack; use a module variable (item 4). |
||
| 58 | const signin = await fetch(`${servers.url}/signin`, { | |
| 59 | method: "POST", headers: { origin: servers.url }, | |
| 60 | body: new URLSearchParams({ username: "alice", password: "a-good-passphrase" }), redirect: "manual", | |
| 61 | }); | |
| 62 | cookie = (signin.headers.get("set-cookie") ?? "").split(";")[0]!; | |
| 63 | pullId = pull.value.id; | |
| 64 | }); | |
| 65 | afterAll(() => { | |
| 66 | servers.stop(); | |
| 67 | app.close(); | |
| 68 | rmSync(root, { recursive: true, force: true }); | |
| 69 | }); | |
| 70 | ||
| 71 | test("a check that never ran is evidence, shut", async () => { | |
| 72 | const tag = evidence(await page()); | |
| 73 | expect(tag).toContain('id="evidence"'); | |
| 74 | expect(tag).not.toMatch(/\sopen[\s>=]/); | |
| 75 | }); | |
| 76 | ||
| 77 | test("the shut state carries no checks text outside the summary, for no JS", async () => { | |
| 78 | const html = await page(); | |
| 79 | const body = /<details[^>]*id="evidence"[^>]*>([\s\S]*?)<\/details>/.exec(html); | |
| 80 | expect(body).not.toBeNull(); | |
| 81 | // Nothing of the check line sits in the page outside the disclosure. | |
| 82 | expect(html.replace(body![0], "")).not.toContain("Checks:"); | |
| 83 | expect(body![1]).toContain("Checks: none yet"); | |
| 84 | }); | |
| 85 | ||
| 86 | test("a running check opens the evidence; a failed one keeps it open; a passed one shuts it", async () => { | |
| 87 | const issueId = pullId; | |
| 88 | const run = createRun(app.db, { repoId, kind: "check", issueId, env: "pull", commitOid: head, reason: "push" }); | |
| 89 | expect(evidence(await page())).toMatch(OPEN); | |
| 90 | claimRun(app.db, run.id); | |
| 91 | expect(evidence(await page())).toMatch(OPEN); | |
| 92 | finishRun(app.db, run.id, { state: "failed", summary: "red" }); | |
| 93 | expect(evidence(await page())).toMatch(OPEN); | |
| 94 | const green = createRun(app.db, { repoId, kind: "check", issueId, env: "pull", commitOid: head, reason: "push" }); | |
| 95 | claimRun(app.db, green.id); | |
| 96 | finishRun(app.db, green.id, { state: "ok", summary: "green" }); | |
| 97 | const tag = evidence(await page()); | |
| 98 | expect(tag).not.toMatch(OPEN); | |
| 99 | expect(await page()).toContain("Checks: passed"); | |
| 100 | }); |
test/pull-quiet.test.ts +2 −2
| @@ -66,8 +66,8 @@ afterAll(async () => { | ||
| 66 | 66 | const get = async (path: string) => (await fetch(`${servers.url}${path}`, { headers: { cookie } })).text(); |
| 67 | 67 | const bytes = (t: string) => new TextEncoder().encode(t).length; |
| 68 | 68 | |
| 69 | // Measured 31,084 (pull) and 25,064 (list) with the Displays entry in the account menu and palette. Each budget is that plus ~160 B, the spread the port digits and times in the page showed, so it holds the page from growing and is not a tighter squeeze. | |
| 70 | const BUDGET = { pull: 31_250, list: 25_230 }; | |
| 69 | // Measured 31,194 (pull; 31,084 before the check became an evidence disclosure) and 25,064 (list) with the Displays entry in the account menu and palette. Each budget is that plus ~160 B, the spread the port digits and times in the page showed, so it holds the page from growing and is not a tighter squeeze. | |
| 70 | const BUDGET = { pull: 31_360, list: 25_230 }; | |
| 71 | 71 | |
| 72 | 72 | test("the pull page's check is a line with a dot and its word, not a card around a badge", async () => { |
| 73 | 73 | const text = await get(`/alice/r/pulls/${number}`); |
new above
offline
Unrelated to the pull; remove with the why_now deletion (item 1).