Public: anyone can read this; the crew can change it.
A wave's page lists its pulls in the order they landed, each with its one-line outcome and a link to the pull #15674
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/15659-a-wave-s-page-lists-its-pulls-in-the-ord → main 0 commits fork 4 threads · 4 unresolved
8 files
changed +159
−27
docs/features/wave-pulls-order.md +10 −5
| @@ -1,12 +1,17 @@ | ||
| 1 | 1 | --- |
| 2 | 2 | topic: Tell the crew |
| 3 | row: Reading a wave's pulls, newest landed first, with who merged each | |
| 3 | row: Reading a wave's pulls, oldest landed first, capped at 50, with who merged each | |
| 4 | 4 | --- |
| 5 | # A wave's pulls, newest landed first | |
| 5 | # A wave's pulls, oldest landed first | |
| 6 | 6 | |
| 7 | Open a wave, e.g. `/trevato/forge/waves/<version>`, and read its **Pulls** newest landed first. Each landed pull says who merged it: `merged by ada 2026-01-02`. | |
| 7 | Open a wave, e.g. `/trevato/forge/waves/<version>`, and read its **Pulls** oldest landed first. Each landed pull says who merged it: `merged by ada` and when, in words. | |
| 8 | 8 | |
| 9 | 9 | - Pulls not yet landed follow, in the order the wave names them. |
| 10 | - The terminal's wave screen shows the same order and the same `merged by` words; the API carries `mergedBy` on each pull. | |
| 10 | - Past 50 pulls the list stops and says `and N more`. | |
| 11 | - The terminal's wave screen shows the same order, cap and `merged by` words; the API carries `mergedBy` on each pull. | |
| 11 | 12 | |
| 12 | Both doors order with `inLandingOrder` in `src/story/wave_pulls.ts`, so they agree. | |
| 13 | Both doors order and cap with `src/story/wave_pulls.ts`, so they agree. | |
| 14 | ||
| 15 | Past 50, the page links `?all=1` to list every pull; the terminal draws the first 50 and its pick stays on them. | |
| 16 | ||
| 17 | The wave page and terminal list oldest landed first (the story as it happened), while the API and MCP still return a wave's pulls newest landed first. That difference is deliberate for now. |
src/story/wave_pulls.ts +13
| @@ -111,6 +111,19 @@ export function inLandingOrder(pulls: readonly CarriedPull[]): CarriedPull[] { | ||
| 111 | 111 | .map((e) => e.p); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | /** The most pulls a wave page lists before it says "and N more". */ | |
| 115 | export const PAGE_PULLS = 50; | |
| 116 | ||
| 117 | /** | |
| 118 | * Landed pulls oldest first (ties by lower number), then those not landed in the order the wave | |
| 119 | * names them: the order the story happened in. | |
| 120 | */ | |
| 121 | export function inStoryOrder(pulls: readonly CarriedPull[]): CarriedPull[] { | |
| 122 | const landed = pulls.filter((p) => p.mergedAt !== null); | |
| 123 | landed.sort((a, b) => (a.mergedAt === b.mergedAt ? a.number - b.number : a.mergedAt! < b.mergedAt! ? -1 : 1)); | |
| 124 | return [...landed, ...pulls.filter((p) => p.mergedAt === null)]; | |
| 125 | } | |
| 126 | ||
| 114 | 127 | /** |
| 115 | 128 | * Where the pull lives on this forge: the local path, never the host the wave file was written |
| 116 | 129 | * with. |
src/tui/screens/waves.ts +8 −7
| @@ -15,7 +15,8 @@ import { movedWithPulls, shippedOf, shippedWords, waveProgress, type MovedMilest | ||
| 15 | 15 | import { milestonePath, planNow } from "../../story/wave_plan.ts"; |
| 16 | 16 | import { repoBase } from "../../web/chrome.ts"; |
| 17 | 17 | import { waitingKeys } from "../../release/landings.ts"; |
| 18 | import { carriedPulls, inLandingOrder, pullPath, type CarriedPull } from "../../story/wave_pulls.ts"; | |
| 18 | import { agoWords } from "../../kernel/ago.ts"; | |
| 19 | import { carriedPulls, inStoryOrder, PAGE_PULLS, pullPath, type CarriedPull } from "../../story/wave_pulls.ts"; | |
| 19 | 20 | import { pullRefs, readWave, readWaves, waveNeighbours, type WaveNeighbours, sizeWords, waveLine, waveSize, appsOf, wavesInApp, type WaveEntry } from "../../story/waves.ts"; |
| 20 | 21 | import { EMPTY_WORDS } from "../../core/empty_words.ts"; |
| 21 | 22 | import { FIRST_WAVE_TELL, landedSentence, waveSentence } from "../../story/words.ts"; |
| @@ -113,11 +114,11 @@ export function waveLines( | ||
| 113 | 114 | "Pulls", |
| 114 | 115 | ...(pulls.length === 0 |
| 115 | 116 | ? [" No pulls to show here."] |
| 116 | : pulls.flatMap((p, i) => [ | |
| 117 | `${picked === i ? "> " : " "}#${p.number} ${plain(p.title)} ${p.mergedAt === null ? p.state : `merged ${p.mergedBy === null ? "" : `by ${plain(p.mergedBy)} `}${p.mergedAt.slice(0, 10)}`}`, | |
| 117 | : [...pulls.slice(0, PAGE_PULLS).flatMap((p, i) => [ | |
| 118 | `${picked === i ? "> " : " "}#${p.number} ${plain(p.title)} ${p.mergedAt === null ? p.state : `merged ${p.mergedBy === null ? "" : `by ${plain(p.mergedBy)} `}${agoWords(p.mergedAt)}`}`, | |
| 118 | 119 | ...(p.sentence === undefined ? [] : [` ${plain(p.sentence)}`]), |
| 119 | 120 | ` ${plain(pullPath(p))}`, |
| 120 | ])), | |
| 121 | ]), ...(pulls.length > PAGE_PULLS ? [` and ${pulls.length - PAGE_PULLS} more`] : [])]), | |
| 121 | 122 | ...(near.earlier === null && near.later === null ? [] : [""]), |
| 122 | 123 | ...(near.earlier === null ? [] : [`Earlier ([): ${plain(near.earlier.headline)}`]), |
| 123 | 124 | ...(near.later === null ? [] : [`Later (]): ${plain(near.later.headline)}`]), |
| @@ -185,12 +186,12 @@ function waveScreen( | ||
| 185 | 186 | } |
| 186 | 187 | if (pulls.length > 0 && !e.ctrl && !e.alt) { |
| 187 | 188 | if (e.key === "n" || e.key === "tab") { |
| 188 | picked = (picked + 1) % pulls.length; | |
| 189 | picked = (picked + 1) % Math.min(pulls.length, PAGE_PULLS); | |
| 189 | 190 | ctx.invalidate(); |
| 190 | 191 | return true; |
| 191 | 192 | } |
| 192 | 193 | if (e.key === "p") { |
| 193 | picked = (picked + pulls.length - 1) % pulls.length; | |
| 194 | picked = (picked + Math.min(pulls.length, PAGE_PULLS) - 1) % Math.min(pulls.length, PAGE_PULLS); | |
| 194 | 195 | ctx.invalidate(); |
| 195 | 196 | return true; |
| 196 | 197 | } |
| @@ -238,7 +239,7 @@ export function wavesScreen(f: Session, ctx: Ctx, src: RepoSource): Screen { | ||
| 238 | 239 | : entry; |
| 239 | 240 | if (!one) return; |
| 240 | 241 | // The page's gate on each pull: one the viewer cannot read is not named. |
| 241 | const pulls = one.ok ? inLandingOrder(carriedPulls(f.db, pullRefs(one.wave), f.user)) : []; | |
| 242 | const pulls = one.ok ? inStoryOrder(carriedPulls(f.db, pullRefs(one.wave), f.user)) : []; | |
| 242 | 243 | // Same list as the page, from the same function, with the same gate. |
| 243 | 244 | const moved = one.ok |
| 244 | 245 | ? movedWithPulls({ |
src/web/pages/waves.ts +13 −5
| @@ -18,9 +18,11 @@ import type { Ctx } from "../../http/context.ts"; | ||
| 18 | 18 | import { VERSION, type Wave } from "../../story/wave.ts"; |
| 19 | 19 | import { movedWithPulls, type MovedMilestone, shippedOf, shippedWords, waveProgress, widestMoved } from "../../story/wave_moved.ts"; |
| 20 | 20 | import { waveDays, waveDuration } from "../../story/wave_duration.ts"; |
| 21 | import { carriedPulls, inLandingOrder, pullPath } from "../../story/wave_pulls.ts"; | |
| 21 | import { carriedPulls, inLandingOrder, inStoryOrder, PAGE_PULLS, pullPath } from "../../story/wave_pulls.ts"; | |
| 22 | 22 | import { appsOf, fromWave, inApp, parseAppFilter, pullRefs, readWave, readWaves, sizeWords, waveNeighbours, wavePath, waveSize } from "../../story/waves.ts"; |
| 23 | 23 | import { FIRST_WAVE_TELL, landedSentence, waveSentence } from "../../story/words.ts"; |
| 24 | import { time } from "../time_element.ts"; | |
| 25 | import { agoWords } from "../../kernel/ago.ts"; | |
| 24 | 26 | import { wordClip } from "../../text/word_clip.ts"; |
| 25 | 27 | import { loadRepo, notFoundPage, repoBase, scopeHeader } from "../chrome.ts"; |
| 26 | 28 | import { escapeHtml, html, type Html } from "../html.ts"; |
| @@ -253,7 +255,9 @@ export async function wavePage(ctx: Ctx): Promise<Response> { | ||
| 253 | 255 | row({ |
| 254 | 256 | href: `${pullPath(p)}${fromWave(repo.ownerName, repo.name, entry.ok ? entry.wave.version : "")}`, |
| 255 | 257 | title: html`#${p.number} ${p.title}`, |
outdated
Principle 1: date and 'N days ago' say the same thing twice; keep the words. |
||
| 256 | meta: html`${p.mergedAt === null ? p.state : `merged ${p.mergedBy === null ? "" : `by ${p.mergedBy} `}${p.mergedAt.slice(0, 10)}`}`, | |
| 258 | meta: p.mergedAt === null | |
| 259 | ? html`${p.state}` | |
| 260 | : html`merged ${p.mergedBy === null ? "" : `by ${p.mergedBy} `}${time(p.mergedAt, { text: agoWords(p.mergedAt) })}`, | |
| 257 | 261 | // Its own line (a fact row), so the state and date stay scannable; none when the pull has no |
| 258 | 262 | // description. |
| 259 | 263 | ...(p.sentence === undefined ? {} : { facts: [{ label: "Says", value: html`<span data-pull-sentence>${p.sentence}</span>` }] }), |
| @@ -261,7 +265,10 @@ export async function wavePage(ctx: Ctx): Promise<Response> { | ||
| 261 | 265 | }); |
| 262 | 266 | /** Each pull is said once: those a change's fold holds are not listed again below. */ |
| 263 | 267 | const folded = new Set(moved.flatMap((m) => m.pulls)); |
outdated
Needs a rendered test with >50 pulls and with ?all=1 (box 2). |
||
| 264 | const unfolded = carried.filter((p) => !(p.owner === repo.ownerName && p.name === repo.name && folded.has(p.number))); | |
| 268 | const everything = ctx.url.searchParams.get("all") === "1"; | |
| 269 | const unfoldedAll = inStoryOrder(carried).filter((p) => !(p.owner === repo.ownerName && p.name === repo.name && folded.has(p.number))); | |
| 270 | const unfolded = everything ? unfoldedAll : unfoldedAll.slice(0, PAGE_PULLS); | |
| 271 | const hidden = unfoldedAll.length - unfolded.length; | |
| 265 | 272 | // The stored plan, read through the same cache the milestones page uses. |
| 266 | 273 | const standing = entry.ok |
| 267 | 274 | ? standingLine( |
| @@ -305,13 +312,14 @@ export async function wavePage(ctx: Ctx): Promise<Response> { | ||
| 305 | 312 | { head: html`<h2>Moved</h2>` }, |
| 306 | 313 | )} |
| 307 | 314 | ${carried.length === 0 |
| 308 | ? html`<p class="muted">No pulls to show here.</p>` | |
| 315 | ? html`<p class="muted" data-pulls-none>No pulls to show here.</p>` | |
| 309 | 316 | : unfolded.length === 0 |
| 310 | 317 | ? "" |
| 311 | 318 | : listCard( |
| 312 | 319 | unfolded.map(pullRow), |
| 313 | 320 | { head: html`<h2>Pulls</h2>` }, |
| 314 | )}` | |
| 321 | )} | |
| 322 | ${hidden > 0 ? html`<p class="muted" data-pulls-more>and ${hidden} more · <a href="?all=1">Show them all</a></p>` : ""}` | |
| 315 | 323 | : html`<h1>${entry.file}</h1> |
| 316 | 324 | <p class="muted">Not a wave: ${entry.reason}</p>`; |
| 317 | 325 |
test/tui-waves.test.ts +11 −2
| @@ -180,7 +180,7 @@ describe("waves in the terminal", () => { | ||
| 180 | 180 | test("a wave's pulls are the page's: the owner sees the private one, an outsider does not", async () => { |
| 181 | 181 | const owner = await open(alice, mix, ["enter"]); |
| 182 | 182 | owner.stop(); |
| 183 | expect(owner.text).toContain("Shown work merged 2026-03-04"); | |
| 183 | expect(owner.text).toMatch(/Shown work merged \d+ days ago/); | |
| 184 | 184 | expect(owner.text).toContain("/alice/mix/pulls/"); |
| 185 | 185 | expect(owner.text).toContain("Secret work"); |
| 186 | 186 | const outsider = await open(bob, mix, ["enter"]); |
| @@ -459,7 +459,7 @@ describe("a wave's pulls in the terminal", () => { | ||
| 459 | 459 | test("say who landed each, as the page does", () => { |
| 460 | 460 | const entry = { ok: true as const, file: "1.0.0.md", wave: { version: "1.0.0", date: "2026-01-01", headline: "Head", highlights: [], pulls: [] } }; |
| 461 | 461 | const lines = waveLines(entry, [{ owner: "o", name: "r", number: 2, title: "T", mergedAt: "2026-01-02", mergedBy: "ada", state: "closed" }]); |
| 462 | expect(lines.join("\n")).toContain("merged by ada 2026-01-02"); | |
| 462 | expect(lines.join("\n")).toMatch(/merged by ada \d+ days ago/); | |
| 463 | 463 | }); |
| 464 | 464 | }); |
| 465 | 465 | |
| @@ -477,3 +477,12 @@ test("the wave screen says how long the wave took, on the line after the trail ( | ||
| 477 | 477 | expect(waveLines(entry, [], [], null, "", "took 3 days")).toContain("took 3 days"); |
| 478 | 478 | expect(waveLines(entry, [])).not.toContain("took 3 days"); |
| 479 | 479 | }); |
| 480 | ||
| 481 | test("the terminal lists pulls as the page does: capped at 50 with 'and N more'", () => { | |
| 482 | const many = Array.from({ length: 53 }, (_, i) => ({ owner: "o", name: "r", number: i + 1, title: `T${i + 1}`, mergedAt: "2026-01-02T00:00:00Z", mergedBy: null, state: "closed" as const })); | |
| 483 | const entry = { ok: true as const, file: "1.0.0.md", wave: { version: "1.0.0", date: "2026-01-01", headline: "Head", highlights: [], pulls: [] } }; | |
| 484 | const text = waveLines(entry, many).join("\n"); | |
| 485 | expect(text).toContain("#50 T50"); | |
| 486 | expect(text).not.toContain("#51 T51"); | |
| 487 | expect(text).toContain("and 3 more"); | |
| 488 | }); |
test/wave-page-pulls.test.ts +9 −3
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | /** |
| 2 | * A wave page lists its pulls newest first, each with the first line of its description, escaped. | |
| 2 | * A wave page lists its pulls oldest landed first, each with the first line of its description, | |
| 3 | * escaped. | |
| 3 | 4 | */ |
| 4 | 5 | import { afterAll, beforeAll, expect, test } from "bun:test"; |
| 5 | 6 | import { mkdtempSync, rmSync } from "node:fs"; |
| @@ -55,12 +56,17 @@ afterAll(() => { | ||
| 55 | 56 | rmSync(root, { recursive: true, force: true }); |
| 56 | 57 | }); |
| 57 | 58 | |
| 58 | test("pulls are listed newest first", () => { | |
| 59 | const order = ["Says <script>", "No description title", "Old sentence"].map((s) => html.indexOf(s, html.indexOf("data-pull-sentence"))); | |
| 59 | test("pulls are listed oldest landed first", () => { | |
| 60 | const order = ["Old sentence", "No description title", "Says <script>"].map((s) => html.indexOf(s, html.indexOf("data-pull-sentence"))); | |
| 60 | 61 | expect(order.every((i) => i > 0)).toBe(true); |
| 61 | 62 | expect(order).toEqual([...order].sort((a, b) => a - b)); |
| 62 | 63 | }); |
| 63 | 64 | |
| 65 | test("landed time is said in words only; the date rides in the title", () => { | |
| 66 | expect(html).toMatch(/<time datetime="2026-03-09T10:00:00.000Z" title="2026-03-09 10:00 UTC"\s*>[^<]*\d+ [a-z]+ ago<\/time\s*>/); | |
outdated
Time-dependent: will fail once the fixture is months old. Fix the clock. |
||
| 67 | expect(html).not.toContain("2026-03-09 ·"); | |
| 68 | }); | |
| 69 | ||
| 64 | 70 | test("each pull shows the first line of its description, escaped", () => { |
| 65 | 71 | expect(html).toContain("Old sentence"); |
| 66 | 72 | expect(html).not.toContain("second line"); |
test/wave-pulls-cap.test.ts added +89
| @@ -0,0 +1,89 @@ | ||
| 1 | /** A wave page lists at most 50 pulls, then says "and N more" with a link to the full list. */ | |
| 2 | import { expect, test } from "bun:test"; | |
| 3 | import { inStoryOrder, PAGE_PULLS, type CarriedPull } from "../src/story/wave_pulls.ts"; | |
| 4 | ||
| 5 | const pull = (number: number, mergedAt: string | null): CarriedPull => ({ | |
| 6 | owner: "a", name: "r", number, title: `t${number}`, mergedAt, mergedBy: null, state: mergedAt === null ? "open" : "closed", | |
| 7 | }); | |
| 8 | ||
| 9 | test("three landed pulls come oldest first, unlanded last", () => { | |
| 10 | const out = inStoryOrder([pull(9, "2026-03-09T00:00:00Z"), pull(4, null), pull(2, "2026-03-01T00:00:00Z"), pull(5, "2026-03-05T00:00:00Z")]); | |
| 11 | expect(out.map((p) => p.number)).toEqual([2, 5, 9, 4]); | |
| 12 | }); | |
| 13 | ||
| 14 | test("the cap is 50", () => { | |
| 15 | expect(PAGE_PULLS).toBe(50); | |
| 16 | }); | |
| 17 | ||
| 18 | import { afterAll, beforeAll } from "bun:test"; | |
| 19 | import { mkdtempSync, rmSync } from "node:fs"; | |
| 20 | import { tmpdir } from "node:os"; | |
| 21 | import { join } from "node:path"; | |
| 22 | import { openPull } from "../src/actions/pulls.ts"; | |
| 23 | import { commitToBranch, createRepo } from "../src/actions/repos.ts"; | |
| 24 | import { createApp, type App } from "../src/app.ts"; | |
| 25 | import { createUser } from "../src/core/users.ts"; | |
| 26 | import { serve, type Servers } from "../src/http/server.ts"; | |
| 27 | import { quietLogs } from "./helpers/globals.ts"; | |
| 28 | import { waveNaming } from "./helpers/wave-pulls.ts"; | |
| 29 | ||
| 30 | quietLogs(); | |
| 31 | ||
| 32 | const must = <T>(r: { ok: true; value: T } | { ok: false; error: unknown }): T => { | |
| 33 | if (!r.ok) throw new Error(JSON.stringify(r.error)); | |
| 34 | return r.value; | |
| 35 | }; | |
| 36 | ||
| 37 | let root = ""; | |
| 38 | let app: App; | |
| 39 | let servers: Servers; | |
| 40 | const TOTAL = PAGE_PULLS + 3; | |
| 41 | ||
| 42 | beforeAll(async () => { | |
| 43 | root = mkdtempSync(join(tmpdir(), "forge-wave-cap-")); | |
| 44 | app = createApp({ dataDir: root, port: 0 }); | |
| 45 | servers = await serve(app); | |
| 46 | const u = must(await createUser(app.db, { origin: "seed", trusted: true, username: "alice", email: "[email protected]", password: "a-good-passphrase", adminIfFirst: true })); | |
| 47 | const repo = must(await createRepo(app, u, { name: "pub", visibility: "public" })); | |
| 48 | must(await commitToBranch(app, u, repo, { message: "init", files: [{ path: "README.md", content: "hi\n" }] })); | |
| 49 | must(await commitToBranch(app, u, repo, { branch: "work", message: "work", files: [{ path: "w.txt", content: "x" }] })); | |
| 50 | const refs: { owner: string; name: string; number: number }[] = []; | |
| 51 | const recent = Date.now() - 3 * 86_400_000; | |
| 52 | for (let i = 0; i < TOTAL; i++) { | |
| 53 | const p = must(await openPull(app, u, repo, { title: `Cap pull ${i}`, body: "", baseBranch: "main", headBranch: "work" })); | |
| 54 | app.db.query("UPDATE pull SET merged_at = ? WHERE issue_id = ?").run(new Date(recent + i * 60_000).toISOString(), p.id); | |
| 55 | refs.push({ owner: "alice", name: "pub", number: p.number }); | |
| 56 | } | |
| 57 | must(await commitToBranch(app, u, repo, { message: "wave", files: [ | |
| 58 | { path: "waves/0.1.0.md", content: waveNaming("0.1.0", refs) }, | |
| 59 | { path: "waves/0.2.0.md", content: waveNaming("0.2.0", [{ owner: "alice", name: "pub", number: 99999 }]) }, | |
| 60 | ] })); | |
| 61 | }, 120_000); | |
| 62 | afterAll(() => { | |
| 63 | servers.stop(); | |
| 64 | app.close(); | |
| 65 | rmSync(root, { recursive: true, force: true }); | |
| 66 | }); | |
| 67 | ||
| 68 | const count = (h: string) => (h.match(/#\d+ Cap pull \d+/g) ?? []).length; | |
| 69 | ||
| 70 | test("a wave of more than 50 pulls lists 50, says 'and N more' and links to all of them", async () => { | |
| 71 | const h = await (await fetch(`${servers.url}/alice/pub/waves/0.1.0`)).text(); | |
| 72 | expect(count(h)).toBe(PAGE_PULLS); | |
| 73 | expect(h).toContain("Cap pull 0<"); | |
| 74 | expect(h).not.toContain(`Cap pull ${TOTAL - 1}<`); | |
| 75 | expect(h).toMatch(/data-pulls-more[^>]*>and 3 more/); | |
| 76 | expect(h).toContain('href="?all=1"'); | |
| 77 | }); | |
| 78 | ||
| 79 | test("?all=1 lists every pull and no 'and N more'", async () => { | |
| 80 | const h = await (await fetch(`${servers.url}/alice/pub/waves/0.1.0?all=1`)).text(); | |
| 81 | expect(count(h)).toBe(TOTAL); | |
| 82 | expect(h).not.toContain("data-pulls-more"); | |
| 83 | }); | |
| 84 | ||
| 85 | test("a wave whose pulls cannot be shown says so (data-pulls-none)", async () => { | |
| 86 | const h = await (await fetch(`${servers.url}/alice/pub/waves/0.2.0`)).text(); | |
| 87 | expect(h).toContain("data-pulls-none"); | |
| 88 | expect(h).not.toContain("data-pulls-more"); | |
| 89 | }); |
test/wave-pulls.test.ts +6 −5
| @@ -102,7 +102,7 @@ test("rows give #N title · merged date, link to the pull, and leave out the uns | ||
| 102 | 102 | expect(body).toContain("Add the <b>thing</b>"); |
| 103 | 103 | expect(body).not.toContain("<b>thing"); |
| 104 | 104 | expect(body).toContain("Fix the other"); |
| 105 | expect(body).toContain("merged 2026-03-04"); | |
| 105 | expect(body).toMatch(/title="2026-03-04 \d\d:\d\d UTC"/); | |
| 106 | 106 | expect(body).not.toContain("merged by"); |
| 107 | 107 | expect(body).toMatch(/href="\/alice\/pub\/pulls\/\d+(?:\?from=[^"]*)?"[^>]*class="row"|class="row"[^>]*href="\/alice\/pub\/pulls\/\d+(?:\?from=[^"]*)?"/); |
| 108 | 108 | expect(body).not.toContain("Secret work"); |
| @@ -196,7 +196,7 @@ test("the page opens with one escaped sentence of what landed, and says when not | ||
| 196 | 196 | expect(none).toContain("No pull in this wave has landed yet."); |
| 197 | 197 | }); |
| 198 | 198 | |
| 199 | test("pulls are listed newest landed first, with who merged them, in page and API", async () => { | |
| 199 | test("page lists pulls oldest landed first with who merged them, in page and API", async () => { | |
| 200 | 200 | const repo = app.db.query<{ id: string }, []>("SELECT id FROM repo WHERE name = 'pub'").get()!; |
| 201 | 201 | const nums = (t: string) => |
| 202 | 202 | app.db.query<{ number: number }, [string, string]>("SELECT number FROM issue WHERE repo_id = ? AND title = ?").get(repo.id, t)!.number; |
| @@ -205,9 +205,10 @@ test("pulls are listed newest landed first, with who merged them, in page and AP | ||
| 205 | 205 | app.db.query("UPDATE pull SET merged_at = '2026-03-01T10:00:00.000Z', merged_by = ? WHERE issue_id = (SELECT id FROM issue WHERE repo_id = ? AND number = ?)").run(bob.id, repo.id, a); |
| 206 | 206 | app.db.query("UPDATE pull SET merged_at = '2026-03-09T10:00:00.000Z', merged_by = ? WHERE issue_id = (SELECT id FROM issue WHERE repo_id = ? AND number = ?)").run(alice.id, repo.id, b); |
| 207 | 207 | const html = await (await fetch(`${servers.url}/alice/pub/waves/0.1.0`)).text(); |
| 208 | expect(html.indexOf("Fix the other")).toBeLessThan(html.indexOf("Add the <b>thing")); | |
| 209 | expect(html).toContain("merged by alice 2026-03-09"); | |
| 210 | expect(html).toContain("merged by bob 2026-03-01"); | |
| 208 | const list = html.slice(html.indexOf("<h2>Pulls</h2>")); | |
| 209 | expect(list.indexOf("Add the <b>thing")).toBeLessThan(list.indexOf("Fix the other")); | |
| 210 | expect(html).toMatch(/merged by alice <time datetime="2026-03-09T10:00:00.000Z" title="2026-03-09 10:00 UTC"\s*>/); | |
| 211 | expect(html).toMatch(/merged by bob <time datetime="2026-03-01T10:00:00.000Z" title="2026-03-01 10:00 UTC"\s*>/); | |
| 211 | 212 | const api = (await (await fetch(`${servers.url}/api/v1/repos/alice/pub/waves/0.1.0`)).json()) as { |
| 212 | 213 | pulls: { number: number; merged_by: string | null; state: string }[]; |
| 213 | 214 | }; |
new above
offline
Only 50 rows drawn but
pickedindexes the full list; clamp or page.