Public: anyone can read this; the crew can change it.
Main green again: the pull folds' empty review state uses the shared words; capture expects the error page #16714
Check · Review · Land · Live done — Landed and live in production.
main-red → main 0 commits
3 files
changed +22
−10
src/core/empty_words.ts +1
| @@ -58,6 +58,7 @@ const TABLE = { | ||
| 58 | 58 | commits: { sentence: "No commits yet.", reason: "Push a branch and its history shows up here." }, |
| 59 | 59 | issues: { sentence: "No issues yet." }, |
| 60 | 60 | pulls: { sentence: "No pulls yet." }, |
| 61 | reviews: { sentence: "No review yet." }, | |
| 61 | 62 | branches: { sentence: "No branches yet." }, |
| 62 | 63 | labels: { sentence: "No labels yet." }, |
| 63 | 64 | events: { sentence: "No events yet." }, |
src/web/studio/pull_folds.ts +2 −1
| @@ -5,6 +5,7 @@ | ||
| 5 | 5 | */ |
| 6 | 6 | import type { Commit } from "../../git/read.ts"; |
| 7 | 7 | import type { Review } from "../../core/reviews.ts"; |
| 8 | import { emptyLine } from "../empty_words.ts"; | |
| 8 | 9 | import { html, type Html } from "../html.ts"; |
| 9 | 10 | import { icon, row, rowList, sha, time } from "../ui.ts"; |
| 10 | 11 | |
| @@ -46,7 +47,7 @@ export function pullFolds(i: PullFolds): Html { | ||
| 46 | 47 | "Reviews", |
| 47 | 48 | reviewsSummary(i.reviews), |
| 48 | 49 | false, |
| 49 | i.reviewNodes.length === 0 ? html`<p class="muted small">No review yet.</p>` : html`<div class="timeline">${[...i.reviewNodes]}</div>`, | |
| 50 | i.reviewNodes.length === 0 ? emptyLine("reviews") : html`<div class="timeline">${[...i.reviewNodes]}</div>`, | |
| 50 | 51 | ); |
| 51 | 52 | const log = |
| 52 | 53 | i.log === undefined |
test/capture-chromium.looks.test.ts +19 −9
| @@ -28,32 +28,42 @@ describe.skipIf(chromium === undefined)("a real capture", () => { | ||
| 28 | 28 | test( |
| 29 | 29 | "a capture that ends on the browser's error page fails with its reason and writes no picture", |
| 30 | 30 | async () => { |
| 31 | // `/` bounces to the address the query names; anything else is a page. | |
| 31 | 32 | const page: ReturnType<typeof Bun.serve> = Bun.serve({ |
| 32 | 33 | port: 0, |
| 33 | 34 | hostname: "127.0.0.1", |
| 34 | // Off the app's host, on a name that resolves to loopback without DNS. | |
| 35 | fetch: (request): Response => | |
| 36 | new URL(request.url).pathname === "/" | |
| 35 | fetch: (request): Response => { | |
| 36 | const url = new URL(request.url); | |
| 37 | return url.pathname === "/" | |
| 37 | 38 | ? new Response(null, { |
| 38 | 39 | status: 302, |
| 39 | headers: { location: `http://localhost:${page.port}/landed` }, | |
| 40 | headers: { location: `http://${url.searchParams.get("to")}:${page.port}/landed` }, | |
| 40 | 41 | }) |
| 41 | 42 | : new Response("<!doctype html><p>elsewhere</p>", { |
| 42 | 43 | headers: { "content-type": "text/html" }, |
| 43 | }), | |
| 44 | }); | |
| 45 | }, | |
| 44 | 46 | }); |
| 45 | try { | |
| 46 | const out = join(dataDir, "refused.png"); | |
| 47 | const refused = async (from: string, to: string): Promise<string> => { | |
| 48 | const out = join(dataDir, `refused-${to}.png`); | |
| 47 | 49 | const taken = await takeLook({ |
| 48 | url: `http://127.0.0.1:${page.port}/`, | |
| 50 | url: `http://${from}:${page.port}/?to=${to}`, | |
| 49 | 51 | out, |
| 50 | 52 | width: 390, |
| 51 | 53 | height: 844, |
| 52 | 54 | timeoutMs: 30_000, |
| 53 | 55 | }); |
| 54 | expect(JSON.stringify(taken)).toContain("left the app's host for localhost"); | |
| 55 | 56 | // The guard throws before the screenshot: no picture was written. |
| 56 | 57 | expect(existsSync(out)).toBe(false); |
| 58 | return JSON.stringify(taken); | |
| 59 | }; | |
| 60 | try { | |
| 61 | // A bounce to any name but the app's resolves nowhere (#16687): the browser's error page. | |
| 62 | expect(await refused("127.0.0.1", "localhost")).toContain( | |
| 63 | "ERR_NAME_NOT_RESOLVED: the browser showed an error page instead of the app", | |
| 64 | ); | |
| 65 | // A bounce to an address that needs no name lands, on another host: the host check refuses it. | |
| 66 | expect(await refused("localhost", "127.0.0.1")).toContain("left the app's host for 127.0.0.1"); | |
| 57 | 67 | } finally { |
| 58 | 68 | page.stop(true); |
| 59 | 69 | } |
new above
offline