Public: anyone can read this; the crew can change it.
One sentence says which team a pull waits on: "Waiting on Design's review" #10092
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/10079-one-sentence-says-which-team-a-pull-wait → main 2 commits fork 2 threads · 2 unresolved
2 files
changed +36
−0
src/core/teams_words.ts added +15
| @@ -0,0 +1,15 @@ | ||
| 1 | /** | |
| 2 | * Crew teams' words (#2681): the sentences a person reads about the teams an | |
| 3 | * issue names. One place, so the web merge box, the terminal and the API/MCP | |
| 4 | * say the same thing when a team holds a pull (#9930). Plain text: names are | |
| 5 | * escaped where they are rendered, not here. Nothing renders these yet. | |
| 6 | */ | |
| 7 | ||
| 8 | /** "Waiting on Design's review", or "…on Design's and Data science's reviews"; "" with no teams. */ | |
| 9 | export function waitingOnTeams(names: readonly string[]): string { | |
| 10 | const owned = names.map((n) => `${n.trim()}'s`); | |
| 11 | if (owned.length === 0) return ""; | |
| 12 | if (owned.length === 1) return `Waiting on ${owned[0]} review`; | |
| 13 | const list = `${owned.slice(0, -1).join(", ")} and ${owned[owned.length - 1]}`; | |
| 14 | return `Waiting on ${list} reviews`; | |
| 15 | } |
test/teams-words.test.ts added +21
| @@ -0,0 +1,21 @@ | ||
| 1 | /** The one sentence that says which named teams a pull waits on (#10079). */ | |
| 2 | import { expect, test } from "bun:test"; | |
| 3 | import { waitingOnTeams } from "../src/core/teams_words.ts"; | |
| 4 | ||
| 5 | test("no team holding says nothing", () => { | |
| 6 | expect(waitingOnTeams([])).toBe(""); | |
| 7 | }); | |
| 8 | ||
| 9 | test("one team: its review", () => { | |
| 10 | expect(waitingOnTeams(["Design"])).toBe("Waiting on Design's review"); | |
| 11 | }); | |
| 12 | ||
| 13 | test("two teams: both, joined with and, and reviews in the plural", () => { | |
| 14 | expect(waitingOnTeams(["Design", "Data science"])).toBe( | |
| 15 | "Waiting on Design's and Data science's reviews", | |
| 16 | ); | |
| 17 | }); | |
| 18 | ||
| 19 | test("names are passed through as plain text, not escaped here", () => { | |
| 20 | expect(waitingOnTeams(["<R&D>"])).toBe("Waiting on <R&D>'s review"); | |
Next: add a three-name case so the comma-and join is pinned. |
||
| 21 | }); |
Next: filter empty names after trim, otherwise [""] yields "Waiting on 's review".