Public: anyone can read this; the crew can change it.
A client list row says in plain words what was sent to the client and when, with no internal state names #16073
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/16050-a-client-list-row-says-in-plain-words-wh → main 0 commits fork 6 threads · 6 unresolved
docs/features/client-row-words.md added +15
| @@ -0,0 +1,15 @@ | ||
| 1 | --- | |
| 2 | topic: Agents: MCP, git, or the terminal | |
| 3 | row: A client row in plain words | |
| 4 | --- | |
| 5 | # A client row in plain words | |
| 6 | ||
| 7 | Each row of the client list says what was sent and when, in one sentence: "Sent the Morning Paper app, 3 days ago". | |
| 8 | The sentence is built in `sentWords` (`src/spawn/client_words.ts`), so the page and the terminal read the same. | |
| 9 | ||
| 10 | - Page: open `/forges`; the sentence leads the row, and the raw app slugs are not repeated beside it. | |
| 11 | - Terminal: the forges screen opens each row with the same sentence. | |
| 12 | - When the send time is missing or still to come, the row says only what was sent. | |
| 13 | - The old "sent …" part of the opened/last seen line is gone: the sentence says it. | |
| 14 | - No internal word (listed in `test/client-words-plain.test.ts`) may appear in a row; `test/client-words-plain.test.ts` renders the whole | |
| 15 | row on the page and in the terminal and checks it against that list. |
src/http/mcp/tools/forges.ts +1 −1
| @@ -39,7 +39,7 @@ export const tool: Tool = { | ||
| 39 | 39 | } |
| 40 | 40 | if (args["kind"] !== undefined) { |
| 41 | 41 | if (args["kind"] === "clients") { |
| 42 | const lines = clientLines(await clientRows(ctx.app)); | |
| 42 | const lines = clientLines(await clientRows(ctx.app), Date.now()); | |
| 43 | 43 | return good({ says: sentSays(lines.length), clients: lines }); |
| 44 | 44 | } |
| 45 | 45 | if (args["kind"] !== "refused") return bad("invalid", "kind is refused or clients"); |
src/spawn/client_words.ts +28 −1
| @@ -21,9 +21,11 @@ export interface ClientLine { | ||
| 21 | 21 | tellAt: string | null; |
| 22 | 22 | pulls: number | null; |
| 23 | 23 | next: string; |
| 24 | /** "Sent the Morning Paper app, 3 days ago": what went to the client and when, in plain words. */ | |
| 25 | says: string | null; | |
| 24 | 26 | } |
| 25 | 27 | |
| 26 | export function clientLines(rows: readonly ClientRow[]): ClientLine[] { | |
| 28 | export function clientLines(rows: readonly ClientRow[], now: number = Date.now()): ClientLine[] { | |
| 27 | 29 | return rows.map((r) => { |
| 28 | 30 | const seen = seenOf(r); |
| 29 | 31 | return { |
| @@ -39,6 +41,7 @@ export function clientLines(rows: readonly ClientRow[]): ClientLine[] { | ||
| 39 | 41 | tellAt: r.stage?.key === "crew" ? r.nextStep.lastTellAt : null, |
| 40 | 42 | pulls: r.crew?.pulls ?? null, |
| 41 | 43 | next: r.nextStep.key === "going" && r.nextStep.lastTellAt ? `going: last tell ${r.nextStep.lastTellAt}` : r.nextStep.words, |
| 44 | says: sentWords(r, now), | |
| 42 | 45 | }; |
| 43 | 46 | }); |
| 44 | 47 | } |
| @@ -66,3 +69,27 @@ export function lastActivityWords(lastActivityAt: string | null, now: number): s | ||
| 66 | 69 | export function rowActivityWords(r: Pick<ClientRow, "made" | "lastActivityAt">, seenOnRow: boolean, now: number): string | null { |
| 67 | 70 | return !r.made || seenOnRow ? null : lastActivityWords(r.lastActivityAt, now); |
| 68 | 71 | } |
| 72 | ||
| 73 | const titleCase = (slug: string): string => slug.split(/[-_\s]+/).filter((w) => w !== "").map((w) => w[0]!.toUpperCase() + w.slice(1)).join(" "); | |
| 74 | ||
| 75 | function listWords(names: readonly string[]): string { | |
| 76 | if (names.length <= 1) return names[0] ?? ""; | |
| 77 | return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`; | |
| 78 | } | |
| 79 | ||
| 80 | /** | |
| 81 | * What was sent to the client and when, as the row says it: "Sent the Morning Paper app, 3 days | |
| 82 | * ago". Days are whole UTC days; a send with no usable time (or one in the future) says only what | |
| 83 | * was sent, and a forge not made yet has no sentence. | |
| 84 | */ | |
| 85 | export function sentWords(r: Pick<ClientRow, "made" | "apps" | "sentAt">, now: number): string | null { | |
| 86 | if (!r.made) return null; | |
| 87 | const names = r.apps.map(titleCase).filter((n) => n !== ""); | |
| 88 | const what = names.length === 0 ? "a forge of their own" : names.length === 1 ? `the ${names[0]} app` : `the ${listWords(names)} apps`; | |
| 89 | const at = r.sentAt === null ? NaN : Date.parse(r.sentAt); | |
| 90 | const days = Math.floor(now / DAY_MS) - Math.floor(at / DAY_MS); | |
| 91 | // A time that is not one, or that is still to come, is not said: only what was sent. | |
| 92 | if (!Number.isFinite(at) || days < 0) return `Sent ${what}`; | |
| 93 | const when = days <= 0 ? "today" : days === 1 ? "yesterday" : `${days} days ago`; | |
| 94 | return `Sent ${what}, ${when}`; | |
| 95 | } |
src/spawn/clients.ts −1
| @@ -772,7 +772,6 @@ export function seenOf(r: Pick<ClientRow, "made" | "claimed" | "sentAt" | "first | ||
| 772 | 772 | /** The one line as parts to join with " · ": the words, and the instant to say beside them. */ |
| 773 | 773 | export function seenParts(s: Seen): { words: string; at: string | null }[] { |
| 774 | 774 | return [ |
| 775 | ...(s.sentAt === null ? [] : [{ words: "sent", at: s.sentAt }]), | |
| 776 | 775 | s.opened ? { words: s.openedAt === null ? "opened (time not noted)" : "opened", at: s.openedAt } : { words: "opened: not yet", at: null }, |
| 777 | 776 | // Nothing while unknown (undefined); "not yet" only once the child has said there is none. |
| 778 | 777 | ...(s.firstTellAt === undefined ? [] : [s.firstTellAt === null ? { words: "first tell: not yet", at: null } : { words: "first tell", at: s.firstTellAt }]), |
src/tui/screens/forges.ts +2 −2
| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | |
| 7 | 7 | import type { Ctx, Screen } from "../app/app.ts"; |
| 8 | 8 | import { binding } from "../app/keys.ts"; |
| 9 | import { rowActivityWords } from "../../spawn/client_words.ts"; | |
| 9 | import { rowActivityWords, sentWords } from "../../spawn/client_words.ts"; | |
| 10 | 10 | import { ATTENTION_WORDS, crewCountWords, daysLeftWords, firstScreenOf, CLAIM_WORDS, claimState, seenOf, seenParts, creditWords, crewHeldWords, graceWords, runningWords, spendWords, monthWords, type ClientRow } from "../../spawn/clients.ts"; |
| 11 | 11 | import { useLine } from "../../spawn/usage.ts"; |
| 12 | 12 | import { timeAgo } from "../../web/ui.ts"; |
| @@ -38,7 +38,7 @@ export function forgeLines(rows: readonly ClientRow[], sender = false, now = Dat | ||
| 38 | 38 | if (rows.length === 0) return [["", "You have not sent a forge yet"]]; |
| 39 | 39 | return rows.flatMap((r): [string, string][] => [[ |
| 40 | 40 | r.name, |
| 41 | [r.made ? (r.awake === true ? "awake" : "asleep") : null, r.made && r.where.inProcess ? r.where.says : null, r.stopped ?? null, crewHeldWords(r), r.attention === null ? null : ATTENTION_WORDS[r.attention], r.for === null ? null : `for ${r.for}`, CLAIM_WORDS[claimState(r)], linkWords(r.link, claimState(r) === "no" ? now : null), runningWords(r), seenLine(r, sender) !== null && r.stage?.key !== "tell" && r.stage?.key !== "crew" && r.stage?.resend !== true ? null : r.stage?.words ?? null, r.stage?.key === "crew" && r.nextStep.lastTellAt !== null ? `last tell ${timeAgo(r.nextStep.lastTellAt)}` : null, crewCountWords(r.crew), seenLine(r, sender), r.nextStep.words, spendWords(r)?.words ?? null, monthWords(r)?.words ?? null, creditWords(r), graceWords(r), useLine(r.size, r.use), r.made ? diskWords(r.disk) : null, activityPiece(r, sender, now), claimedWords(r), keepWords(r), r.archive === null || r.archive === undefined ? null : `proposed for archive: ${r.archive.why}`, r.lastHeartbeatAt === null ? "no heartbeat yet" : `heartbeat ${timeAgo(r.lastHeartbeatAt)}`] | |
| 41 | [r.made ? (r.awake === true ? "awake" : "asleep") : null, r.made && r.where.inProcess ? r.where.says : null, r.stopped ?? null, crewHeldWords(r), r.attention === null ? null : ATTENTION_WORDS[r.attention], sender ? sentWords(r, now) : null, r.for === null ? null : `for ${r.for}`, CLAIM_WORDS[claimState(r)], linkWords(r.link, claimState(r) === "no" ? now : null), runningWords(r), seenLine(r, sender) !== null && r.stage?.key !== "tell" && r.stage?.key !== "crew" && r.stage?.resend !== true ? null : r.stage?.words ?? null, r.stage?.key === "crew" && r.nextStep.lastTellAt !== null ? `last tell ${timeAgo(r.nextStep.lastTellAt)}` : null, crewCountWords(r.crew), seenLine(r, sender), r.nextStep.words, spendWords(r)?.words ?? null, monthWords(r)?.words ?? null, creditWords(r), graceWords(r), useLine(r.size, r.use), r.made ? diskWords(r.disk) : null, activityPiece(r, sender, now), claimedWords(r), keepWords(r), r.archive === null || r.archive === undefined ? null : `proposed for archive: ${r.archive.why}`, r.lastHeartbeatAt === null ? "not checked in yet" : `checked in ${timeAgo(r.lastHeartbeatAt)}`] | |
outdated
High: |
||
| 42 | 42 | .filter((m): m is string => m !== null) |
| 43 | 43 | .join(" · "), |
| 44 | 44 | ], ...firstScreenLines(r), ...appLinkLines(r), ...addressLines(r)]); |
src/web/pages/forges.ts +3 −2
| @@ -37,7 +37,7 @@ import { REACH_SETTINGS, reachByForge, type ForgeReach } from "../../actions/chi | ||
| 37 | 37 | import { forgeReachRows } from "./hosted-forges.ts"; |
| 38 | 38 | import { keptWords, readHosted } from "../../snapshot/hosted.ts"; |
| 39 | 39 | import { archiveForge, archivedForges, restoreForge, type ArchiveRecord } from "../../spawn/archive.ts"; |
| 40 | import { rowActivityWords } from "../../spawn/client_words.ts"; | |
| 40 | import { rowActivityWords, sentWords } from "../../spawn/client_words.ts"; | |
| 41 | 41 | import { CLIENT_STATES, CLIENT_STATE_EMPTY, CLIENT_STATE_WORDS, narrowByState, parseClientState, stateCounts } from "../../spawn/client_state.ts"; |
| 42 | 42 | import { weekLine } from "../../spawn/client_week.ts"; |
| 43 | 43 | import { parseClientQuery, searchClients } from "../../spawn/client_search.ts"; |
| @@ -93,9 +93,10 @@ export function forgeRow(r: ClientRow, now: number, reach?: ForgeReach, bill = f | ||
| 93 | 93 | const state = claimState(r); |
| 94 | 94 | const daysLeft = state === "no" ? daysLeftWords(r.link, now) : null; |
| 95 | 95 | const seen = seenOf(r); |
| 96 | const sentSays = sentWords(r, now); | |
| 96 | 97 | const meta = [ |
| 98 | sentSays === null ? null : html`<span data-sent-says>${sentSays}</span>`, | |
Principle 1 and 8: this sentence duplicates what the sent/opened/last seen line and the apps list below already say, and the row still carries internal state words. Replace them, not add. |
||
| 97 | 99 | r.for === null ? null : html`for ${r.for}`, |
| 98 | r.apps.length === 0 ? null : html`${r.apps.join(", ")}`, | |
| 99 | 100 | appLinkSummary(r.appLinks ?? []) === null ? null : html`<span data-app-links>${appLinkSummary(r.appLinks ?? [])}</span>`, |
outdated
Principle 1: raw slugs repeat the apps the sentence already names. Remove. |
||
| 100 | 101 | state === "unknown" ? html`it did not answer just now` : null, |
| 101 | 102 | crewHeldWords(r) === null ? null : html`<span data-crew-held="${NO_KEY_HELD}">${crewHeldWords(r)}</span>`, |
test/client-link-seen.test.ts +4 −4
| @@ -36,7 +36,7 @@ const html = (r: ClientRow) => String(forgeRow(r, NOW)).replace(/<[^>]*>/g, ""). | ||
| 36 | 36 | describe("the client list says whether the link was looked at", () => { |
| 37 | 37 | test("unopened", () => { |
| 38 | 38 | const h = html(row({})); |
| 39 | expect(h).toContain("sent 3d ago"); | |
| 39 | expect(h).toContain("Sent a forge of their own, 3 days ago"); | |
| 40 | 40 | expect(h).toContain("opened: not yet"); |
| 41 | 41 | expect(h).not.toContain("last seen"); |
| 42 | 42 | }); |
| @@ -68,15 +68,15 @@ describe("the client list says whether the link was looked at", () => { | ||
| 68 | 68 | const h = html(row({ claimed: true, lastActivityAt: ago(2 * 3600_000), link: { state: "used", usedAt: ago(DAY), openedAt: ago(DAY) } })); |
| 69 | 69 | expect(h).not.toContain("a person last did something"); |
| 70 | 70 | expect(h).not.toContain("Signed in"); |
| 71 | expect(html(row({}))).not.toContain("Sent"); | |
| 71 | expect(html(row({}))).toContain("Sent a forge of their own"); | |
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | 74 | test("the terminal says it to the sender, and nothing to a guest", () => { |
| 75 | 75 | const r = row({ claimed: true, firstTellAt: null, lastActivityAt: ago(2 * 3600_000), link: { state: "used", usedAt: ago(DAY), openedAt: ago(DAY) } }); |
| 76 | 76 | const line = forgeLines([r], true)[0]![1]; |
| 77 | expect(line).toContain("sent 3d ago · opened 1d ago · first tell: not yet · last seen 2h ago"); | |
| 77 | expect(line).toContain("opened 1d ago · first tell: not yet · last seen 2h ago"); | |
| 78 | 78 | expect(forgeLines([r], false)[0]![1]).not.toContain("opened"); |
| 79 | expect(forgeLines([row({})], true)[0]![1]).toContain("sent 3d ago · opened: not yet"); | |
| 79 | expect(forgeLines([row({})], true)[0]![1]).toContain("opened: not yet"); | |
| 80 | 80 | expect(forgeLines([row({})])[0]![1]).not.toContain("opened: not yet"); |
| 81 | 81 | }); |
| 82 | 82 |
test/client-list-events.test.ts +1 −1
| @@ -27,7 +27,7 @@ const words = (r: ClientRow) => seenParts(seenOf(r)!).map((p) => `${p.words}${p. | ||
| 27 | 27 | describe("the client list's three times", () => { |
| 28 | 28 | test("empty ones say not yet", () => { |
| 29 | 29 | const w = words(row({ claimed: false, firstTellAt: null, link: { state: "open", revokedAt: null, usedAt: null, openedAt: null } })); |
| 30 | expect(w).toEqual(["sent 2026-11-01T00:00:00.000Z", "opened: not yet", "first tell: not yet"]); | |
| 30 | expect(w).toEqual(["opened: not yet", "first tell: not yet"]); | |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | 33 | test("a first tell not yet reported says nothing, not \"not yet\"", () => { |
test/client-list.test.ts +2 −3
| @@ -206,10 +206,9 @@ describe("the client list", () => { | ||
| 206 | 206 | const maria = html.slice(html.indexOf('data-forge="maria"')); |
| 207 | 207 | expect(maria).toContain("Maria's bakery"); |
| 208 | 208 | expect(maria).toContain("alice/bakery"); |
| 209 | // One plain line first: for whom, then the apps; the state facts follow. | |
| 209 | // One plain line first: what was sent and for whom; the state facts follow. | |
| 210 | 210 | const line = maria.slice(0, maria.indexOf("</li>")); |
| 211 | expect(line.indexOf("Maria's bakery")).toBeLessThan(line.indexOf("alice/bakery")); | |
| 212 | expect(line.indexOf("alice/bakery")).toBeLessThan(line.indexOf("has not reported yet")); | |
| 211 | expect(line.indexOf("Maria's bakery")).toBeLessThan(line.indexOf("has not reported yet")); | |
| 213 | 212 | expect(line).not.toContain('class="card'); |
| 214 | 213 | expect(maria).toContain('href="https://maria--forge.test"'); |
| 215 | 214 | expect(maria).toMatch(/data-claimed="no"/); |
test/client-words-plain.test.ts added +83
| @@ -0,0 +1,83 @@ | ||
| 1 | import { describe, expect, test } from "bun:test"; | |
| 2 | import { clientLines, sentWords } from "../src/spawn/client_words.ts"; | |
| 3 | import { clientsCsv, CLIENTS_CSV_HEADER } from "../src/spawn/clients_csv.ts"; | |
| 4 | import type { ClientRow } from "../src/spawn/clients.ts"; | |
| 5 | import { forgeLines } from "../src/tui/screens/forges.ts"; | |
| 6 | import { forgeRow } from "../src/web/pages/forges.ts"; | |
| 7 | ||
| 8 | const INTERNAL_WORDS: readonly string[] = ["stage", "signedin", "unreported", "attention", "silent", "nextstep", "heartbeat", "null", "undefined"]; | |
| 9 | ||
| 10 | /** The first internal word in the text (whole words, any case), or null when it has none. */ | |
| 11 | function internalWordIn(text: string): string | null { | |
| 12 | const lower = text.toLowerCase(); | |
| 13 | return INTERNAL_WORDS.find((w) => new RegExp(`\\b${w}\\b`).test(lower)) ?? null; | |
| 14 | } | |
| 15 | ||
| 16 | const NOW = Date.parse("2026-11-20T12:00:00Z"); | |
| 17 | const DAY = 86_400_000; | |
| 18 | const ago = (ms: number) => new Date(NOW - ms).toISOString(); | |
| 19 | ||
| 20 | const row = (over: Partial<ClientRow> = {}): ClientRow => | |
outdated
This list is only applied to the new sentence, which cannot contain these words, so the test cannot fail. Apply it to the full row on the page and in the terminal, and share the list. |
||
| 21 | ({ | |
| 22 | name: "maria", placement: "cell", where: { placement: "cell", inProcess: false, says: "runs in its own sandbox", movable: false, held: false }, | |
| 23 | url: "https://maria.test", for: "Maria", apps: ["morning-paper"], stage: null, sentAt: ago(3 * DAY), made: true, claimed: false, | |
| 24 | lastActivityAt: null, running: null, reach: null, link: null, attention: null, spendTodayUsd: null, ceilingUsd: null, size: "small", | |
| 25 | use: { kind: "shared" }, disk: { own: false, path: "/d/children/c" }, lastHeartbeatAt: null, | |
| 26 | nextStep: { key: "unreported", words: "has not reported yet", lastTellAt: null }, ...over, | |
| 27 | }) as ClientRow; | |
| 28 | ||
| 29 | describe("a row says what was sent and when", () => { | |
| 30 | test("reads like a sentence", () => { | |
| 31 | expect(sentWords(row(), NOW)).toBe("Sent the Morning Paper app, 3 days ago"); | |
| 32 | expect(sentWords(row({ sentAt: ago(DAY) }), NOW)).toBe("Sent the Morning Paper app, yesterday"); | |
| 33 | expect(sentWords(row({ sentAt: ago(60_000) }), NOW)).toBe("Sent the Morning Paper app, today"); | |
| 34 | expect(sentWords(row({ apps: ["a-b", "cafe"] }), NOW)).toBe("Sent the A B and Cafe apps, 3 days ago"); | |
| 35 | expect(sentWords(row({ apps: [] }), NOW)).toBe("Sent a forge of their own, 3 days ago"); | |
| 36 | expect(sentWords(row({ sentAt: null }), NOW)).toBe("Sent the Morning Paper app"); | |
| 37 | expect(sentWords(row({ made: false }), NOW)).toBeNull(); | |
| 38 | }); | |
| 39 | ||
| 40 | test("a send time still to come is not said", () => { | |
| 41 | expect(sentWords(row({ sentAt: ago(-3 * DAY) }), NOW)).toBe("Sent the Morning Paper app"); | |
| 42 | }); | |
| 43 | ||
| 44 | test("no internal word appears anywhere in the whole row, on the page or in the terminal", () => { | |
| 45 | const link = { state: "used", usedAt: ago(DAY), openedAt: ago(DAY), revokedAt: null } as ClientRow["link"]; | |
| 46 | const states = [ | |
| 47 | row(), row({ claimed: true }), row({ claimed: null }), row({ sentAt: "junk" }), row({ apps: [] }), row({ made: false }), | |
| 48 | row({ claimed: true, link, lastActivityAt: ago(DAY), lastHeartbeatAt: ago(60_000) }), | |
| 49 | row({ link: { state: "open", usedAt: null, openedAt: null, revokedAt: null } as ClientRow["link"] }), | |
| 50 | ]; | |
| 51 | for (const r of states) { | |
| 52 | const page = forgeRow(r, NOW).toString().replace(/<[^>]*>/g, " "); | |
| 53 | const term = forgeLines([r], true, NOW).map((l) => l.join(" ")).join(" "); | |
| 54 | expect(internalWordIn(page)).toBeNull(); | |
| 55 | expect(internalWordIn(term)).toBeNull(); | |
| 56 | } | |
| 57 | }); | |
| 58 | ||
| 59 | test("the row says what was sent once, and shows no raw app name beside it", () => { | |
| 60 | const page = forgeRow(row(), NOW).toString(); | |
| 61 | const meta = page.slice(page.indexOf("row-meta"), page.indexOf("row-trail")); | |
| 62 | expect(meta.split("Morning Paper").length - 1).toBe(1); | |
| 63 | expect(meta).not.toContain("morning-paper"); | |
| 64 | expect(page).not.toMatch(/sent \d/i); | |
| 65 | }); | |
| 66 | ||
| 67 | test("the terminal says it to the sender and never to a guest", () => { | |
| 68 | expect(forgeLines([row()], true, NOW)[0]![1]).toContain("Sent the Morning Paper app, 3 days ago"); | |
| 69 | const guest = forgeLines([row()], false, NOW).map((l) => l.join(" ")).join(" "); | |
| 70 | expect(guest).not.toContain("Sent"); | |
| 71 | expect(guest).not.toContain("Morning Paper"); | |
| 72 | }); | |
| 73 | ||
| 74 | test("the page row and the client lines carry it", () => { | |
| 75 | expect(forgeRow(row(), NOW).toString()).toContain("Sent the Morning Paper app, 3 days ago"); | |
| 76 | expect(clientLines([row()], NOW)[0]!.says).toBe("Sent the Morning Paper app, 3 days ago"); | |
| 77 | }); | |
| 78 | ||
| 79 | test("the CSV keeps its columns", () => { | |
| 80 | expect(CLIENTS_CSV_HEADER).toEqual(["client", "forge", "sent at", "state", "last seen"]); | |
| 81 | expect(clientsCsv([row()]).split(/\r?\n/)[0]).toBe("client,forge,sent at,state,last seen"); | |
| 82 | }); | |
| 83 | }); |
test/tui-forges.test.ts +6 −4
| @@ -270,7 +270,7 @@ describe("forges you sent in the terminal", () => { | ||
| 270 | 270 | expect(line).toContain("memory 310 MiB of 512 MiB"); |
| 271 | 271 | expect(line).toContain("cpu 0.4 of 1 core"); |
| 272 | 272 | expect(line).toContain("disk 100 MiB of 2 GiB"); |
| 273 | expect(line).toContain("heartbeat just now"); | |
| 273 | expect(line).toContain("checked in just now"); | |
| 274 | 274 | const idle = row({ size: "small", use: { kind: "idle", limits: { cpu: 1, memoryMiB: 512, diskMiB: 2048 } } }); |
| 275 | 275 | expect(forgeLines([idle])[0]![1]).toContain("memory not running"); |
| 276 | 276 | }); |
| @@ -279,20 +279,22 @@ describe("forges you sent in the terminal", () => { | ||
| 279 | 279 | const up = { total: 3, running: 3, notRunning: [] }; |
| 280 | 280 | const down = { total: 2, running: 1, notRunning: [{ slug: "notes", why: "build failed" }] }; |
| 281 | 281 | expect(forgeLines([row({ running: up })])).toEqual([ |
| 282 | ["maria", "asleep · for Maria's bakery · Not claimed yet · 3 apps running · has not reported yet · small · shared · shared disk · no person has done anything here · disk measuring · no memory (asleep) · no credit lent · no heartbeat yet"], | |
| 282 | ["maria", "asleep · for Maria's bakery · Not claimed yet · 3 apps running · has not reported yet · small · shared · shared disk · no person has done anything here · disk measuring · no memory (asleep) · no credit lent · not checked in yet"], | |
outdated
These rows are built with the default |
||
| 283 | 283 | ["", ` ${firstScreenLine([])}`], |
| 284 | 284 | ]); |
| 285 | 285 | expect(forgeLines([row({ claimed: true, running: down, for: null })])).toEqual([ |
| 286 | ["maria", "asleep · Claimed · 1 app running · notes: build failed · has not reported yet · small · shared · shared disk · no person has done anything here · disk measuring · no memory (asleep) · no credit lent · no heartbeat yet"], | |
| 286 | ["maria", "asleep · Claimed · 1 app running · notes: build failed · has not reported yet · small · shared · shared disk · no person has done anything here · disk measuring · no memory (asleep) · no credit lent · not checked in yet"], | |
| 287 | 287 | ]); |
| 288 | 288 | expect(forgeLines([row({ claimed: null })])[0]![1]).toContain("Unknown"); |
| 289 | 289 | expect(forgeLines([row({ made: false })])[0]![1]).toContain("Still being made"); |
| 290 | 290 | expect(forgeLines([row({ attention: "down", claimed: true, for: null })])).toEqual([ |
| 291 | ["maria", "asleep · App down · Claimed · has not reported yet · small · shared · shared disk · no person has done anything here · disk measuring · no memory (asleep) · no credit lent · no heartbeat yet"], | |
| 291 | ["maria", "asleep · App down · Claimed · has not reported yet · small · shared · shared disk · no person has done anything here · disk measuring · no memory (asleep) · no credit lent · not checked in yet"], | |
| 292 | 292 | ]); |
| 293 | 293 | expect(forgeLines([row({})])[0]![1]).not.toMatch(/Not reporting|App down|Unclaimed/); |
| 294 | 294 | expect(forgeLines([row({ nextStep: { key: "tell", words: "no tell yet", lastTellAt: null } })])[0]![1]).toContain("no tell yet"); |
| 295 | 295 | expect(JSON.stringify(forgeLines([row({})]))).not.toContain("http"); |
| 296 | expect(forgeLines([row({})], true)[0]![1]).toContain("Sent a forge of their own"); | |
| 297 | expect(forgeLines([row({})])[0]![1]).not.toContain("Sent"); | |
| 296 | 298 | expect(runningWords(row({ running: { total: 0, running: 0, notRunning: [] } }))).toBeNull(); |
| 297 | 299 | }); |
| 298 | 300 | }); |
Non-blocking: say the terminal shows the sentence to the sender only, never to a guest.