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

small: /changelog on a forge with nothing released says what it is running, not "Nothing has shipped yet" beside the commit that is live #13932

Merged opened this

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

Merged

scout/forge:scout/13856-small-changelog-on-a-forge-with-nothing → main 5 commits fork 3 threads · 3 unresolved

  • Merged. scout/13856-small-changelog-on-a-forge-with-nothing was merged into main as 9697605.

Review

Sign in to review this change.
6 files changed +51 −11
docs/features/changelog.md +4
@@ -81,3 +81,7 @@ Read them:
8181 Releases are recorded from the day the forge carries this; earlier deploys are not backfilled.
8282
8383 A release still `pending` when the forge restarts is settled to `none` on boot: its verdict went with the process. Reads are capped: the app's answer at 4 KB (the stream is cancelled), a version file at 64 KB.
84
85 ## Nothing released yet
86
87 When no pull has landed, `/changelog` shows one sentence in place of the "Live:" line and "Nothing has shipped yet.": "Running <version · commit>; changes appear on release." A development build says "a development build" when no commit is known. The terminal's Changelog screen, with no releases, reads "No releases yet" and "Changes appear on release." The page is held to the first-view word budget in `test/attention.test.ts`, which is why the sentence is short. Tested in `test/changelog.test.ts`.
src/tui/screens/changelog.ts +1 −1
@@ -211,7 +211,7 @@ export function changelogScreen(f: Session, ctx: Ctx): Screen {
211211 if (entries.length === 0 && groups.length === 0) {
212212 emptyState(s, area, c, {
213213 title: loaded ? "No releases yet" : "Reading…",
214 body: "Each release lands here with its pulls.",
214 body: "Changes appear on release.",

Behaviour changed here (the empty-state body) with no test. Render the screen with no releases in tui-changelog and assert "Changes appear on release." so it fails without this line.

215215 });
216216 return;
217217 }
src/web/pages/changelog.ts +18 −3
@@ -301,8 +301,23 @@ function renderRegion(
301301 // A build that is not a release has no version worth a reader's attention: the commit says it.
302302 const version =
303303 read.version !== "dev" ? (commit === null ? read.version : html`${read.version} · ${commit}`) : (commit ?? "a development build");
304 const top = html`<p class="small muted" id="shipped-top">
305 Live: ${version}.${toLive !== undefined && toLive.version === read.version ? html` Landed to live in ${secondsWords(toLive.seconds)}.` : null} <span id="shipped-today">${live.length === 0 ? "" : shippedToday(today, zone === "UTC")}</span>
304 // Nothing released: one sentence says what runs and when the list begins, in place of a second
305 // line that disagrees with the first. The commit sits mid-sentence, so no full stop trails a
306 // chip.
307 // A known version with no commit is just that version: it is no development build.
308 const running =
309 read.version !== "dev"
outdated

When version is not dev and commit is null this renders "Running 1.2 · a development build", which contradicts itself. Drop the "a development build" half when a version is known (and test it).

310 ? commit === null
311 ? html`${read.version}`
312 : html`${read.version} · commit ${commit}`
313 : commit === null
314 ? html`a development build`
315 : html`commit ${commit}`;
316 const top =
317 live.length === 0
318 ? html`<p class="small muted" id="shipped-top">Running ${running}; changes appear on release.<span id="shipped-today"></span></p>`
319 : html`<p class="small muted" id="shipped-top">
320 Live: ${version}.${toLive !== undefined && toLive.version === read.version ? html` Landed to live in ${secondsWords(toLive.seconds)}.` : null} <span id="shipped-today">${shippedToday(today, zone === "UTC")}</span>
306321 </p>`;
307322 const way =
308323 onItsWay.length === 0
@@ -312,7 +327,7 @@ function renderRegion(
312327 const grouped = groups.length > 0;
313328 const gone =
314329 live.length === 0
315 ? html`<p class="mt muted">Nothing has shipped yet.</p>`
330 ? null
316331 : !grouped
317332 ? html`${byDay(live, read.own, choice === "all", zone, todayIs, target)}`
318333 : html`${groups.map((g) => (g.kind === "chapter" ? chapterSection(g, read.own, choice === "all") : betweenSection(g, read.own, choice === "all")))}`;
test/changelog.test.ts +26 −6
@@ -219,7 +219,7 @@ describe("changelog page", () => {
219219 forgetLive(app.db);
220220 app.db.run("UPDATE repo SET visibility = 'private'");
221221 try {
222 expect(await (await fetch(`${servers.url}/changelog`)).text()).toContain("Nothing has shipped yet");
222 expect(await (await fetch(`${servers.url}/changelog`)).text()).toContain("changes appear on release");
outdated

"hanges appear on release" is a truncated string to dodge capitalisation; assert the full sentence the page says ("changes appear on release").

223223 app.db.run("UPDATE repo SET visibility = 'public'");
224224 const body = await (await fetch(`${servers.url}/changelog`)).text();
225225 expect(body.indexOf("On its way")).toBeLessThan(body.indexOf("Third thing"));
@@ -262,7 +262,7 @@ describe("changelog page", () => {
262262 test("empty only when nothing has shipped", async () => {
263263 app.db.run("UPDATE pull SET merged_at = NULL");
264264 const body = await (await fetch(`${servers.url}/changelog`)).text();
265 expect(body).toContain("Nothing has shipped yet");
265 expect(body).toContain("changes appear on release");
266266 });
267267 });
268268
@@ -401,7 +401,7 @@ describe("the top line names what is running", () => {
401401 const out = String(shippedRegion({ live: [], onItsWay: [], version: "dev", commit: null, own: "a/forge" } as any, "all"));
402402 expect(out).toContain('<span id="shipped-today"></span>');
403403 expect(out).not.toContain("Nothing shipped today");
404 expect(out).toContain("Nothing has shipped yet");
404 expect(out).toContain("changes appear on release");
405405 });
406406
407407 test("shipped before today: the sentence still says nothing shipped today", async () => {
@@ -424,7 +424,13 @@ describe("the top line names what is running", () => {
424424 });
425425
426426 test("a development build with no commit says so", async () => {
427 expect(await top("dev", null)).toContain("Live: a development build.");
427 expect(await top("dev", null)).toContain("Running a development build; changes appear on release.");
428 });
429
430 test("a release with no commit says its version and no development build", async () => {
431 const line = await top("1.2", null);
432 expect(line).toContain("Running 1.2; changes appear on release.");
433 expect(line).not.toContain("development build");
428434 });
429435
430436 test("a release keeps version and sha", async () => {
@@ -503,11 +509,12 @@ describe("changelog rows, not boxes (#9688)", () => {
503509 expect(localDaysJs.indexOf("[data-zone]")).toBeLessThan(localDaysJs.indexOf("c.querySelector('.badge')"));
504510 });
505511
506 test("nothing shipped is one quiet line, the board's own", async () => {
512 test("nothing shipped is one sentence, said once", async () => {
507513 const { shippedRegion } = await import("../src/web/pages/changelog.ts");
508514 const doc = await parse(String(shippedRegion(landings([]), "all")));
509515 const lines = [...doc.querySelectorAll("p")].filter((p) => p.id !== "shipped-top");
510 expect(lines.map((p) => [p.className, p.innerHTML])).toEqual([["mt muted", "Nothing has shipped yet."]]);
516 expect(lines).toEqual([]);
517 expect(doc.getElementById("shipped-top")!.textContent).toContain("; changes appear on release.");
511518 expect(doc.querySelectorAll(".card, strong").length).toBe(0);
512519 });
513520
@@ -522,3 +529,16 @@ describe("changelog rows, not boxes (#9688)", () => {
522529 expect(doc.querySelectorAll("section[data-day] li").length).toBe(100);
523530 });
524531 });
532
533 describe("nothing released says what runs, once", () => {
534 test("the commit is linked mid-sentence, with no space before a full stop and no second empty line", async () => {
535 const { shippedRegion } = await import("../src/web/pages/changelog.ts");
536 const sha = "310f789" + "0".repeat(33);
537 const out = String(shippedRegion({ live: [], onItsWay: [], version: "dev", commit: sha, own: "a/forge" } as any, "all"));
538 expect(out).toContain(`commit <a class="sha" href="/a/forge/commit/${sha}"`);
539 expect(out).toContain("</a>; changes appear on release.");
540 expect(out).not.toContain("Nothing has shipped yet");
541 expect(out).not.toContain("Live:");
542 expect(out).not.toMatch(/\s\./);
543 });
544 });
test/keys-changelog.test.ts +1 −1
@@ -14,6 +14,6 @@ test("every landing row, live or on its way, is one data-nav row", () => {
1414
1515 test("a changelog with nothing shipped draws no data-nav row", () => {
1616 const text = String(shippedRegion(read([], []), "a/b"));
17 expect(text).toContain("Nothing has shipped yet");
17 expect(text).toContain("changes appear on release");
1818 expect(text).not.toContain("data-nav");
1919 });
test/tui-changelog.test.ts +1
@@ -101,6 +101,7 @@ test("a private forge repository leaves the terminal's screen empty", async () =
101101 const text = tui.screen.toText();
102102 tui.stop?.();
103103 expect(text).toContain("No releases yet");
104 expect(text).toContain("Changes appear on release.");
104105 expect(text).not.toContain("0.2.0");
105106 expect(text).not.toContain("#2");
106107 } finally {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs