Public: anyone can read this; the crew can change it.
Each app's last-change line reads in plain words a client understands: what changed, in one sentence, with no ids #16077
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/16052-each-app-s-last-change-line-reads-in-pla → main 0 commits fork
3 files
changed +17
−3
src/story/last_change.ts +2 −2
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | import { plainWords } from "../core/app-crew.ts"; |
| 8 | 8 | import { cutTitle } from "../core/client-apps.ts"; |
| 9 | 9 | |
| 10 | export const NO_CHANGE_LINE = "The crew has not changed anything yet."; | |
| 10 | export const NO_CHANGE_LINE = "No changes yet."; | |
| 11 | 11 | const DAY = 86_400_000; |
| 12 | 12 | const WEEKDAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; |
| 13 | 13 | const MONTHS = [ |
| @@ -39,7 +39,7 @@ function day(at: number, now: number): string { | ||
| 39 | 39 | /** The sentence for an app's newest merged pull, or the "not yet" one when it has none. */ |
| 40 | 40 | export function lastChangeLine(last: { title: string; at: string } | undefined, now: number): string { |
| 41 | 41 | if (last === undefined) return NO_CHANGE_LINE; |
| 42 | const title = cutTitle(plainWords(last.title).replace(DEV_TOKENS, "").replace(/\(\s*\)/g, "")); | |
| 42 | const title = cutTitle(plainWords(last.title.split(/\r?\n/)[0] ?? "").replace(DEV_TOKENS, "").replace(/\(\s*\)/g, "")); | |
| 43 | 43 | const at = Date.parse(last.at); |
| 44 | 44 | if (title === "" || Number.isNaN(at)) return NO_CHANGE_LINE; |
| 45 | 45 | return `The crew's last change was “${title}”, ${day(at, now)}.`; |
test/client-home.test.ts +1 −1
| @@ -649,7 +649,7 @@ describe("a client's first screen", () => { | ||
| 649 | 649 | if (!other.ok) throw new Error(JSON.stringify(other.error)); |
| 650 | 650 | const none = main(await page(owner)); |
| 651 | 651 | expect(none).not.toContain("last change was"); |
| 652 | expect(none).toContain("has not changed anything yet"); | |
| 652 | expect(none).toContain("No changes yet"); | |
| 653 | 653 | seedIssue("i-doing-4", 9004, "pull", "Older <i>fix</i>", "closed"); |
| 654 | 654 | seedIssue("i-doing-5", 9005, "pull", "Add <b>rye</b> bread", "closed"); |
| 655 | 655 | const ins = child.db.query( |
test/story-last-change-words.test.ts added +14
| @@ -0,0 +1,14 @@ | ||
| 1 | import { expect, test } from "bun:test"; | |
| 2 | import { lastChangeLine } from "../src/story/last_change.ts"; | |
| 3 | ||
| 4 | const NOW = Date.parse("2026-11-21T12:00:00.000Z"); | |
| 5 | ||
| 6 | test("the sentence carries no issue or pull numbers, and only the title's first line", () => { | |
| 7 | const line = lastChangeLine({ title: "Add the booking form (#42)\nCloses #7, PR 9", at: "2026-11-17T09:00:00.000Z" }, NOW); | |
| 8 | expect(line).toBe("The crew's last change was “Add the booking form”, on Tuesday."); | |
| 9 | expect(line).not.toMatch(/#|\d/); | |
| 10 | }); | |
| 11 | ||
| 12 | test("an app with no change says 'No changes yet.'", () => { | |
| 13 | expect(lastChangeLine(undefined, NOW)).toBe("No changes yet."); | |
| 14 | }); |
new above
offline