Public: anyone can read this; the crew can change it.
A client's first login shows the crew working and three next steps, in plain words, proven by a test #14535
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/14483-a-client-s-first-login-shows-the-crew-wo → main 0 commits fork 5 threads · 5 unresolved
docs/features/client-app-line.md +11
| @@ -13,8 +13,19 @@ each app. | ||
| 13 | 13 | developer words. |
| 14 | 14 | - `Waiting for your answer` when the crew has finished something that waits for a person. |
| 15 | 15 | - `About to start` when work is lined up and nothing runs yet. |
| 16 | - `Waiting for your first ask` when no run was ever made for the app, so the line is never blank. | |
| 16 | 17 | - `Nothing in progress` otherwise. |
| 17 | 18 | |
| 19 | Below the apps the first page offers buttons: Ask for a change, See what shipped, and, for a forge | |
| 20 | admin only (inviting is theirs), Invite someone. One module words them for both doors | |
| 21 | (`src/actions/client_next.ts`): the terminal home ends with the same steps as keys (`t`, `w`, `i`), | |
| 22 | `w` opening the changelog and `i` the invite links (`test/client-first-login.test.ts`, and driven on | |
| 23 | the terminal screen in `test/client-home.test.ts`). | |
| 24 | ||
| 25 | The issue asks for three buttons; a client who is not a forge admin sees two, on purpose. Inviting | |
| 26 | is a forge admin's alone (`src/actions/invites.ts`), so a third button would open a page that refuses | |
| 27 | them. A real invite door for clients is its own change. | |
| 28 | ||
| 18 | 29 | One module words it, `src/actions/client_line.ts` (`clientLines`: three reads for any number of |
| 19 | 30 | apps, plus the review waits); the page, the terminal and `forge_view` all call it, so they cannot |
| 20 | 31 | disagree (`test/client-home.test.ts`, `test/client-line.test.ts`). |
src/actions/client_line.ts +14 −10
| @@ -14,6 +14,7 @@ import { reviewWaitsFor } from "../crew/review.ts"; | ||
| 14 | 14 | |
| 15 | 15 | export const IDLE_LINE = "Nothing in progress"; |
| 16 | 16 | export const WAITING_LINE = "Waiting for your answer"; |
| 17 | export const FIRST_ASK_LINE = "Waiting for your first ask"; | |
| 17 | 18 | export const QUEUED_LINE = "About to start"; |
| 18 | 19 | |
| 19 | 20 | /** What is in hand on an app, as counts and the running title: the sentence's whole input. */ |
| @@ -21,6 +22,8 @@ export interface CrewState { | ||
| 21 | 22 | readonly title: string | undefined; |
| 22 | 23 | readonly waitingOnPerson: boolean; |
| 23 | 24 | readonly queued: boolean; |
| 25 | /** No run has ever been made for the app: nothing was asked yet. */ | |
| 26 | readonly neverRun?: boolean; | |
| 24 | 27 | } |
| 25 | 28 | |
| 26 | 29 | /** The sentence for one app's state; the running work comes first, then a wait on the person. */ |
| @@ -30,7 +33,8 @@ export function lineFor(state: CrewState): string { | ||
| 30 | 33 | return said === "" ? "Building something new" : `Building: ${said}`; |
| 31 | 34 | } |
| 32 | 35 | if (state.waitingOnPerson) return WAITING_LINE; |
| 33 | return state.queued ? QUEUED_LINE : IDLE_LINE; | |
| 36 | if (state.queued) return QUEUED_LINE; | |
| 37 | return state.neverRun === true ? FIRST_ASK_LINE : IDLE_LINE; | |
| 34 | 38 | } |
| 35 | 39 | |
| 36 | 40 | /** One sentence for each of `repos`, in two reads for the whole set plus the review waits. */ |
| @@ -40,14 +44,14 @@ export function clientLines(db: Database, repos: readonly Repo[]): Map<string, s | ||
| 40 | 44 | const ids = repos.map((r) => r.id); |
| 41 | 45 | const doing = clientDoings(db, ids); |
| 42 | 46 | const marks = ids.map((_, i) => `?${i + 1}`).join(","); |
| 43 | const queued = new Set( | |
| 44 | db | |
| 45 | .query<{ repo_id: string }, string[]>( | |
| 46 | `SELECT DISTINCT repo_id FROM run WHERE kind = 'agent' AND state = 'queued' AND repo_id IN (${marks})`, | |
| 47 | ) | |
| 48 | .all(...ids) | |
| 49 | .map((r) => r.repo_id), | |
| 50 | ); | |
| 47 | // One read gives both: which apps have ever run, and which have an agent run queued. | |
| 48 | const runs = db | |
| 49 | .query<{ repo_id: string; queued: number }, string[]>( | |
| 50 | `SELECT repo_id, MAX(kind = 'agent' AND state = 'queued') AS queued FROM run WHERE repo_id IN (${marks}) GROUP BY repo_id`, | |
| 51 | ) | |
| 52 | .all(...ids); | |
| 53 | const ran = new Set(runs.map((r) => r.repo_id)); | |
| 54 | const queued = new Set(runs.filter((r) => r.queued === 1).map((r) => r.repo_id)); | |
| 51 | 55 | const byId = new Map(repos.map((r) => [r.id, r])); |
| 52 | 56 | const pulls = joinMany(db, listOpenPullsOf(db, ids)).flatMap((pull) => { |
| 53 | 57 | const repo = byId.get(pull.repoId); |
| @@ -58,7 +62,7 @@ export function clientLines(db: Database, repos: readonly Repo[]): Map<string, s | ||
| 58 | 62 | for (const repo of repos) |
| 59 | 63 | out.set( |
| 60 | 64 | repo.id, |
| 61 | lineFor({ title: doing.get(repo.id)?.title, waitingOnPerson: waiting.has(repo.id), queued: queued.has(repo.id) }), | |
| 65 | lineFor({ title: doing.get(repo.id)?.title, waitingOnPerson: waiting.has(repo.id), queued: queued.has(repo.id), neverRun: !ran.has(repo.id) }), | |
| 62 | 66 | ); |
| 63 | 67 | return out; |
| 64 | 68 | } |
src/actions/client_next.ts added +25
| @@ -0,0 +1,25 @@ | ||
| 1 | /** | |
| 2 | * The next steps under a client's apps (#14483), worded once for both doors: the page draws them | |
| 3 | * as buttons, the terminal as keys. Inviting is a forge admin's alone (`actions/invites.ts`), so | |
| 4 | * anyone else is not offered it: no button that leads nowhere. | |
| 5 | */ | |
| 6 | ||
| 7 | import type { User } from "../core/users.ts"; | |
| 8 | ||
| 9 | export interface NextStep { | |
| 10 | readonly label: string; | |
| 11 | /** The page it opens. */ | |
| 12 | readonly href: string; | |
| 13 | /** The terminal key. */ | |
| 14 | readonly key: string; | |
| 15 | } | |
| 16 | ||
| 17 | export function clientNextSteps(user: User | undefined): NextStep[] { | |
| 18 | const steps: NextStep[] = [ | |
| 19 | { label: "Ask for a change", href: "/tell", key: "t" }, | |
| 20 | { label: "See what shipped", href: "/changelog", key: "w" }, | |
| 21 | ]; | |
| 22 | if (user?.isAdmin === true && user.kind === "user") | |
| 23 | steps.push({ label: "Invite someone", href: "/admin/limits", key: "i" }); | |
| 24 | return steps; | |
| 25 | } |
src/tui/screens/dashboard.ts +30 −2
| @@ -32,6 +32,9 @@ import { askRepos, askStatus, askStatusLine } from "../../core/ask-status.ts"; | ||
| 32 | 32 | import { AUTONOMY_FAILED_WORDS, firstAsk } from "../../actions/first_ask.ts"; |
| 33 | 33 | import { SAY_SOMETHING_WORDS } from "../../actions/tell_words.ts"; |
| 34 | 34 | import { crewCanRun, crewFirstText } from "../../web/studio/crew_key.ts"; |
| 35 | import { clientNextSteps } from "../../actions/client_next.ts"; | |
| 36 | import { changelogScreen } from "./changelog.ts"; | |
| 37 | import { invitesScreen } from "./invites.ts"; | |
| 35 | 38 | import { clientLines as crewSentences, IDLE_LINE } from "../../actions/client_line.ts"; |
| 36 | 39 | import { lastVisit } from "../../core/home_visit.ts"; |
| 37 | 40 | import { quietFor, quietText } from "../../web/studio/home_empty.ts"; |
| @@ -144,12 +147,21 @@ import { repoScreen } from "./repo.ts"; | ||
| 144 | 147 | import { local } from "./where.ts"; |
| 145 | 148 | import { signInScreen } from "./signin.ts"; |
| 146 | 149 | |
| 147 | /** Rows the list keeps under the figures strip; below it the strip shows fewer figures. */ | |
| 148 | 150 | /** The first line of a new forge's home, as the page's heading and its one box. */ |
| 149 | 151 | const FIRST_TELL_LINE = "What do you want built? t says it to the crew."; |
| 150 | 152 | |
| 153 | /** Rows the list keeps under the figures strip; below it the strip shows fewer figures. */ | |
| 151 | 154 | const FIGURES_ROOM = 6; |
| 152 | 155 | |
| 156 | /** | |
| 157 | * The next steps as keys: `t ask for a change · w see what shipped`, plus `i invite someone` for an | |
| 158 | * admin. | |
| 159 | */ | |
| 160 | const nextStepsLine = (user: Session["user"]): string => | |
| 161 | clientNextSteps(user) | |
| 162 | .map((s) => `${s.key} ${s.label.toLowerCase()}`) | |
| 163 | .join(" · "); | |
| 164 | ||
| 153 | 165 | /** |
| 154 | 166 | * The forge-wide daily ceiling, from config, for the spend figure; the data directory, for the |
| 155 | 167 | * backup's age. |
| @@ -431,6 +443,7 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 431 | 443 | return `${line}${` ${doing}`} ${crew[0]!.toUpperCase()}${crew.slice(1)}.`; |
| 432 | 444 | }); |
| 433 | 445 | if (asked) clientLines = [askStatusLine(asked), ...clientLines]; |
| 446 | clientLines.push(nextStepsLine(f.user)); | |
| 434 | 447 | ctx.invalidate(); |
| 435 | 448 | }; |
| 436 | 449 | |
| @@ -1219,6 +1232,12 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 1219 | 1232 | : clientLines.length > 0 |
| 1220 | 1233 | ? [binding(["t"], "ask for something")] |
| 1221 | 1234 | : []), |
| 1235 | ...(clientLines.length > 0 && !firstTell | |
| 1236 | ? [ | |
| 1237 | binding(["w"], "see what shipped"), | |
| 1238 | ...(clientNextSteps(f.user).some((s) => s.key === "i") ? [binding(["i"], "invite someone")] : []), | |
| 1239 | ] | |
| 1240 | : []), | |
| 1222 | 1241 | ...(clientLive.size > 0 ? [binding(["o"], "open the app")] : []), |
| 1223 | 1242 | ...(exploring() && explored?.next != null |
| 1224 | 1243 | ? [binding(["n"], "more results")] |
| @@ -1264,7 +1283,8 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 1264 | 1283 | body = rest!; |
| 1265 | 1284 | } |
| 1266 | 1285 | if (clientLines.length > 0) { |
| 1267 | const lines = clientLines.slice(0, 5); | |
| 1286 | // The next steps are the last line and always stay. | |
| 1287 | const lines = clientLines.length > 5 ? [...clientLines.slice(0, 4), clientLines.at(-1)!] : clientLines; | |
| 1268 | 1288 | const [strip, rest] = split(body, "v", [len(lines.length), fill(1)]); |
| 1269 | 1289 | lines.forEach((line, i) => |
| 1270 | 1290 | s.text( |
| @@ -1511,6 +1531,14 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 1511 | 1531 | if (repo && clientRepoIds.has(repo.id)) askForSomething(f, ctx, () => screen, repo); |
| 1512 | 1532 | return true; |
| 1513 | 1533 | } |
| 1534 | if (e.key === "w" && f.user && clientLines.length > 0 && !firstTell) { | |
| 1535 | ctx.push(changelogScreen(f, ctx)); | |
| 1536 | return true; | |
| 1537 | } | |
| 1538 | if (e.key === "i" && f.user && clientLines.length > 0 && !firstTell && clientNextSteps(f.user).some((s) => s.key === "i")) { | |
| 1539 | ctx.push(invitesScreen(f, ctx)); | |
| 1540 | return true; | |
| 1541 | } | |
| 1514 | 1542 | if (e.key === "o" && f.user && clientLive.size > 0) { |
| 1515 | 1543 | // The running app under the cursor, as a link the person can open or copy. |
| 1516 | 1544 | const repo = shown()[at("repos").index]; |
src/web/studio/client_home.ts +9
| @@ -6,6 +6,7 @@ | ||
| 6 | 6 | * stay off it; `test/client-home.test.ts` holds the list. |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | import { clientNextSteps as nextSteps } from "../../actions/client_next.ts"; | |
| 9 | 10 | import { clientLines } from "../../actions/client_line.ts"; |
| 10 | 11 | import { lastChangeLine } from "../../story/last_change.ts"; |
| 11 | 12 | import { notePhase, takeSessionTime, timePhase, timePhaseAsync } from "../../core/route_timing.ts"; |
| @@ -68,3 +69,11 @@ export async function clientApps(ctx: Ctx, user: User): Promise<Html> { | ||
| 68 | 69 | notePhase(ctx.request, "render", performance.now() - rendering); |
| 69 | 70 | return shown; |
| 70 | 71 | } |
| 72 | ||
outdated
Both doors: this section has no terminal counterpart in src/tui/. A client in the terminal cannot ask, see what shipped, or invite. Add the screen entry and cover it in the test. |
||
| 73 | /** The next steps under the apps, as buttons; plain words, one door each, no heading. */ | |
outdated
Principle 1: the 'What next?' heading explains what the three buttons already say; drop it or make it the single sentence of purpose. |
||
| 74 | export function clientNextSteps(user: User | undefined): Html { | |
| 75 | const steps = nextSteps(user); | |
| 76 | return html`<div id="client-next" class="bar"> | |
| 77 | ${steps.map((s, i) => btn(s.label, { href: s.href, variant: i === 0 ? "primary" : "outline" }))} | |
outdated
Invite someone -> /admin/limits is admin-only (404 for a non-admin client) and is not where invites are made. Link a door every client can use, or omit the button. Principle 1/8: a button that dead-ends is not plain. |
||
| 78 | </div>`; | |
| 79 | } |
src/web/studio/home.ts +2 −2
| @@ -95,7 +95,7 @@ import { claimedDoor } from "./door_claimed.ts"; | ||
| 95 | 95 | import { readableNotes } from "../../actions/desk.ts"; |
| 96 | 96 | import { deskStrip } from "../desk_strip.ts"; |
| 97 | 97 | import { startedFromLine } from "../started_from.ts"; |
| 98 | import { clientApps } from "./client_home.ts"; | |
| 98 | import { clientApps, clientNextSteps } from "./client_home.ts"; | |
| 99 | 99 | |
| 100 | 100 | /** The events that can change what is on you. */ |
| 101 | 101 | const ON_YOU_LIVE = |
| @@ -326,7 +326,7 @@ export async function studioHome( | ||
| 326 | 326 | // Before the first tell the card is the one box and carries the key line and the composer. |
| 327 | 327 | const firstTell = steps.some((s) => s.key === "tell" && !s.done); |
| 328 | 328 | const lean = html`<h1 class="sr-only">Home</h1> |
| 329 | ${firstSteps} ${address} ${startedFromLine(ctx.app.db, ctx.app.config.dataDir, user)} ${firstTell ? null : composer(ctx, user)} ${apps} ${firstTell ? null : crewKeyCard(ctx)} ${heldLine(ctx, user)} ${focusLine(ctx, user)} ${everydayLine(steps)} | |
| 329 | ${firstSteps} ${address} ${startedFromLine(ctx.app.db, ctx.app.config.dataDir, user)} ${firstTell ? null : composer(ctx, user)} ${apps} ${firstTell ? null : clientNextSteps(user)} ${firstTell ? null : crewKeyCard(ctx)} ${heldLine(ctx, user)} ${focusLine(ctx, user)} ${everydayLine(steps)} | |
| 330 | 330 | <div class="stack"> |
| 331 | 331 | <p class="small muted"> |
| 332 | 332 | <a href="/?all=1">Show everything</a> |
test/client-first-login.test.ts added +69
| @@ -0,0 +1,69 @@ | ||
| 1 | /** | |
The terminal door is asserted by reading dashboard.ts as text. Replace it with a screen-driven test (press w, expect the changelog; assert the steps line; assert no |
||
| 2 | * A client's first login (#14483): apps with a plain crew line, three next steps, no developer | |
| 3 | * words, fast. | |
| 4 | */ | |
| 5 | import { beforeEach, describe, expect, test } from "bun:test"; | |
| 6 | import type { Database } from "bun:sqlite"; | |
| 7 | import { clientLines, FIRST_ASK_LINE, IDLE_LINE } from "../src/actions/client_line.ts"; | |
| 8 | import type { Repo } from "../src/core/repos.ts"; | |
| 9 | import { migrations } from "../src/core/schema.ts"; | |
| 10 | import { openDb } from "../src/kernel/db.ts"; | |
| 11 | import { clientNextSteps as nextSteps } from "../src/actions/client_next.ts"; | |
| 12 | import type { User } from "../src/core/users.ts"; | |
| 13 | import { clientNextSteps } from "../src/web/studio/client_home.ts"; | |
| 14 | ||
| 15 | let db: Database; | |
| 16 | const repo = (id: string): Repo => ({ id }) as Repo; | |
| 17 | ||
| 18 | beforeEach(() => { | |
| 19 | db = openDb(":memory:", migrations); | |
| 20 | db.run("INSERT INTO user (id, username, email, password_hash) VALUES ('u','u','u@x','x')"); | |
| 21 | for (const r of ["fresh", "done"]) db.run("INSERT INTO repo (id, owner_id, name) VALUES (?, 'u', ?)", [r, r]); | |
| 22 | }); | |
| 23 | ||
| 24 | const JARGON = /\b(pull|pulls|branch|branches|commit|commits|CI)\b/i; | |
| 25 | ||
| 26 | describe("the crew line", () => { | |
| 27 | test("an app with no run says it waits for the first ask, never blank", () => { | |
| 28 | const lines = clientLines(db, [repo("fresh")]); | |
| 29 | expect(lines.get("fresh")).toBe(FIRST_ASK_LINE); | |
| 30 | expect(FIRST_ASK_LINE).toBe("Waiting for your first ask"); | |
| 31 | }); | |
| 32 | ||
| 33 | test("an app whose runs are over says nothing is in progress", () => { | |
| 34 | db.run("INSERT INTO run (id, repo_id, kind, state) VALUES ('r1','done','agent','ok')"); | |
| 35 | expect(clientLines(db, [repo("done")]).get("done")).toBe(IDLE_LINE); | |
| 36 | }); | |
| 37 | ||
| 38 | test("no line uses the jargon", () => { | |
| 39 | for (const line of clientLines(db, [repo("fresh"), repo("done")]).values()) expect(line).not.toMatch(JARGON); | |
| 40 | }); | |
| 41 | }); | |
| 42 | ||
| 43 | const person = (isAdmin: boolean) => ({ isAdmin, kind: "user" }) as User; | |
| 44 | ||
| 45 | describe("the next steps", () => { | |
| 46 | test("a client is offered two buttons, no heading, no dead end", () => { | |
| 47 | const out = String(clientNextSteps(person(false))); | |
| 48 | expect(out).toContain("Ask for a change"); | |
| 49 | expect(out).toContain("See what shipped"); | |
| 50 | expect(out).not.toContain("Invite"); | |
| 51 | expect(out).not.toContain("/admin/limits"); | |
| 52 | expect(out).not.toContain("What next"); | |
| 53 | expect(out.replace(/<[^>]*>/g, " ")).not.toMatch(JARGON); | |
| 54 | }); | |
| 55 | ||
| 56 | test("an admin is also offered Invite someone", () => { | |
| 57 | const out = String(clientNextSteps(person(true))); | |
| 58 | expect(out).toContain("Invite someone"); | |
| 59 | expect(out.match(/href=/g)?.length).toBe(3); | |
| 60 | }); | |
| 61 | ||
| 62 | test("the terminal is handed the same steps as keys (driven on the screen in client-home.test.ts)", () => { | |
| 63 | expect(nextSteps(person(false)).map((s) => `${s.key} ${s.label}`)).toEqual([ | |
| 64 | "t Ask for a change", | |
| 65 | "w See what shipped", | |
| 66 | ]); | |
| 67 | expect(nextSteps(person(true)).map((s) => s.key)).toEqual(["t", "w", "i"]); | |
| 68 | }); | |
| 69 | }); |
test/client-home.test.ts +64 −4
| @@ -176,7 +176,7 @@ describe("a client's first screen", () => { | ||
| 176 | 176 | const home = main(await page(owner)); |
| 177 | 177 | const apps = home.slice(home.indexOf('id="client-apps"')); |
| 178 | 178 | expect(apps).toContain('href="/marias/bakery"'); |
| 179 | expect(apps).toContain('client-app-line"><b>Nothing in progress</b>'); | |
| 179 | expect(apps).toContain('client-app-line"><b>Waiting for your first ask</b>'); | |
| 180 | 180 | expect(apps).not.toContain("agents are"); |
| 181 | 181 | expect(apps).not.toContain("Working on"); |
| 182 | 182 | expect(words(apps)).not.toMatch(/\b(pull|check|run|gate)\b/i); |
| @@ -302,7 +302,7 @@ describe("a client's first screen", () => { | ||
| 302 | 302 | ); |
| 303 | 303 | stopped.app.start(); |
| 304 | 304 | await settleApp(stopped.app); |
| 305 | expect(stopped.app.screen.toText()).toContain("bakery: Nothing in progress"); | |
| 305 | expect(stopped.app.screen.toText()).toContain("bakery: Waiting for your first ask"); | |
| 306 | 306 | expect(stopped.app.screen.toText()).not.toContain("running"); |
| 307 | 307 | idle.feed("o"); |
| 308 | 308 | await settleApp(stopped.app); |
| @@ -333,6 +333,57 @@ describe("a client's first screen", () => { | ||
| 333 | 333 | app.stop(); |
| 334 | 334 | }); |
| 335 | 335 | |
| 336 | test("the terminal home ends with the next steps as keys, and w opens what shipped (#14483)", async () => { | |
| 337 | const maria = getUserByName(child.db, "maria")!; | |
| 338 | const open = async (user: typeof maria) => { | |
| 339 | const terminal = headlessTerminal(120, 30); | |
| 340 | const { app } = createForgeApp( | |
| 341 | child, | |
| 342 | { sshUsername: "maria", remoteAddress: "127.0.0.1", fingerprint: "SHA256:t", user }, | |
| 343 | { terminal, exitHooks: false }, | |
| 344 | ); | |
| 345 | app.start(); | |
| 346 | await settleApp(app); | |
| 347 | return { app, terminal }; | |
| 348 | }; | |
| 349 | ||
| 350 | // A client who is not a forge admin (the owner's everyday account): two steps, no `i`, and `i` | |
| 351 | // does nothing. | |
| 352 | const daily = await createUser(child.db, { | |
| 353 | origin: "seed", | |
| 354 | trusted: true, | |
| 355 | username: "mariasteps", | |
| 356 | email: "[email protected]", | |
| 357 | password: PASSWORD, | |
| 358 | }); | |
| 359 | if (!daily.ok) throw new Error(JSON.stringify(daily.error)); | |
| 360 | linkEveryday(child.db, maria, daily.value); | |
| 361 | expect(daily.value.isAdmin).toBe(false); | |
| 362 | const client = await open(daily.value); | |
| 363 | const shown = client.app.screen.toText(); | |
| 364 | const steps = shown.split("\n").filter((l) => l.includes("t ask for a change")); | |
| 365 | expect(steps.length).toBe(1); | |
| 366 | expect(steps[0]!.trim()).toBe("t ask for a change · w see what shipped"); | |
| 367 | expect(shown).not.toContain("i invite someone"); | |
| 368 | client.terminal.feed("i"); | |
| 369 | await settleApp(client.app); | |
| 370 | expect(client.app.screen.toText()).not.toContain("Invite links"); | |
| 371 | client.terminal.feed("w"); | |
| 372 | await settleApp(client.app); | |
| 373 | expect(client.app.screen.toText()).toContain("Changelog"); | |
| 374 | expect(client.app.screen.toText()).not.toContain("t ask for a change"); | |
| 375 | client.app.stop(); | |
| 376 | ||
| 377 | // A forge admin gets the third step, and `i` opens the invite links. | |
| 378 | expect(maria.isAdmin).toBe(true); | |
| 379 | const admin = await open(maria); | |
| 380 | expect(admin.app.screen.toText()).toContain("t ask for a change · w see what shipped · i invite someone"); | |
| 381 | admin.terminal.feed("i"); | |
| 382 | await settleApp(admin.app); | |
| 383 | expect(admin.app.screen.toText()).toContain("Invite links"); | |
| 384 | admin.app.stop(); | |
| 385 | }); | |
| 386 | ||
| 336 | 387 | |
| 337 | 388 | /** |
| 338 | 389 | * A running agent run on an open issue of the bakery: the one thing the sentence says it builds. |
| @@ -379,6 +430,15 @@ describe("a client's first screen", () => { | ||
| 379 | 430 | expect(text).not.toMatch(new RegExp(`\\b${word}`, "i")); |
| 380 | 431 | }); |
| 381 | 432 | |
| 433 | test("three next steps sit below the apps, and the first page has no jargon", async () => { | |
| 434 | const raw = await page(owner); | |
| 435 | const home = main(raw); | |
| 436 | expect(home.indexOf('id="client-next"')).toBeGreaterThan(home.indexOf('id="client-apps"')); | |
| 437 | const text = words(raw); | |
| 438 | for (const label of ["Ask for a change", "See what shipped", "Invite someone"]) expect(text).toContain(label); | |
| 439 | for (const word of ["pull", "branch", "commit", "CI"]) expect(text).not.toMatch(new RegExp(`\\b${word}`, "i")); | |
| 440 | }); | |
| 441 | ||
| 382 | 442 | test("asked for, the whole home is still there", async () => { |
| 383 | 443 | const home = await page(owner, "/?all=1"); |
| 384 | 444 | expect(home).toContain('id="lane-building"'); |
| @@ -472,7 +532,7 @@ describe("a client's first screen", () => { | ||
| 472 | 532 | ); |
| 473 | 533 | app.start(); |
| 474 | 534 | await settleApp(app); |
| 475 | expect(app.screen.toText()).toContain("bakery: Nothing in progress."); | |
| 535 | expect(app.screen.toText()).toContain("bakery: Waiting for your first ask."); | |
| 476 | 536 | expect(app.screen.toText()).toMatch(/Atlas is ready to work toward Run Maria/); |
| 477 | 537 | expect(app.screen.toText()).not.toContain("Shipped per hour"); |
| 478 | 538 | app.stop(); |
| @@ -554,7 +614,7 @@ describe("a client's first screen", () => { | ||
| 554 | 614 | |
| 555 | 615 | test("a quiet app gets no extra line", async () => { |
| 556 | 616 | clean(); |
| 557 | expect(await row()).toContain("Nothing in progress"); | |
| 617 | expect(await row()).toContain("Waiting for your first ask"); | |
| 558 | 618 | }); |
| 559 | 619 | |
| 560 | 620 | test("work running now reads Working on, escaped", async () => { |
test/client-line.test.ts +2 −2
| @@ -18,13 +18,13 @@ beforeEach(() => { | ||
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | 20 | describe("the sentence", () => { |
| 21 | test("a running app says Building, an idle one says Nothing in progress, in words a client reads", () => { | |
| 21 | test("a running app says Building, an app never asked says Waiting for your first ask, in words a client reads", () => { | |
| 22 | 22 | db.run("INSERT INTO issue (id, repo_id, number, kind, title, author_id, state) VALUES ('i1','busy',1,'issue','the booking form (see PR #42)','u','open')"); |
| 23 | 23 | db.run("INSERT INTO run (id, repo_id, kind, state, issue_id) VALUES ('r1','busy','agent','running','i1')"); |
| 24 | 24 | db.run("INSERT INTO run (id, repo_id, kind, state) VALUES ('r2','next','agent','queued')"); |
| 25 | 25 | const lines = clientLines(db, [repo("busy"), repo("idle"), repo("next")]); |
| 26 | 26 | expect(lines.get("busy")).toBe("Building: the booking form"); |
| 27 | expect(lines.get("idle")).toBe("Nothing in progress"); | |
| 27 | expect(lines.get("idle")).toBe("Waiting for your first ask"); | |
| 28 | 28 | expect(lines.get("next")).toBe(QUEUED_LINE); |
| 29 | 29 | for (const line of lines.values()) expect(line).not.toMatch(/\b(pull|check|run|gate)\b/i); |
| 30 | 30 | }); |
Good shared module. Add that a client sees two steps on purpose to the feature doc, since the issue says three.