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

Asks and crew answers fold into the core: what waits for a person is a state on an issue or pull, shown where that issue or pull already is #13838

Merged opened this in answer to

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

Merged

mason/forge:mason/13787-asks-and-crew-answers-fold-into-the-core → main 10 commits fork 4 threads · 4 unresolved

  • Merged. mason/13787-asks-and-crew-answers-fold-into-the-core was merged into main as 4c0950c.

Review

Sign in to review this change.
59 files changed +405 −224
AGENTS.md +2
@@ -55,4 +55,6 @@ The capacity setting `children.awake` (boot default `FORGE_CHILD_AWAKE_MAX`) cou
5555
5656 An app token's requests go behind people's and repeat reads are 304s (`src/http/app_turn.ts`, `repeat_reads.ts`, `perf/asking.ts`): see `docs/features/app-asking.md`.
5757 `src/core/reports.ts`: `closedSet`, the ids of repositories whose owner closed reports from outside (#12321), read once per database and kept by `setReportsClosed`, the only writer, so every repository page's head link costs no statement; at most one id per closed repository, gone on restart (the rows are `report_closed`). `src/core/contribute_token.ts`: `openSet`, the ids of repositories that allow outside agents, read once per database and kept by `setContributeOpen`, the only writer, at most one id per allowing repository, gone on restart; a raw SQL write to `contribute_open` bypasses it. The terminal door for reports is `r` on the outside agents screen (`setOutsideReports`, admins).
58
59 `src/web/studio/waiting_on_me.ts`: `waitingRows`, each viewer's issues and pulls that wait for them, held 10 seconds per viewer (at most 500 viewers, gone on restart) so the board's live lanes share one `decisionsFor` read; the terminal door is `src/tui/screens/waiting_for_me.ts` (palette entry for any person).
5860 `src/crew/beat.ts`: `lastBeat`, when each repository's beat last ran, and `declared`, the `beat` last read from each default branch with the commit it came from (#13709); at most one entry each per repository, gone on restart (a restart beats once at once; the declaration is a file in git).
docs/features/README.md +1
@@ -146,6 +146,7 @@ Read with the guide page [Tell the crew](../guide-tell-the-crew.md).
146146 - [Everyone with an account, last seen first](people.md)
147147 - [Hold new work on a file](file-holds.md)
148148 - [Maintenance duties](maintain.md)
149 - [See what waits for you: /?waits=me, and the terminal's Waiting for me](waits-for-me.md)
149150 - [Preview data of pulls closed over seven days](preview-dirs.md)
150151 - [Muting from the inbox keeps you in place](asks-mute-undo.md)
151152 - [Next up](next-up.md)
docs/features/waits-for-me.md added +14
@@ -0,0 +1,14 @@
1 # See what waits for you (#13787)
2
3 - **On the board.** Open `/?waits=me` (the header's "Waiting" link, the chord `g q`, the
4 manifest shortcut) or press "Waiting for me" beside the app filter. The board shows only the
5 cards that wait for you; press "Waiting for me · show all" to leave it. Live lane updates carry the filter.
6 - **In the terminal.** The palette's "Waiting for me" lists the same issues and pulls with what
7 each waits for; `W` on the dashboard opens the board view on the web.
8 - **One read.** Both use `waitingRows` in `web/studio/waiting_on_me.ts`, the same
9 `decisionsFor` read the pull page's status line uses. It is held 10 seconds per viewer, and a lane's
10 ETag carries a digest of the set, so a change is never answered 304.
11 - **`/asks`** redirects to the board view. A step answered there (a bulk receipt, a mute, a
12 hand-over) still lands on the list it answered, once.
13 - **Standing still** (a repository behind its pulls, an app turned off a moment ago, runs the
14 host gave up on) is on `/apps`.
src/actions/talk_decisions.ts +2 −2
@@ -38,7 +38,7 @@ export function asksWhatNeedsMe(text: string): boolean {
3838 */
3939 export function actionHref(d: Decision): string {
4040 const base = repoBase(d.repo);
41 if (d.kind === "proposal") return "/asks";
41 if (d.kind === "proposal") return "/?waits=me";
4242 return d.pull !== undefined ? changeHref(base, d.pull.number) : d.issue !== undefined ? `${base}/issues/${d.issue.number}` : `${base}/settings/autonomy`;
4343 }
4444
@@ -62,6 +62,6 @@ export function decisionsAnswer(app: App, user: User): string {
6262 const thing = d.pull?.title ?? d.issue?.title ?? d.proposal?.title ?? d.repo.name;
6363 return `${i + 1}. [${plain(thing)}](${actionHref(d)}) — ${plain(d.short)}. **${primaryLabel(d)}**`;
6464 });
65 const more = rows.length > shown.length ? `\n\n[${rows.length - shown.length} more in your inbox](/asks)` : "";
65 const more = rows.length > shown.length ? `\n\n[${rows.length - shown.length} more in your inbox](/?waits=me)` : "";
6666 return `${rows.length === 1 ? "One thing waits" : `${rows.length} things wait`} on you:\n\n${lines.join("\n")}${more}`;
6767 }
src/flow/lanes.ts +6 −1
@@ -399,12 +399,16 @@ export interface Viewing {
399399 readonly repos: readonly string[];
400400 }
401401
402 /** The picture filtered for `viewer`, and to `only` (an `owner/name`) when the filter is set. */
402 /**
403 * The picture filtered for `viewer`, to `only` (an `owner/name`) when the filter is set, and to the
404 * cards in `waiting` (keys `repoId#number`) when they are those that wait for the viewer.
405 */
403406 export function viewFor(
404407 db: Database,
405408 viewer: User,
406409 picture: LanePicture,
407410 only: string | null = null,
411 waiting?: ReadonlySet<string>,
408412 ): Viewing {
409413 const ids = new Set<string>();
410414 for (const k of LANES)
@@ -433,6 +437,7 @@ export function viewFor(
433437 const full = `${repo.ownerName}/${repo.name}`;
434438 seen.add(full);
435439 if (only !== null && full !== only) continue;
440 if (waiting !== undefined && (i.number === null || !waiting.has(`${i.repoId}#${String(i.number)}`))) continue;
436441 const base = `/${repo.ownerName}/${repo.name}`;
437442 const href =
438443 i.number === null
src/http/server.ts +2 −2
@@ -349,7 +349,7 @@ import {
349349 asksListen,
350350 asksMute,
351351 asksFilter,
352 asksPage,
352 asksMoved,
353353 } from "../web/studio/asks_page.ts";
354354 import { keeperAnswer } from "../web/studio/keeper_row.ts";
355355 import { homeArchive, homeArchived, homeArchiveUndo } from "../web/studio/home_archive.ts";
@@ -1029,7 +1029,7 @@ export function buildRouter(): Router<Handler> {
10291029 // The board's tokens line, opened: what the spend bought (core/returns.ts).
10301030 router.add("GET", "/board/returns", returnsPage);
10311031 // One screen for "is everything fine?": what asks the viewer (docs/STUDIO.md).
1032 router.add("GET", "/asks", asksPage);
1032 router.add("GET", "/asks", asksMoved);
10331033 router.add("POST", "/asks/bulk", asksBulkSubmit);
10341034 router.add("POST", "/asks/bulk/:id/undo", asksBulkUndo);
10351035 router.add("POST", "/asks/listen", asksListen);
src/tui/screens/dashboard.ts +1 −1
@@ -1464,7 +1464,7 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen {
14641464 return true;
14651465 }
14661466 if (e.key === "W" && asksLine !== undefined) {
1467 openOnWeb(f, ctx, "/asks", "Asks");
1467 openOnWeb(f, ctx, "/?waits=me", "Waiting");
14681468 return true;
14691469 }
14701470 if (e.key === "A" && f.user) {
src/tui/screens/entries.ts +2
@@ -71,6 +71,7 @@ import { entry as footing } from "./footing.ts";
7171 import { entry as maintenanceWeek } from "./maintenanceweek.ts";
7272 import { entry as offsite } from "./offsite.ts";
7373 import { entry as waiting } from "./waiting.ts";
74 import { entry as waitingForMe } from "./waiting_for_me.ts";
7475 import { entry as slowPagesEntry } from "./slowpages.ts";
7576 import { entry as maintenance } from "./maintenance.ts";
7677 import { entry as maintainRuns } from "./maintainruns.ts";
@@ -146,6 +147,7 @@ export const ENTRIES: readonly PaletteEntry[] = [
146147 maintenanceWeek,
147148 offsite,
148149 waiting,
150 waitingForMe,
149151 slowPagesEntry,
150152 telemetry,
151153 resilience,
src/tui/screens/waiting_for_me.ts added +55
@@ -0,0 +1,55 @@
1 /**
2 * Waiting for me, from the palette: the issues and pulls that wait for the signed-in person,
3 * the same `waitingRows` read the board's `/?waits=me` filters its cards by. Read-only; a row
4 * says where it is, so the person opens it from its repository.
5 */
6
7 import { waitingRows, type WaitingRow } from "../../web/studio/waiting_on_me.ts";
8 import type { Ctx, Screen } from "../app/app.ts";
9 import { binding } from "../app/keys.ts";
10 import type { Session } from "../session.ts";
11 import { style } from "../term/style.ts";
12 import { Scroll, drawLines, hitScroll } from "./common.ts";
13 import type { PaletteEntry } from "./entries.ts";
14
15 const mayRead = (session: Session): boolean => session.user !== undefined && session.user.kind !== "agent";
16
17 /** The rows as text lines: one per card, "owner/name#7 title" then what it waits for. */
18 export function waitingForMeLines(rows: readonly WaitingRow[]): string[] {
19 return rows.flatMap((r) => [`${r.repo}#${String(r.number)} ${r.kind === "pull" ? "pull" : "issue"}: ${r.title}`, ` ${r.short}`]);
20 }
21
22 export function waitingForMeScreen(ctx: Ctx, rows: readonly WaitingRow[]): Screen {
23 const scroll = new Scroll();
24 const lines = rows.length === 0 ? ["Nothing waits for you."] : waitingForMeLines(rows);
25 return {
26 title: "Waiting for me",
27 keys: [binding(["j", "k"], "scroll"), binding(["esc", "q"], "back")],
28 render(area, s) {
29 const c = ctx.theme.c;
30 const spans = lines.map((text) => [{ text, style: style(text.startsWith(" ") || rows.length === 0 ? c.mutedFg : c.fg, c.bg) }]);
31 drawLines(s, area, c, scroll, spans);
32 hitScroll(ctx, area, scroll, lines.length);
33 },
34 key(e) {
35 if (scroll.key(e, lines.length)) return true;
36 if (e.key === "esc" || e.key === "q") {
37 ctx.pop();
38 return true;
39 }
40 return false;
41 },
42 };
43 }
44
45 export const entry: PaletteEntry = {
46 id: "waiting-for-me",
47 title: "Waiting for me",
48 hint: "issues and pulls that wait for you",
49 after: ["pulls-to-land", "flow"],
50 offered: mayRead,
51 run: (session, ctx) => {
52 if (session.user === undefined) return;
53 ctx.push(waitingForMeScreen(ctx, waitingRows({ app: session.app, auth: { user: session.user } }, session.user)));
54 },
55 };
src/web/go_pages.ts +1 −1
@@ -28,7 +28,7 @@ export const GO_PAGES: readonly GoPage[] = [
2828 { name: "Board", href: "/board", who: "user" },
2929 { name: "Boards", href: "/boards", who: "admin", palette: "Boards" },
3030 { name: "Flow", href: "/flow", who: "admin", key: "f" },
31 { name: "Asks", href: "/asks", who: "user", key: "q" },
31 { name: "Waiting", href: "/?waits=me", who: "user", key: "q" },
3232 { name: "Asked", href: "/asked", who: "user", palette: "What you asked for" },
3333 { name: "Notes", href: "/notes", who: "user", palette: "Notes" },
3434 { name: "Talk", href: "/talk", who: "user", key: "t", palette: "Talk to the forge" },
src/web/layout.ts +1 −1
@@ -714,7 +714,7 @@ function topbar(
714714 <span class="topbar-tools">
715715 ${tools ?? html`${searchBar()}
716716 ${user
717 ? html`${talkButton(ctx, user, about)}<a class="small" href="/asks" data-shortcut="g q" ${hintAttr("g q")}>Asks</a
717 ? html`${talkButton(ctx, user, about)}<a class="small" href="/?waits=me" data-shortcut="g q" ${hintAttr("g q")}>Waiting</a
718718 >${newMenu(ctx)}${userMenu(
719719 ctx,
720720 user,
src/web/pages/apps.ts +2
@@ -12,6 +12,7 @@
1212 * 404 for everyone.
1313 */
1414
15 import { appsStanding } from "../studio/standing.ts";
1516 import { stepsOf } from "../../core/review_steps.ts";
1617 import { USERNAME_PATTERN } from "../username_pattern.ts";
1718 import { sshOn } from "../../settings/ssh.ts";
@@ -258,6 +259,7 @@ export async function appsList(ctx: Ctx): Promise<Response> {
258259 sub: APPS_PURPOSE,
259260 })}
260261 ${cost}
262 ${when(ctx.auth.user, (user) => appsStanding(ctx, user))}
261263 ${filters}
262264 ${archivedView
263265 ? html`<p class="muted small mb"><a href="/apps">Back to apps</a></p>`
src/web/pages/board.ts +2 −2
@@ -484,7 +484,7 @@ function reviewNotes(ctx: Ctx, scope: BoardScope): Note[] {
484484 {
485485 key: `review:${w.repo.id}`,
486486 need: true,
487 line: html`<a data-need href="/asks"
487 line: html`<a data-need href="/?waits=me"
488488 >${dot("attn")} <b>${w.repo.name}</b>: ${w.none ? "No reviewer: agent pulls wait for you" : w.paused ? "The reviewer is paused: agent pulls wait for you" : "agent pulls wait for your review"}${w.waiting === 0 || w.since === null
489489 ? null
490490 : html` · <b>${w.waiting}</b> waiting since ${w.since.slice(0, 10)}`}</a
@@ -507,7 +507,7 @@ function asksStrip(ctx: Ctx): Html | null {
507507 if (!user) return null;
508508 const m = askMeasureWeek(ctx.app.db, user.id);
509509 if (asksMeasureEmpty(m)) return null;
510 return html`<a class="muted small" id="asks-measure" href="/asks"
510 return html`<a class="muted small" id="asks-measure" href="/?waits=me"
511511 >Asks, ${ASKS_WINDOW_DAYS} days: ${asksMeasureParts(m).map(
512512 (p, i) => html`${i === 0 ? "" : " · "}<b>${p.n}</b> ${p.label}`,
513513 )}</a
src/web/pages/home_flow.ts +29 −24
@@ -56,9 +56,8 @@ import { parseTable, tableParams, tableRows, type TableQuery } from "../../flow/
5656 import { TABLE_LIVE, tableRegion, tableTag, tableTools } from "./home_table.ts";
5757 import { readableNotes } from "../../actions/desk.ts";
5858 import { deskStrip } from "../desk_strip.ts";
59 import { heldLine } from "../studio/held.ts";
60 import { interruptedOutLine } from "../studio/interrupted_out.ts";
61 import { listReposWritableTo } from "../../core/repos.ts";
59 import { askedSection } from "../studio/standing.ts";
60 import { waitingOnMe, waitsDigest } from "../studio/waiting_on_me.ts";
6261 import { chart, figuresGrid, figuresSection } from "./home_figures.ts";
6362 import { tellBox } from "../studio/living.ts";
6463 import { requestsCard } from "../requests_card.ts";
@@ -93,7 +92,10 @@ const filterOf = (url: URL): string | null => {
9392 return APP_SLUG.test(v) ? v : null;
9493 };
9594
96 const query = (only: string | null): string => (only === null ? "" : `&app=${encodeURIComponent(only)}`);
95 const query = (only: string | null, mine = false): string => `${only === null ? "" : `&app=${encodeURIComponent(only)}`}${mine ? "&waits=me" : ""}`;
96
97 /** `?waits=me`: only the cards that wait for this person (what `/asks` used to list). */
98 const waitsOf = (url: URL): boolean => url.searchParams.get("waits") === "me";
9799
98100 /**
99101 * A stretch of time as a clock the page keeps: the words the server uses, redrawn by the page's
@@ -162,6 +164,7 @@ export function laneRegion(
162164 only: string | null,
163165 _admin: boolean,
164166 now: number,
167 mine = false,
165168 ): Html {
166169 const key = view.key;
167170 const shown = view.items.length;
@@ -180,7 +183,7 @@ export function laneRegion(
180183 data-count="${String(view.total)}"
181184 aria-label="${label}"
182185 data-live="${LANE_LIVE[key]}"
183 data-live-src="/live/lane?s=${key}${query(only)}"
186 data-live-src="/live/lane?s=${key}${query(only, mine)}"
184187 ${scope}
185188 >
186189 <header class="lane-head">
@@ -275,14 +278,14 @@ const things = (n: number, one: string, many: string): string => `${String(n)} $
275278
276279 /**
277280 * The one line, in the page's header: how many things are broken about the forge and how many
278 * people are stopped, each count a link to its list on `/asks`. Nothing at all when there is
279 * nothing: a healthy forge's home opens on its lanes.
281 * people are stopped, the problems link to the system page and the people to the board's "waiting
282 * for me" view. Nothing at all when there is nothing: a healthy forge's home opens on its lanes.
280283 */
281284 export function needLine(broken: readonly { says: string; href: string }[], asked: number): Html | null {
282285 if (broken.length === 0 && asked === 0) return null;
283286 return html`<p class="hf-need" id="hf-need" role="status"><span class="dot" data-tone="${broken.length === 0 ? "attn" : "danger"}"></span>${
284 broken.length === 0 ? null : html`<a href="/asks#forge-broken">${things(broken.length, "problem", "problems")} with the forge</a><span class="hf-need-first">${broken[0]!.says}</span>`
285 }${asked === 0 ? null : html`<a href="/asks#asked">${things(asked, "person is", "people are")} stopped until you answer</a>`}</p>`;
287 broken.length === 0 ? null : html`<a href="/system">${things(broken.length, "problem", "problems")} with the forge</a><span class="hf-need-first">${broken[0]!.says}</span>`
288 }${asked === 0 ? null : html`<a href="/?waits=me">${things(asked, "person is", "people are")} stopped until you answer</a>`}</p>`;
286289 }
287290
288291 /**
@@ -444,7 +447,7 @@ export async function forgesRegion(app: App, wait: boolean): Promise<Html> {
444447 * opened, so no list of them is written out as text.
445448 * Without scripts, an app's `owner/name` is typed.
446449 */
447 function filterForm(repos: readonly string[], only: string | null): Html {
450 function filterForm(repos: readonly string[], only: string | null, mine = false): Html {
448451 return html`<form class="hf-filter" method="get" action="/" id="hf-filter">
449452 <label class="hf-filter-label" for="hf-app">Show</label>
450453 <select class="input" id="hf-app" aria-label="Show one app, or everything" data-apps="${repos.join(",")}">
@@ -452,7 +455,9 @@ function filterForm(repos: readonly string[], only: string | null): Html {
452455 ${only === null ? null : html`<option value="${only}" selected>${only}</option>`}
453456 </select>
454457 <noscript><input class="input" name="app" placeholder="owner/name" aria-label="An app, as owner/name" /><button class="btn" type="submit">Show</button></noscript>
455 </form>`;
458 ${mine ? html`<input type="hidden" name="waits" value="me" />` : null}
459 </form>
460 <a class="small" id="hf-waits" href="/?view=lanes${mine ? "" : "&waits=me"}${only === null ? "" : `&app=${encodeURIComponent(only)}`}" ${mine ? html`aria-current="true"` : null}>${mine ? "Waiting for me · show all" : "Waiting for me"}</a>`;
456461 }
457462
458463 /**
@@ -486,10 +491,11 @@ export async function homeFlowPage(ctx: Ctx, known?: { readonly spawned: Awaited
486491 if (user === undefined) return signInFirst(ctx);
487492 const { view, asked } = viewOf(ctx);
488493 const only = filterOf(ctx.url);
494 const mine = waitsOf(ctx.url);
489495 const now = Date.now();
490496 const picture = await timePhaseAsync(ctx.request, "picture", () => lanePicture(ctx.app.db, optionsOf(ctx), "page", now));
491497 const rendering = performance.now();
492 const viewing = picture === undefined ? undefined : timePhase(ctx.request, "viewing", () => viewFor(ctx.app.db, user, picture, view === "table" ? null : only));
498 const viewing = picture === undefined ? undefined : timePhase(ctx.request, "viewing", () => viewFor(ctx.app.db, user, picture, view === "table" ? null : only, mine ? waitingOnMe(ctx, user) : undefined));
493499 // A spawned forge's owner is a client: the forge-wide figures are not theirs to see, whole home
494500 // or lean.
495501 const spawned = known !== undefined ? known.spawned : await timePhaseAsync(ctx.request, "spawned", () => spawnedForge(ctx.app));
@@ -506,12 +512,9 @@ export async function homeFlowPage(ctx: Ctx, known?: { readonly spawned: Awaited
506512 ${spawned === undefined ? firstWeekBlock(ctx.app.db, user) : null}
507513 <div class="hf-tell">${tellBox(ctx, user)}</div>`;
508514 // A client who asked for the whole home (`?all=1`) has a way back to their apps.
509 const after = html`${ctx.url.searchParams.has("all") ? html`<p class="small muted" id="lean-home"><a href="/">Just my apps</a></p>` : null}${requestsCard(ctx, "home")}${timePhase(ctx.request, "held", () => heldLine(ctx, user))}
515 const after = html`${ctx.url.searchParams.has("all") ? html`<p class="small muted" id="lean-home"><a href="/">Just my apps</a></p>` : null}${requestsCard(ctx, "home")}
510516 ${spawned?.url === undefined ? null : html`<p class="small muted" id="forge-address">Your forge: <a href="${spawned.url}">${new URL(spawned.url).host}</a></p>`}
511517 ${startedFromLine(ctx.app.db, ctx.app.config.dataDir, user)}`;
512 // A run the host stopped is named, with its way to try again, while it is within the day: the one
513 // place the web offers that.
514 const stopped = user.kind === "agent" ? null : timePhase(ctx.request, "stopped", () => interruptedOutLine(ctx, listReposWritableTo(ctx.app.db, user, { withoutArchived: true, limit: 200 })));
515518 const forges = wide ? await timePhaseAsync(ctx.request, "forges", () => forgesRegion(ctx.app, false)) : null;
516519 let main: Html;
517520 const q = parseTable(ctx.url.searchParams);
@@ -520,7 +523,7 @@ export async function homeFlowPage(ctx: Ctx, known?: { readonly spawned: Awaited
520523 } else if (view === "table") {
521524 main = html`${tableTools(q)}${tableRegion(tableRows(viewing, tableInput(picture, now)), q, now)}`;
522525 } else {
523 main = html`<div class="hf-lanes">${LANES.map((k) => laneRegion(viewing.lanes[k], healthOf(viewing.lanes[k], picture, now), only, user.isAdmin, now))}</div>`;
526 main = html`<div class="hf-lanes">${LANES.map((k) => laneRegion(viewing.lanes[k], healthOf(viewing.lanes[k], picture, now), only, user.isAdmin, now, mine))}</div>`;
524527 }
525528 const body = html`<div class="hf" id="hf" data-view="${view}">
526529 <header class="hf-head">
@@ -529,14 +532,14 @@ export async function homeFlowPage(ctx: Ctx, known?: { readonly spawned: Awaited
529532 <p class="hf-live muted" id="hf-live" data-state="connecting"><span class="dot"></span><span class="hf-live-text">Updates as it happens</span></p>
530533 </div>
531534 ${viewSwitch(view, only)}
532 ${view === "lanes" ? filterForm(viewing?.repos ?? [], only) : null}
535 ${view === "lanes" ? filterForm(viewing?.repos ?? [], only, mine) : null}
533536 ${need}
534537 </header>
538 ${mine ? askedSection(ctx, user) : null}
535539 ${main}
536540 ${before}
537541 ${strip}
538542 ${deskStrip(ctx.app.db, readableNotes(ctx.app, ctx.auth.user))}
539 ${stopped}
540543 ${after}
541544 ${wide ? figuresSection(picture, now) : null}
542545 ${forges}
@@ -587,9 +590,9 @@ export async function liveTableFragment(ctx: Ctx): Promise<Response> {
587590 * and this filter, and the minute (its ages are in
588591 * minutes). A lane that has not changed answers 304 without being drawn.
589592 */
590 function laneTag(picture: LanePicture, key: LaneKey, viewer: string, only: string | null, now: number): string {
593 function laneTag(picture: LanePicture, key: LaneKey, viewer: string, only: string | null, now: number, mine = ""): string {
591594 const b = picture.builders;
592 return Bun.hash(`${picture.versions[key]}|${picture.moved[key]}|${b.running}/${b.slots}|${viewer}|${only ?? ""}|${Math.floor(now / 60_000)}`).toString(36);
595 return Bun.hash(`${picture.versions[key]}|${picture.moved[key]}|${b.running}/${b.slots}|${viewer}|${only ?? ""}|${mine}|${Math.floor(now / 60_000)}`).toString(36);
593596 }
594597
595598 // GET /live/lane?s=<lane>[&app=owner/name] — one lane alone, for the region that shows it.
@@ -606,14 +609,16 @@ export async function liveLaneFragment(ctx: Ctx): Promise<Response> {
606609 const picture = await timePhaseAsync(ctx.request, "picture", () => lanePicture(ctx.app.db, optionsOf(ctx), "lane", now));
607610 const rendering = performance.now();
608611 if (picture === undefined) return fragment(readingLane(key, only), { request: ctx.request });
609 const tag = laneTag(picture, key, user.isAdmin ? "admin" : user.id, only, now);
612 const mine = waitsOf(ctx.url);
613 const waits = mine ? waitingOnMe(ctx, user) : undefined;
614 const tag = laneTag(picture, key, user.isAdmin ? "admin" : user.id, only, now, waits === undefined ? "" : waitsDigest(waits));
610615 if (ctx.request.headers.get("if-none-match") === `"${tag}"`) {
611616 notePhase(ctx.request, "render", performance.now() - rendering);
612617 return new Response(null, { status: 304, headers: { etag: `"${tag}"`, "cache-control": "no-store" } });
613618 }
614 const viewing = timePhase(ctx.request, "viewing", () => viewFor(ctx.app.db, user, picture, only));
619 const viewing = timePhase(ctx.request, "viewing", () => viewFor(ctx.app.db, user, picture, only, waits));
615620 const view = viewing.lanes[key];
616 const res = fragment(laneRegion(view, healthOf(view, picture, now), only, user.isAdmin, now), { request: ctx.request, etag: tag });
621 const res = fragment(laneRegion(view, healthOf(view, picture, now), only, user.isAdmin, now, mine), { request: ctx.request, etag: tag });
617622 notePhase(ctx.request, "render", performance.now() - rendering);
618623 return res;
619624 }
src/web/pages/pull.ts +5 −4
@@ -1586,15 +1586,16 @@ export async function stuckSubmit(ctx: Ctx): Promise<Response> {
15861586 const form = await readForm(ctx, "rw");
15871587 if (form instanceof Response) return form;
15881588 const choice = field(form, "choice");
1589 // Back to where the form was: the asks page, or this repository's pulls; nothing else is
1589 // Back to where the form was: the apps list, or this repository's pulls; nothing else is
15901590 // honoured, and anything else goes home.
15911591 const next = field(form, "next");
1592 const dest = next === "/asks" || next === `${repoBase(repo)}/pulls` ? next : "/";
1592 const dest = next === "/apps" || next === `${repoBase(repo)}/pulls` ? next : "/";
15931593 if (!isPileChoice(choice)) return flashTo(ctx, dest, { tone: "danger", message: "Choose re-check, hand to builders, close, or turn the app off." });
15941594 const reason = field(form, "reason");
15951595 const done = await takePileChoice(ctx.app, ctx.auth.user, repo.id, choice, reason === "" ? {} : { reason });
1596 // Turned off from /asks, the page comes back with the app's row saying so and the way back on.
1597 if (!("error" in done) && done.choice === "off" && dest === "/asks") return redirect(`/asks?off=${encodeURIComponent(repo.id)}#standing`);
1596 // Turned off from the apps list, the page comes back with the app's row saying so and the way
1597 // back on.
1598 if (!("error" in done) && done.choice === "off" && dest === "/apps") return redirect(`/apps?off=${encodeURIComponent(repo.id)}#standing`);
15981599 return flashTo(
15991600 ctx,
16001601 dest,
src/web/standards.ts +1 −1
@@ -378,7 +378,7 @@ export function webManifest(ctx: Ctx): Response {
378378 // A long-press on the installed icon: what is on the owner, or a
379379 // word with the forge's agents, one tap from the home screen.
380380 shortcuts: [
381 { name: "On you", short_name: "On you", url: "/asks", icons: [{ src: "/icons/forge-192.png", sizes: "192x192", type: "image/png" }] },
381 { name: "On you", short_name: "On you", url: "/?waits=me", icons: [{ src: "/icons/forge-192.png", sizes: "192x192", type: "image/png" }] },
382382 { name: "Talk", short_name: "Talk", url: "/talk", icons: [{ src: "/icons/forge-192.png", sizes: "192x192", type: "image/png" }] },
383383 ],
384384 // The default light theme's ground, read from the theme registry
src/web/studio/asks_page.ts +23 −14
@@ -9,7 +9,7 @@
99
1010 import { askedAsleep, asleepLine, type Asleep } from "../../actions/needs_asleep.ts";
1111 import { UNDO_LABEL, VERB_WORDS } from "../../actions/asks_words.ts";
12 import { notePhase, takeSessionTime, timePhase } from "../../core/route_timing.ts";
12 import { notePhase, timePhase } from "../../core/route_timing.ts";
1313 import type { WaitingFor } from "../../core/waiting_for.ts";
1414 import {
1515 applyAsksBulk,
@@ -49,7 +49,6 @@ import {
4949 ownerFactRepoIds,
5050 } from "../../core/repos.ts";
5151 import { html, type Html } from "../html.ts";
52 import { standingSections } from "./standing.ts";
5352 import { noteLine } from "./note.ts";
5453 import { page, redirect } from "../layout.ts";
5554 import { emptyList } from "../empty_words.ts";
@@ -269,10 +268,13 @@ function here(ctx: Ctx): string {
269268 return ctx.url.pathname === "/asks" && rest !== "" ? `/asks?${rest}` : "/asks";
270269 }
271270
272 /** A `back` worth following after a mute: `/asks` or `/asks?…`, nothing else. */
271 /**
272 * A `back` worth following after a mute: `/asks`, `/asks?…` or the board's `/?waits=me`, nothing
273 * else.
274 */
273275 function asksBack(form: Parameters<typeof backTo>[0]): string {
274276 const back = backTo(form, "/asks");
275 return back === "/asks" || (back.startsWith("/asks?") && !back.includes("#")) ? back : "/asks";
277 return back === "/asks" || back === "/?waits=me" || (back.startsWith("/asks?") && !back.includes("#")) ? back : "/asks";
276278 }
277279
278280 /** The same page with one flash key set, the others cleared. */
@@ -452,14 +454,11 @@ export interface AsksTop {
452454 readonly reason?: string;
453455 }
454456
455 /** GET /asks — what needs you as its own page: the home's section and its
456 * live script; `?op=<id>` (a bulk action's receipt) rides along. */
457 export function asksPage(ctx: Ctx): Response {
458 notePhase(ctx.request, "session", takeSessionTime(ctx.request));
459 return renderAsks(ctx, timePhase(ctx.request, "top", () => homeTop(ctx)));
460 }
461
462 /** The asks page, with a bulk step's preview or receipt on top. */
457 /**
458 * A bulk step's preview or receipt, drawn where the step was answered (the POST's own response):
459 * the asks list with the step on top. There is no GET page for it; `/asks` redirects to the
460 * kanban's "waits for me" view.
461 */
463462 function renderAsks(ctx: Ctx, top: AsksTop | undefined): Response {
464463 const user = ctx.auth.user;
465464 if (!user) return signInFirst(ctx);
@@ -467,14 +466,24 @@ function renderAsks(ctx: Ctx, top: AsksTop | undefined): Response {
467466 const rendering = performance.now();
468467 const response = page({
469468 ctx,
470 title: "Asks",
471 body: html`<div class="stack"><h1 class="sr-only">Asks</h1>${muteFlash(ctx, user)}${onYouRegion(ctx, user, undefined, section.body)}${standingSections(ctx, user)}<p class="small muted"><a href="/review">Review: one row per ask</a></p></div>`,
469 title: "Waiting for you",
470 body: html`<div class="stack"><h1 class="sr-only">Waiting for you</h1>${muteFlash(ctx, user)}${onYouRegion(ctx, user, undefined, section.body)}<p class="small muted"><a href="/?waits=me">Back to the board</a></p></div>`,
472471 scriptJs: `${liveClientJs}\n${liveRegionsJs}\n${section.scriptJs}`,
473472 });
474473 notePhase(ctx.request, "render", performance.now() - rendering);
475474 return response;
476475 }
477476
477 /**
478 * GET /asks — gone as a page: what waits for a person is a state of the cards on the kanban, so it
479 * redirects there. Only an answer to a step taken (a bulk receipt, a mute, a hand-over) still lands
480 * on what it answered.
481 */
482 export function asksMoved(ctx: Ctx): Response {
outdated

backTo only accepts /asks paths, so the '/?waits=me' back value is coerced to /asks and redirected again. Accept the new path.

483 const answers = ["op", "decided", ...FLASH_KEYS].some((k) => ctx.url.searchParams.has(k));
484 return answers ? renderAsks(ctx, homeTop(ctx)) : redirect("/?waits=me");
485 }
486
478487 /** The receipt `?op=<id>` names on the home, when it is the viewer's own. */
479488 export function homeTop(ctx: Ctx): AsksTop | undefined {
480489 const decided = ctx.url.searchParams.get("decided");
src/web/studio/review_page.ts +2 −2
@@ -159,9 +159,9 @@ export function reviewPage(ctx: Ctx): Response {
159159 icon: "issue",
160160 title: "Nothing to review",
161161 note: "When the crew needs a person, it shows up here.",
162 action: html`<a class="btn" href="/asks">All asks</a>`,
162 action: html`<a class="btn" href="/?waits=me">All that wait for you</a>`,
163163 })
164 : html`${listCard(rows)}<p class="small muted">Keys: j / k move, ${key("m", "Merge the focused row", "merge")}, ${key("c", "Close the focused row", "close")}, ${key("r", "Request changes on the focused row", "request changes")} · <a href="/asks">All asks, with their buttons</a></p>`}`;
164 : html`${listCard(rows)}<p class="small muted">Keys: j / k move, ${key("m", "Merge the focused row", "merge")}, ${key("c", "Close the focused row", "close")}, ${key("r", "Request changes on the focused row", "request changes")} · <a href="/?waits=me">All that wait for you, on the board</a></p>`}`;

Indentation of this branch was broken by the edit.

165165 const response = page({ ctx, title: "Review", body, scriptJs: asks.length === 0 ? "" : REVIEW_KEYS_JS });
166166 notePhase(ctx.request, "render", performance.now() - rendering);
167167 return response;
src/web/studio/standing.ts +19 −38
@@ -1,47 +1,25 @@
11 /**
2 * What `/asks` lists that the home page does not draw: the forge's own problems, the people
3 * stopped until this viewer changes a setting, and what stands still (a repository behind its
4 * pulls, an approved pull that has not landed). The home's one line counts the first two and links
5 * here (`needLine` in `web/pages/home_flow.ts`); the third is never on the home. Each row leads to
6 * the exact control, and a repository standing still offers its choices as buttons
7 * (`POST /:owner/:name/stuck`, `crew/stuck_pile.ts`), the last of them turning the app off.
2 * What waits for a person that is not an issue or a pull, drawn where it belongs: the people
3 * stopped until this viewer changes a setting, on the "waiting for me" view of the kanban
4 * (`/?waits=me`), and what stands still (a repository behind its pulls, an approved pull that has
5 * not landed, a run the host gave up on) on the apps list, as each app's state and action. A
6 * repository standing still offers its choices as buttons (`POST /:owner/:name/stuck`,
7 * `crew/stuck_pile.ts`), the last of them turning the app off.
88 */
99 import { asksToAnswer } from "../../actions/ask_admin.ts";
1010 import { standingNeeds, STUCK_CHOICES } from "../../actions/needs.ts";
11 import { canAdmin, getRepoById } from "../../core/repos.ts";
11 import { canAdmin, getRepoById, listReposWritableTo } from "../../core/repos.ts";
1212 import type { User } from "../../core/users.ts";
1313 import { OFF_SAYS, PILE_CHOICES } from "../../crew/stuck_pile.ts";
14 import { FORGE_BROKEN } from "../../flow/alarms.ts";
15 import { forgeCeiling } from "../../flow/ceiling.ts";
1614 import type { Ctx } from "../../http/context.ts";
17 import { running } from "../../kernel/version.ts";
18 import { proofNotice } from "../../release/prove.ts";
1915 import { html, type Html } from "../html.ts";
2016 import { btn } from "../ui.ts";
21 import { cachedAlarms } from "./alarm_lines.ts";
2217 import { adminAskNeed } from "./ask_admin.ts";
23
24 /**
25 * What is broken about the forge itself, for an admin: the proof's alarm and the fired alarms of
26 * `FORGE_BROKEN`, each linked to where it is acted on. The list the home's count links to.
27 */
28 function brokenSection(ctx: Ctx, user: User, now: number): Html | null {
29 if (!user.isAdmin) return null;
30 const proof = proofNotice(ctx.app.config.dataDir, running().version, now);
31 const rows = [
32 ...(proof?.tone === "alarm" ? [{ says: proof.sentence, href: "/releases#proof" }] : []),
33 ...cachedAlarms(ctx.app.db, new Date(now), forgeCeiling(ctx.app.config), ctx.app.config.dataDir).filter((a) => FORGE_BROKEN.has(a.key)),
34 ];
35 if (rows.length === 0) return null;
36 return html`<section class="stack" id="forge-broken">
37 <h2>Problems with the forge</h2>
38 <ul class="list setting-list">${rows.map((r) => html`<li><a href="${r.href}">${r.says}</a></li>`)}</ul>
39 </section>`;
40 }
18 import { interruptedOutLine } from "./interrupted_out.ts";
4119
4220 /** The people stopped until this viewer changes a setting, each with its control and "Not now". */
43 function askedSection(ctx: Ctx, user: User): Html | null {
44 const asked = asksToAnswer(ctx.app, user).map((a, n) => adminAskNeed(a, n, "/asks"));
21 export function askedSection(ctx: Ctx, user: User): Html | null {
22 const asked = asksToAnswer(ctx.app, user).map((a, n) => adminAskNeed(a, n, "/?waits=me"));
4523 if (asked.length === 0) return null;
4624 return html`<section class="stack" id="asked">
4725 <h2>Stopped until you answer</h2>
@@ -50,7 +28,7 @@ function askedSection(ctx: Ctx, user: User): Html | null {
5028 }
5129
5230 /**
53 * The row an app turned off a moment ago leaves where its row was (`?off=<repo id>`, set by
31 * The row an app turned off a moment ago leaves where its row was (`/apps?off=<repo id>`, set by
5432 * `stuckSubmit`): that it is off, and one button that turns it back on through the repository's
5533 * own restore (`POST /:owner/:name/settings/archive`). Nothing for a repository that is not off or
5634 * that this viewer does not administer.
@@ -60,7 +38,7 @@ function offRow(ctx: Ctx, user: User): Html | null {
6038 if (repo === undefined || repo.archivedAt === null || !canAdmin(ctx.app.db, repo, user)) return null;
6139 const ref = `${repo.ownerName}/${repo.name}`;
6240 return html`<form class="bar" method="post" action="/${ref}/settings/archive" data-standing-off="${repo.id}" role="status">
63 <input type="hidden" name="archived" value="0" /><input type="hidden" name="to" value="/asks" />
41 <input type="hidden" name="archived" value="0" /><input type="hidden" name="to" value="/apps" />
6442 <span>${ref} is off.</span>
6543 ${btn("Turn it back on", { size: "sm" })}
6644 </form>`;
@@ -83,7 +61,7 @@ function stillSection(ctx: Ctx, user: User): Html | null {
8361 return html`<div class="stack" data-standing="${n.id}">
8462 <p>${n.sentence} <a href="${n.link}">See them</a></p>
8563 <form class="bar" method="post" action="${base}/stuck">
86 <input type="hidden" name="next" value="/asks" />
64 <input type="hidden" name="next" value="/apps" />
8765 ${PILE_CHOICES.map((choice, i) => (choice === "off" && (repo === undefined || !canAdmin(ctx.app.db, repo, user)) ? null : btn(STUCK_CHOICES[i]!, { size: "sm", name: "choice", value: choice })))}
8866 </form>
8967 </div>`;
@@ -94,7 +72,10 @@ function stillSection(ctx: Ctx, user: User): Html | null {
9472 </section>`;
9573 }
9674
97 /** The three sections, in the order the home's line counts them; nothing when all are empty. */
98 export function standingSections(ctx: Ctx, user: User, now = Date.now()): Html {
99 return html`${brokenSection(ctx, user, now)}${askedSection(ctx, user)}${stillSection(ctx, user)}`;
75 /**
76 * What stands still on the apps list, with the runs the host gave up on; nothing when neither is.
77 */
78 export function appsStanding(ctx: Ctx, user: User): Html {
79 const stopped = user.kind === "agent" ? null : interruptedOutLine(ctx, listReposWritableTo(ctx.app.db, user, { withoutArchived: true, limit: 200 }));
80 return html`${stillSection(ctx, user)}${stopped}`;
10081 }
src/web/studio/waiting_on_me.ts added +68
@@ -0,0 +1,68 @@
1 /**
2 * What waits for a person, as the set of issues and pulls it is a state of: the
3 * kanban's "waits for me" filter reads it (`/?waits=me`), and the terminal's
4 * "Waiting for me" screen lists the same rows. One read of the same decisions the
5 * pull page's status line is drawn from; nothing else is computed.
6 *
7 * The read walks the viewer's visible repositories (200 at most), so it is held
8 * for `HOLD_MS` per viewer: the board's live lanes ask on every poll and share one read.
9 */
10
11 import type { Database } from "bun:sqlite";
12 import { listReposVisibleTo } from "../../core/repos.ts";
13 import type { User } from "../../core/users.ts";
14 import { decisionsFor } from "./decisions.ts";
15 import type { Reader } from "../pages/looks.ts";
16
outdated

decisionsFor over 200 repos per live lane request; measure against the 50 ms budget or cache per viewer.

17 /** One card that waits: where it is, what it is, and what it waits for. */
18 export interface WaitingRow {
19 readonly key: string;
20 readonly repo: string;
21 readonly number: number;
22 readonly kind: "pull" | "issue";
23 readonly title: string;
24 readonly short: string;
25 }
26
27 /** How long one viewer's read is reused. */
28 const HOLD_MS = 10_000;
29 const held = new WeakMap<Database, Map<string, { at: number; rows: WaitingRow[] }>>();
30
31 /** The key a card is known by in the set: its repository and number. */
32 export const waitKey = (repoId: string, number: number): string => `${repoId}#${String(number)}`;
33
34 /** The cards that wait for `user`, in the order the decisions rank them. */
35 export function waitingRows(ctx: Reader, user: User, now = Date.now()): WaitingRow[] {
36 const db = ctx.app.db;
37 const mine = held.get(db) ?? new Map<string, { at: number; rows: WaitingRow[] }>();
38 held.set(db, mine);
39 const kept = mine.get(user.id);
40 if (kept !== undefined && now - kept.at < HOLD_MS) return kept.rows;
41 const repos = listReposVisibleTo(db, user, { limit: 200, withoutArchived: true });
42 const rows: WaitingRow[] = [];
43 for (const d of decisionsFor(ctx, repos, { noPictures: true })) {
44 const thing = d.pull ?? d.issue;
45 if (thing === undefined) continue;
46 rows.push({
47 key: waitKey(d.repo.id, thing.number),
48 repo: `${d.repo.ownerName}/${d.repo.name}`,
49 number: thing.number,
50 kind: d.pull === undefined ? "issue" : "pull",
51 title: thing.title,
52 short: d.short,
53 });
54 }
55 if (mine.size > 500) mine.clear();
56 mine.set(user.id, { at: now, rows });
57 return rows;
58 }
59
60 /** The issues and pulls (by `waitKey`) that wait for `user`. */
61 export function waitingOnMe(ctx: Reader, user: User): Set<string> {
62 return new Set(waitingRows(ctx, user).map((r) => r.key));
63 }
64
65 /** A short digest of a set, for an ETag: a lane that shows it changes when it does. */
66 export function waitsDigest(set: ReadonlySet<string>): string {
67 return Bun.hash([...set].sort().join("|")).toString(36);
68 }
test/a11y-landmarks.test.ts +1 −1
@@ -53,7 +53,7 @@ afterAll(async () => {
5353 // Signed out: the public shell, the not-found shell (failed_page) and the sign-in forms.
5454 const SIGNED_OUT = ["/", "/signin", "/signup", "/explore", "/search", "/no-such-page-here"];
5555 // Signed in (as the admin): the authenticated shell and its topbar tools.
56 const SIGNED_IN = ["/", "/feed", "/asks", "/notes", "/talk", "/map", "/settings", "/system", "/family"];
56 const SIGNED_IN = ["/", "/feed", "/notes", "/talk", "/map", "/settings", "/system", "/family"];
5757
5858 async function layout(path: string, signedIn: boolean): Promise<string> {
5959 const res = await fetch(`${servers.url}${path}`, {
test/approval-moved-inbox.test.ts +1 −1
@@ -74,7 +74,7 @@ describe("the inbox row of an approved pull", () => {
7474 };
7575 const row = () => askLinesFor(app.db, alice).find((r) => r.items.includes(`look:${pull.id}`));
7676 /** The asks page: the inbox, where each ask is drawn with its short line. */
77 const asks = async () => (await http.handle(new Request("http://forge.test/asks", { headers: { cookie } }))).text();
77 const asks = async () => (await http.handle(new Request("http://forge.test/live/on-you", { headers: { cookie } }))).text();
7878
7979 beforeAll(async () => {
8080 dataDir = await mkdtemp(join(tmpdir(), "forge-approval-moved-"));
test/ask-admin.test.ts +3 −3
@@ -183,13 +183,13 @@ test("the page: a guest presses the button, the admin's home counts it, /asks sa
183183 expect(stateOf()).toBe("asked");
184184 // The home counts it in its one line and links to the list; the list says it, with the control.
185185 const home = await get(world, world.viewers.admin, "/");
186 expect(home.body).toMatch(/<a href="\/asks#asked">(?:1 person is|\d+ people are) stopped until you answer<\/a>/);
186 expect(home.body).toMatch(/<a href="\/\?waits=me">(?:1 person is|\d+ people are) stopped until you answer<\/a>/);
187187 expect(home.body.includes("carol asks for a model key")).toBe(false);
188 const asks = await get(world, world.viewers.admin, "/asks");
188 const asks = await get(world, world.viewers.admin, "/?waits=me");
189189 const asked = asks.body.slice(asks.body.indexOf('id="asked"'));
190190 expect(asked.includes("carol asks for a model key: the crew cannot start without one")).toBe(true);
191191 expect(asked.includes('href="/settings/crew#crew-key"')).toBe(true);
192 expect(asked.includes('name="back" value="/asks"')).toBe(true);
192 expect(asked.includes('name="back" value="/?waits=me"')).toBe(true);
193193 // A member cannot answer what is the admins'.
194194 await get(world, world.viewers.member, "/asks/admin/later", form({ username: "carol", want: "crew_key", subject: "", back: "/" }));
195195 expect(stateOf()).toBe("asked");
test/ask-filters.test.ts +1 −1
@@ -129,7 +129,7 @@ describe("ask filters", () => {
129129
130130 test("the page: one tap hides, says how many are hidden, and one tap clears", async () => {
131131 clearAskFilters(app.db, alice.id);
132 const page = () => fetch(`${servers.url}/asks`, { headers: { cookie: `${cookie}; forge_mode=studio` } }).then((r) => r.text());
132 const page = () => fetch(`${servers.url}/live/on-you`, { headers: { cookie: `${cookie}; forge_mode=studio` } }).then((r) => r.text());
133133 const first = await page();
134134 // Offered once for the list, not under every row: a clear form is absent, the two picks are not.
135135 expect(first.split('action="/asks/filter"').length - 1).toBe(2);
test/asks-bulk.test.ts +1 −1
@@ -353,7 +353,7 @@ describe("acting on many asks at once", () => {
353353 test("the page: select, preview, do it, undo", async () => {
354354 await greenPull(open, "Page one");
355355 await greenPull(open, "Page two");
356 const asks = await fetch(`${servers.url}/asks`, {
356 const asks = await fetch(`${servers.url}/live/on-you`, {
357357 headers: { cookie: `${aliceCookie}; forge_mode=studio` },
358358 }).then((r) => r.text());
359359 expect(asks).toContain('id="asks-bulk"');
test/asks-counts.test.ts +1 −1
@@ -216,7 +216,7 @@ describe("home's asks are read grouped, and once", () => {
216216 };
217217
218218 const home = async () => {
219 const response = await fetch(`${servers.url}/asks`, { headers: { cookie } });
219 const response = await fetch(`${servers.url}/live/on-you`, { headers: { cookie } });
220220 expect(response.status).toBe(200);
221221 return response.text();
222222 };
test/asks-expiry.test.ts +7 −7
@@ -126,7 +126,7 @@ describe("asks that expire, hold and collapse", () => {
126126 pears = await botPull("pears", [{ path: "PEARS.md", content: "pears\n" }]);
127127 green(apples);
128128 green(pears);
129 const page = await get("/asks");
129 const page = await get("/live/on-you");
130130 expect(sentence(page)).toBe("1 thing needs you");
131131 expect(headerCount(page)).toBe(1);
132132 expect(page).toContain("2 green changes wait for your look");
@@ -152,7 +152,7 @@ describe("asks that expire, hold and collapse", () => {
152152 // card at all, so there is nothing to mute.
153153 const fragment = await get("/live/feed");
154154 expect(fragment).not.toContain('data-kind="ask"');
155 const home = await get("/asks");
155 const home = await get("/live/on-you");
156156 expect(home).toContain('<section id="needs-you"');
157157 const at = home.indexOf('<section id="needs-you"');
158158 expect(home.slice(at, home.indexOf("</section>", at))).not.toContain(
@@ -169,7 +169,7 @@ describe("asks that expire, hold and collapse", () => {
169169 repoId: repo.id,
170170 actorId: null,
171171 });
172 let page = await get("/asks");
172 let page = await get("/live/on-you");
173173 expect(sentence(page)).toBe("All fine");
174174 expect(headerCount(page)).toBe(0);
175175 expect(askLinesFor(app.db, aliceUser)).toHaveLength(0);
@@ -179,7 +179,7 @@ describe("asks that expire, hold and collapse", () => {
179179 // A new check on one of them: that one asks again, on its own.
180180 await tick();
181181 green(apples);
182 page = await get("/asks");
182 page = await get("/live/on-you");
183183 expect(sentence(page)).toBe("1 thing needs you");
184184 const pinned = page.slice(
185185 page.indexOf('<section id="needs-you"'),
@@ -203,7 +203,7 @@ describe("asks that expire, hold and collapse", () => {
203203 repoId: repo.id,
204204 actorId: null,
205205 });
206 expect(sentence(await get("/asks"))).toBe("All fine");
206 expect(sentence(await get("/live/on-you"))).toBe("All fine");
207207 // The merge box is the change's Files step (#628).
208208 const change = await get(
209209 `/${repo.ownerName}/${repo.name}/pulls/${apples.number}/files`,
@@ -231,7 +231,7 @@ describe("asks that expire, hold and collapse", () => {
231231 });
232232 await sweepStaleAsks(app);
233233 expect(askLinesFor(app.db, aliceUser)).toHaveLength(0);
234 expect(sentence(await get("/asks"))).toBe("All fine");
234 expect(sentence(await get("/live/on-you"))).toBe("All fine");
235235 // The feed and the MCP's asks carry no green line for it either.
236236 expect(
237237 readFeed(app.db, aliceUser, { limit: 50 }).items.some(
@@ -241,7 +241,7 @@ describe("asks that expire, hold and collapse", () => {
241241 expect(JSON.stringify(asksAnswer({ app, auth: { user: aliceUser } } as never, aliceUser))).not.toContain("is green");
242242 // Assigned to alice, the home's one list says it conflicts, never ready.
243243 setAssignee(app.db, plums.id, aliceUser.id);
244 const home = await get("/asks");
244 const home = await get("/live/on-you");
245245 expect(home).toContain("conflicts with main");
246246 expect(askLinesFor(app.db, aliceUser).map((l) => l.waitingFor.word)).toEqual(["conflicts with main"]);
247247 // Its own page still says why it cannot ship.
test/asks-mute.test.ts +1 −1
@@ -64,7 +64,7 @@ describe("muting a repository's asks", () => {
6464 return ((await res.json()) as { rows: unknown[] }).rows;
6565 };
6666 const home = async () =>
67 await fetch(`${servers.url}/asks`, { headers: headers(cookie) }).then((r) => r.text());
67 await fetch(`${servers.url}/live/on-you`, { headers: headers(cookie) }).then((r) => r.text());
6868
6969 const signIn = async (username: string) => {
7070 const res = await fetch(`${servers.url}/signin`, {
test/asks-rank.test.ts +7 −7
@@ -204,7 +204,7 @@ describe("asks that earn their place", () => {
204204 expect(row.words).toEqual(ASK_WORDS.look);
205205 expect(row.words.options.length).toBeGreaterThan(0);
206206 }
207 const asks = await page("/asks");
207 const asks = await page("/live/on-you");
208208 expect(asks).toContain("If nobody acts, it waits; nothing ships.");
209209 expect(asks).toContain("<b>security</b>");
210210 // The long sentence the card used to repeat is gone.
@@ -236,7 +236,7 @@ describe("asks that earn their place", () => {
236236 for (const name of ["r4", "r5", "r6"])
237237 await greenPull(name, `Work in ${name}`);
238238 // What needs you is pinned on the home (#634): count its own cards.
239 const home = await page("/asks");
239 const home = await page("/live/on-you");
240240 const asks = home.slice(home.indexOf('<section id="needs-you"'));
241241 const cards = (s: string) => (s.match(/class="card[" ]/g) ?? []).length;
242242 // Two before the phone's "more", three more inside it before the wide
@@ -250,7 +250,7 @@ describe("asks that earn their place", () => {
250250 // "more" sits inside it, and the stylesheet hides each where it is not.
251251 // (An ask's own "More" closes a details too: look past those, to the last.)
252252 expect(wide!.indexOf('id="asks-more"')).toBeLessThan(wide!.lastIndexOf("</details>"));
253 const css = await (await fetch(`${servers.url}${home.match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text();
253 const css = await (await fetch(`${servers.url}${(await page("/")).match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text();
254254 // Only where the browser can hold a details element open: an older one
255255 // keeps both summaries, so no ask is out of reach.
256256 const held = css.slice(css.indexOf("@supports selector(::details-content) {"));
@@ -329,7 +329,7 @@ describe("asks that earn their place", () => {
329329 const board = await page("/board");
330330 // The whole strip, so a drift in its markup fails here: the link, the window, the bold figures and their separators.
331331 expect(board).toMatch(
332 /<a class="muted small" id="asks-measure" href="\/asks"\s*>Asks, 7 days: <b>6<\/b> raised · <b>1<\/b> acted on · <b>1<\/b> dismissed · <b>1<\/b> went by themselves<\/a\s*>/,
332 /<a class="muted small" id="asks-measure" href="\/\?waits=me"\s*>Asks, 7 days: <b>6<\/b> raised · <b>1<\/b> acted on · <b>1<\/b> dismissed · <b>1<\/b> went by themselves<\/a\s*>/,
333333 );
334334 const fromMcp = await mcpAsks();
335335 expect(fromMcp.measure.raised).toBe(6);
@@ -340,13 +340,13 @@ describe("asks that earn their place", () => {
340340 expect((await mcpAsks()).measure.raised).toBe(6);
341341 });
342342 test("an ask is §5's card with §5's buttons and no ask-* class", async () => {
343 const home = await page("/asks");
343 const home = await page("/live/on-you");
344344 const asks = home.slice(home.indexOf('<section id="needs-you"'));
345345 expect(asks).toMatch(/<div\s+class="card"\s+id="look-/);
346346 expect(asks).toContain("<b>Ready to ship</b> · ");
347347 expect(asks).toMatch(/class="bar mt">\s*<button[^>]*data-variant="primary"/);
348348 expect(asks).not.toMatch(/class="[^"]*\bask-(card|acts|kind|pick|group|more-acts|waiting|meta|short)\b/);
349 const css = await (await fetch(`${servers.url}${home.match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text();
349 const css = await (await fetch(`${servers.url}${(await page("/")).match(/href="(\/[^"]*\.css[^"]*)"/)![1]}`)).text();
350350 expect(css).not.toMatch(/\.ask-/);
351351 // The markup lost the .needs-you class (#4189): no selector may still need it.
352352 expect(css).not.toMatch(/\.needs-you\b/);
@@ -356,7 +356,7 @@ describe("asks that earn their place", () => {
356356 // The security pull went red above; a new green one joins it in a row of two.
357357 check(security, "ok");
358358 await greenPull("security", "Another change here");
359 const asks = await page("/asks");
359 const asks = await page("/live/on-you");
360360 expect(asks).toContain("2 green changes wait for your look");
361361 expect(asks).toContain("<b>security</b>: \u201cWiden the board id\u201d");
362362 const group = asks.slice(asks.indexOf("2 green changes wait for your look"));
test/asks-timing.test.ts +7 −13
@@ -1,4 +1,4 @@
1 /** `/asks` names session, top, asks and render in Server-Timing (#3764). */
1 /** `/asks` redirects to the board's "waits for me" view; the old page's phases went with it. */
22 import { afterAll, beforeAll, expect, test } from "bun:test";
33 import { mkdtempSync, rmSync } from "node:fs";
44 import { tmpdir } from "node:os";
@@ -71,10 +71,7 @@ afterAll(() => {
7171 rmSync(root, { recursive: true, force: true });
7272 });
7373
74 const names = (res: Response): string[] =>
75 (res.headers.get("server-timing") ?? "").split(", ").map((p) => p.split(";")[0]!);
76
77 test("GET /asks names its phases for someone with an ask", async () => {
74 test("/asks is gone as a page: it redirects to the board's waits-for-me view", async () => {
7875 const signin = await fetch(`${servers.url}/signin`, {
7976 method: "POST",
8077 headers: { origin: servers.url },
@@ -82,16 +79,13 @@ test("GET /asks names its phases for someone with an ask", async () => {
8279 redirect: "manual",
8380 });
8481 const cookie = (signin.headers.get("set-cookie") ?? "").split(";")[0]!;
85 const res = await fetch(`${servers.url}/asks`, { headers: { cookie } });
86 const body = await res.text();
87 expect(res.status).toBe(200);
88 expect(body).toContain("Work");
89 expect(names(res)).toEqual(expect.arrayContaining(["app", "session", "top", "asks", "render"]));
82 const res = await fetch(`${servers.url}/asks`, { headers: { cookie }, redirect: "manual" });
83 expect(res.status).toBe(303);
84 expect(res.headers.get("location")).toBe("/?waits=me");
9085 });
9186
92 test("signed out, /asks still redirects and names session", async () => {
87 test("signed out, /asks redirects the same way", async () => {
9388 const res = await fetch(`${servers.url}/asks`, { redirect: "manual" });
9489 expect(res.status).toBe(303);
95 expect(res.headers.get("location")).toContain("/signin");
96 expect(names(res)).toContain("session");
90 expect(res.headers.get("location")).toBe("/?waits=me");
9791 });
test/asks-waiting-for.test.ts +1 −1
@@ -150,7 +150,7 @@ describe("the word on a row", () => {
150150 expect(text).toContain("ready to land");
151151 expect(text).toContain("waitingFor");
152152
153 const page = await (await fetch(`${servers.url}/asks`, { headers: { cookie } })).text();
153 const page = await (await fetch(`${servers.url}/live/on-you`, { headers: { cookie } })).text();
154154 expect(page).toContain('data-waiting="ready to land"');
155155 expect(page).toContain('<span class="sr-only">waiting for </span>ready to land');
156156 expect(page).toContain("ready to land · on you");
test/asks-waiting.test.ts +1 −1
@@ -167,7 +167,7 @@ describe("asks that wait on a person", () => {
167167 });
168168 const cookie = (signed.headers.get("set-cookie") ?? "").split(";")[0]!;
169169 const page = await (
170 await fetch(`${servers.url}/asks`, { headers: { cookie: `${cookie}; forge_mode=studio` } })
170 await fetch(`${servers.url}/live/on-you`, { headers: { cookie: `${cookie}; forge_mode=studio` } })
171171 ).text();
172172 expect(page).toContain("Waiting");
173173 expect(page).toContain("Advised idle");
test/asks.test.ts +15 −17
@@ -102,21 +102,19 @@ describe("the asks page", () => {
102102 });
103103
104104 test("when nothing asks, it says All fine, and so does the header", async () => {
105 const page = await get(alice, "/asks");
105 const page = await get(alice, "/live/on-you");
106106 expect(sentence(page)).toBe("All fine");
107107 expect(headerCount(page)).toBe(0);
108 expect(await get(alice, "/asks")).not.toContain('<section id="needs-you"');
108 expect(await get(alice, "/live/on-you")).not.toContain('<section id="needs-you"');
109109 });
110110
111 test("/asks is its own page: the needs-you section in its live region, and a signed-out reader is sent to sign in, no asks", async () => {
111 test("/asks redirects to the board's waits-for-me view; the needs-you section lives in its live region", async () => {
112112 const response = await fetch(`${servers.url}/asks`, { redirect: "manual" });
113113 expect(response.status).toBe(303);
114 expect(response.headers.get("location")).toContain("/signin");
115 const page = await get(alice, "/asks");
114 expect(response.headers.get("location")).toBe("/?waits=me");
115 const page = await get(alice, "/live/on-you");
116116 expect(page).toContain('id="live-on-you"');
117117 expect(page).toContain('data-live-src="/live/on-you"');
118 expect(page).toContain("<title>");
119 expect(page).toContain('<h1 class="sr-only">Asks</h1>');
120118 expect(page).toContain('id="asks-sentence"');
121119 const door = await (await fetch(`${servers.url}/`)).text();
122120 expect(door).not.toContain('id="needs-you"');
@@ -150,7 +148,7 @@ describe("the asks page", () => {
150148 claimRun(app.db, run.id);
151149 finishRun(app.db, run.id, { state: "failed", summary: "red" });
152150 // Failed but the crew is still trying: that is working, not an ask.
153 expect(sentence(await get(alice, "/asks"))).toBe("All fine");
151 expect(sentence(await get(alice, "/live/on-you"))).toBe("All fine");
154152 recordDecision(app.db, {
155153 kind: "retry",
156154 repoId: repo.id,
@@ -161,7 +159,7 @@ describe("the asks page", () => {
161159 by: "rule",
162160 ms: 1,
163161 });
164 const page = await get(alice, "/asks");
162 const page = await get(alice, "/live/on-you");
165163 expect(sentence(page)).toBe("1 thing needs you");
166164 expect(page).toContain("Bot did a thing");
167165 expect(headerCount(page)).toBe(1);
@@ -174,10 +172,10 @@ describe("the asks page", () => {
174172 expect(page).toMatch(/<form [^>]*method="post"/);
175173 // The home counts it in the header's Asks link; the dev dashboard's
176174 // own "needs you" line went with the dashboard (#625).
177 const home = await get(alice, "/asks");
175 const home = await get(alice, "/live/on-you");
178176 expect(headerCount(home)).toBe(1);
179177 // Bob can read the public repository but cannot write it: not his ask.
180 expect(sentence(await get(bob, "/asks"))).toBe("All fine");
178 expect(sentence(await get(bob, "/live/on-you"))).toBe("All fine");
181179 });
182180
183181 test("a forge health problem is a card for an admin and for no one else", async () => {
@@ -185,11 +183,11 @@ describe("the asks page", () => {
185183 app.db
186184 .query("UPDATE run SET created_at = ?1 WHERE state = 'queued'")
187185 .run(new Date(Date.now() - 3 * 3_600_000).toISOString());
188 const admin = await get(alice, "/asks");
186 const admin = await get(alice, "/live/on-you");
189187 expect(admin).toContain("behind one lane");
190188 expect(sentence(admin)).toBe("2 things need you");
191189 expect(headerCount(admin)).toBe(2);
192 const other = await get(bob, "/asks");
190 const other = await get(bob, "/live/on-you");
193191 expect(other).not.toContain("behind one lane");
194192 expect(sentence(other)).toBe("All fine");
195193 });
@@ -235,17 +233,17 @@ describe("the asks page", () => {
235233 ms: 1,
236234 });
237235 const card = `id="ask-stopped:${pull.id}"`;
238 expect(await get(alice, "/asks")).toContain(card);
236 expect(await get(alice, "/live/on-you")).toContain(card);
239237 // The re-run passes: the stop is answered, and the pull is green.
240238 check("ok");
241239 resolveOpen(app.db, pull.id, "retry", "green");
242 const green = await get(alice, "/asks");
240 const green = await get(alice, "/live/on-you");
243241 expect(green).not.toContain(card);
244242 expect(green).toContain(`id="ask-look:${pull.id}"`);
245243 // Red again, before anything new is decided: the old stop is spent, and
246244 // the crew's tries are what the card is counted from.
247245 check("failed");
248 expect(await get(alice, "/asks")).not.toContain(card);
246 expect(await get(alice, "/live/on-you")).not.toContain(card);
249247 });
250248
251249 test("a green change's card says what its tests did", async () => {
@@ -299,7 +297,7 @@ describe("the asks page", () => {
299297 .run(made.value.id);
300298 const ids = decisionsFor({ app, auth: { user: alice0 } } as unknown as Ctx, [repo]).map((d) => d.id);
301299 expect(ids.some((id) => id.startsWith("setting:"))).toBe(false);
302 expect(await get(alice, "/asks")).not.toContain("Put back");
300 expect(await get(alice, "/live/on-you")).not.toContain("Put back");
303301 const res = await fetch(`${servers.url}/asks/setting`, {
304302 method: "POST",
305303 headers: { cookie: alice, origin: servers.url },
test/backup-card-pages.test.ts +1 −1
@@ -88,7 +88,7 @@ describe("a broken branch's card, read by a site admin who is not a writer", ()
8888 });
8989
9090 test("/asks links the branch to its row and says who may act once", async () => {
91 const page = await get(admin, "/asks");
91 const page = await get(admin, "/live/on-you");
9292 expect(page).toContain(link);
9393 expect(page.split(String(html`${SETTLE}`)).length - 1).toBe(1);
9494 });
test/calm-home.test.ts +1 −1
@@ -115,7 +115,7 @@ test("home and board paint no alert, banner or danger notice for the odd setting
115115 test("no reviewer is the board's one line, a link and not an alert", async () => {
116116 const body = await get("/board");
117117 expect(body.split("No reviewer: agent pulls wait for you").length - 1).toBe(1);
118 expect(body).toMatch(/<a data-need href="\/asks"[^>]*>[^<]*<[^>]*>[^<]*<\/span>?/s);
118 expect(body).toMatch(/<a data-need href="\/\?waits=me"[^>]*>[^<]*<[^>]*>[^<]*<\/span>?/s);
119119 });
120120
121121 test("a stalled flow card renders on home with its one action, and is spared", async () => {
test/conflict-words.test.ts +1 −1
@@ -36,7 +36,7 @@ describe("a conflicted pull says its conflicts first", () => {
3636 let pull: Pull;
3737
3838 const asks = async (): Promise<string> => {
39 const response = await fetch(`${servers.url}/asks`, { headers: { cookie }, redirect: "manual" });
39 const response = await fetch(`${servers.url}/live/on-you`, { headers: { cookie }, redirect: "manual" });
4040 expect(response.status).toBe(200);
4141 return (await response.text()).replace(/\s+/g, " ");
4242 };
test/empty-states.test.ts +2 −2
@@ -104,7 +104,7 @@ test("each list's one link says its own next step, in one sentence", async () =>
104104
105105 test("the five lists take their empty sentence from one table, each with a single link", async () => {
106106 // people: the signed-in admin is always one, so test/keys-people-list.test.ts holds its sentence
107 const pages: Record<string, string> = { board: "/boards", inbox: "/asks", runs: "/root/fresh/runs", apps: "/apps" };
107 const pages: Record<string, string> = { board: "/boards", inbox: "/live/on-you", runs: "/root/fresh/runs", apps: "/apps" };
108108 for (const [kind, path] of Object.entries(pages)) {
109109 const w = EMPTY_WORDS[kind as keyof typeof EMPTY_WORDS];
110110 const blocks = emptyBlocks(await (await fetch(servers.url + path, { headers: { cookie } })).text());
@@ -142,7 +142,7 @@ const ALLOWED: Readonly<Record<string, string>> = {
142142 "/root/fresh/forks": "the Fork button in the repository's header is the one door",
143143 };
144144 const EMPTY_PAGES = [
145 "/apps", "/boards", "/asks", "/audit", "/displays", "/explore", "/settings/subscriptions",
145 "/apps", "/boards", "/audit", "/displays", "/explore", "/settings/subscriptions",
146146 "/root/fresh/issues", "/root/fresh/pulls", "/root/fresh/runs", "/root/fresh/branches",
147147 "/root/fresh/commits", "/root/fresh/releases", "/root/fresh/forks",
148148 ];
test/forges-memory.test.ts +2 −2
@@ -141,7 +141,7 @@ describe("the forges' sizes together against the machine's memory", () => {
141141 `<p class="muted small" role="status" data-memory-over>${line}</p>`,
142142 );
143143 // The needs-you stack, on /asks and as the home draws it (/live/on-you): one alert line.
144 for (const path of ["/asks", "/live/on-you"]) {
144 for (const path of ["/live/on-you"]) {
145145 const page = await get(path);
146146 expect(page.status).toBe(200);
147147 expect(count(page.text)).toBe(1);
@@ -187,7 +187,7 @@ describe("the forges' sizes together against the machine's memory", () => {
187187
188188 test("with room nothing is said anywhere, and nothing is refused either", async () => {
189189 machineGiB = 64;
190 for (const path of ["/forges", "/asks", "/live/on-you"]) {
190 for (const path of ["/forges", "/live/on-you"]) {
191191 const page = await get(path);
192192 expect(page.status).toBe(200);
193193 expect(count(page.text)).toBe(0);
test/hand-decider.test.ts +1 −1
@@ -81,7 +81,7 @@ describe("let the decider answer a hand-over", () => {
8181 redirect: "manual",
8282 });
8383
84 const home = async (path = "/asks"): Promise<string> =>
84 const home = async (path = "/live/on-you"): Promise<string> =>
8585 (await (await fetch(`${servers.url}${path}`, { headers: { cookie } })).text()).replace(/\s+/g, " ");
8686
8787 beforeAll(async () => {
test/handover-give-back.test.ts +1 −1
@@ -107,7 +107,7 @@ describe("give a handed-over pull back to the crew", () => {
107107 askLinesFor(app.db, owner).some((r) => r.items.includes(`handover:${pullId}`));
108108
109109 const page = async (): Promise<string> =>
110 (await (await fetch(`${servers.url}/asks`, { headers: { cookie } })).text()).replace(/\s+/g, " ");
110 (await (await fetch(`${servers.url}/live/on-you`, { headers: { cookie } })).text()).replace(/\s+/g, " ");
111111
112112 const post = (ask: string, headers: Record<string, string> = {}, as = cookie) =>
113113 fetch(`${servers.url}/asks/give-back`, {
test/holds.test.ts +1 −1
@@ -747,7 +747,7 @@ describe("a hold is set, shown and lifted", () => {
747747 // What needs you, pinned on the home (#634), is the part to read: the
748748 // feed below it may well mention the change as news.
749749 const asks = async (cookie: string) => {
750 const home = await page("/asks", cookie);
750 const home = await page("/live/on-you", cookie);
751751 const at = home.indexOf('<section id="needs-you"');
752752 return at === -1 ? "" : home.slice(at, home.indexOf("</section>", at));
753753 };
test/home-feed.test.ts +9 −7
@@ -212,7 +212,7 @@ describe("home is the feed", () => {
212212 shortcuts: { name: string; short_name: string; url: string; icons: { src: string }[] }[];
213213 };
214214 expect(manifest.shortcuts.map((s) => [s.short_name, s.url])).toEqual([
215 ["On you", "/asks"],
215 ["On you", "/?waits=me"],
216216 ["Talk", "/talk"],
217217 ]);
218218 for (const s of manifest.shortcuts) {
@@ -221,6 +221,8 @@ describe("home is the feed", () => {
221221 const signedIn = await get(s.url, aliceCookie);
222222 expect(signedIn.status).toBe(200);
223223 const anon = await fetch(`${servers.url}${s.url}`, { redirect: "manual" });
224 // The board's "waiting for me" view is the home: signed out it is the home's own sign-in.
225 if (s.url.startsWith("/?")) continue;
224226 expect(anon.status).toBe(303);
225227 expect(anon.headers.get("location")).toBe(`/signin?next=${encodeURIComponent(s.url)}`);
226228 }
@@ -452,10 +454,10 @@ describe("home is the feed", () => {
452454 expect(page).not.toContain("live-on-you");
453455 expect(home).not.toContain("things need you");
454456 expect(home).not.toContain("data-pick");
455 expect(home).toContain('href="/asks"');
456 const link = home.match(/<a[^>]*href="\/asks"[^>]*>([^<]*)(?:<kbd class="keyhint">.*?<\/kbd>)?<\/a\s*>/s);
457 expect(home).toContain('href="/?waits=me"');
458 const link = home.match(/<a[^>]*href="\/\?waits=me"[^>]*>([^<]*)(?:<kbd class="keyhint">.*?<\/kbd>)?<\/a\s*>/s);
457459 expect(link).not.toBeNull();
458 expect(link![1]!.trim()).toBe("Asks");
460 expect(link![1]!.trim()).toBe("Waiting");
459461 // Nothing after the link, up to the next tag, is a number.
460462 const after = home.slice(home.indexOf(link![0]) + link![0].length);
461463 expect(after.slice(0, after.indexOf("<")).trim()).not.toMatch(/\d/);
@@ -463,7 +465,7 @@ describe("home is the feed", () => {
463465 const chords = [...page.matchAll(/data-shortcut="([^"]+)"/g)].map((m) => m[1]);
464466 expect(chords).toContain("g q");
465467 expect(new Set(chords).size).toBe(chords.length);
466 const asks = await (await get("/asks", aliceCookie)).text();
468 const asks = await (await get("/live/on-you", aliceCookie)).text();
467469 for (const title of titles) expect(asks).toContain(title);
468470 });
469471
@@ -473,7 +475,7 @@ describe("home is the feed", () => {
473475 if (!one.ok || !two.ok) throw new Error("issues");
474476 for (const [repo, issue] of [[garden, one.value], [vault, two.value]] as const)
475477 expect(assignIssue(app, alice, repo, issue, alice).ok).toBe(true);
476 const text = await (await get("/asks", aliceCookie)).text();
478 const text = await (await get("/live/on-you", aliceCookie)).text();
477479 const card = text.slice(text.indexOf('id="live-on-you"')).replace(/\s+/g, " ");
478480 expect(card).toContain("things need you");
479481 expect(card).toContain("assigned to you");
@@ -491,7 +493,7 @@ describe("home is the feed", () => {
491493 expect(text).toContain("fleet.operated");
492494 expect(text).toContain("data-pick");
493495 // Alone, a single row stays a plain link.
494 const bobCard = await (await get("/asks", bobCookie)).text();
496 const bobCard = await (await get("/live/on-you", bobCookie)).text();
495497 expect(bobCard).not.toContain('id="asks-bulk"');
496498 });
497499 });
test/home-flow.test.ts +3 −8
@@ -368,14 +368,14 @@ describe("a proof that did not pass is told in words, with its own record, and r
368368 expect(html).not.toContain('class="hf-need"');
369369 expect(html).not.toContain("sign-up limit");
370370 expect(html).not.toContain("start=rate");
371 expect(await (await get("/asks", owner)).text()).not.toContain('id="forge-broken"');
371 expect(await (await get("/live/on-you", owner)).text()).not.toContain('id="forge-broken"');
372372 });
373373
374 test("a public address that did not answer as the release is the forge broken: one line in the header with a count, and /asks lists it", async () => {
374 test("a public address that did not answer as the release is the forge broken: one line in the header with a count, and it links to the system page", async () => {
375375 await write({ failure: "https://f/a.css expected 200 (status 500)" });
376376 const html = await (await get("/", owner)).text();
377377 const need = html.match(/<p class="hf-need"[\s\S]*?<\/p>/)?.[0] ?? "";
378 expect(need).toContain('<a href="/asks#forge-broken">1 problem with the forge</a>');
378 expect(need).toContain('<a href="/system">1 problem with the forge</a>');
379379 expect(need).toContain("is not serving as it should");
380380 expect(need).toContain('data-tone="danger"');
381381 expect(html.match(/class="hf-need"/g)?.length).toBe(1);
@@ -383,13 +383,8 @@ describe("a proof that did not pass is told in words, with its own record, and r
383383 const head = html.indexOf('<header class="hf-head">');
384384 expect(html.indexOf('class="hf-need"')).toBeGreaterThan(head);
385385 expect(html.indexOf('class="hf-need"')).toBeLessThan(html.indexOf("</header>", head));
386 const asks = await (await get("/asks", owner)).text();
387 const listed = asks.slice(asks.indexOf('id="forge-broken"'));
388 expect(listed).toContain("<h2>Problems with the forge</h2>");
389 expect(listed).toMatch(/<a href="\/releases#proof">[^<]*is not serving as it should/);
390386 // a person who cannot administer the forge is not told of it, on either page
391387 expect(await (await get("/", bob)).text()).not.toContain('class="hf-need"');
392 expect(await (await get("/asks", bob)).text()).not.toContain('id="forge-broken"');
393388 });
394389
395390 test("the releases page opens on the proof's record: where it stopped, what happened, when it tries again, and a way to try now", async () => {
test/home-interrupted-out.test.ts +3 −3
@@ -1,4 +1,4 @@
1 /** Home names a run given up after interruptions, with Try again (#11583). */
1 /** The apps list names a run given up after interruptions, with Try again (#11583). */
22 import { afterAll, beforeAll, expect, test } from "bun:test";
33 import { mkdtemp, rm } from "node:fs/promises";
44 import { tmpdir } from "node:os";
@@ -24,7 +24,7 @@ let cookie: string;
2424 let repoId: string;
2525 let botId: string;
2626
27 const home = async () => (await fetch(`${servers.url}/`, { headers: { cookie } })).text();
27 const home = async () => (await fetch(`${servers.url}/apps`, { headers: { cookie } })).text();
2828
2929 function failedRun(title: string, summary: string, finishedAt: string) {
3030 const made = createIssue(app.db, { repoId, authorId: alice.id, title, kind: "issue" });
@@ -92,7 +92,7 @@ test("a stranger sees no line", async () => {
9292 const r = await createUser(app.db, { origin: "seed", trusted: true, username: "bob", email: "[email protected]", password: "a-good-passphrase" });
9393 if (!r.ok) throw new Error(r.error);
9494 const bob = `forge_session=${createSession(app.db, r.value.id).token}`;
95 expect(await (await fetch(`${servers.url}/`, { headers: { cookie: bob } })).text()).not.toContain("interrupted-out");
95 expect(await (await fetch(`${servers.url}/apps`, { headers: { cookie: bob } })).text()).not.toContain("interrupted-out");
9696 });
9797
9898 test("the Try again route refuses a cross-origin post", async () => {
test/hotkey-hints.test.ts +3 −3
@@ -23,7 +23,7 @@ const inlineHints = (page: string): { menu: boolean }[] =>
2323 test("no page draws a hint in the flow outside a menu, so hints cannot shift it", async () => {
2424 const repo = f.repos[0]!;
2525 let hinted = 0;
26 for (const path of ["/", "/feed", "/apps", "/asks", `/${repo.ownerName}/${repo.name}`, `/${repo.ownerName}/${repo.name}/issues`, `/${repo.ownerName}/${repo.name}/pulls`]) {
26 for (const path of ["/", "/feed", "/apps", "/review", `/${repo.ownerName}/${repo.name}`, `/${repo.ownerName}/${repo.name}/issues`, `/${repo.ownerName}/${repo.name}/pulls`]) {
2727 const page = await get(path);
2828 expect(inlineHints(page).filter((h) => !h.menu)).toEqual([]);
2929 hinted += (page.match(/data-hint="/g) ?? []).length;
@@ -103,10 +103,10 @@ test("the chip's text is not part of the element's name; a single key is announc
103103 expect(String(hintAttr("g h"))).toBe('data-hint="g h"');
104104 });
105105
106 test("signed in, the top bar's Talk icon and Asks carry their hints", async () => {
106 test("signed in, the top bar's Talk icon and Waiting carry their hints", async () => {
107107 const page = await get("/");
108108 expect(page).toMatch(/aria-label="Talk to the forge" data-shortcut="g t" data-hint="Talk to the forge · g t"/);
109 expect(page).toMatch(/href="\/asks" data-shortcut="g q" data-hint="g q"/);
109 expect(page).toMatch(/href="\/\?waits=me" data-shortcut="g q" data-hint="g q"/);
110110 });
111111
112112 test("hover and focus show a hint with no script: the rule is CSS alone", () => {
test/later-gate.test.ts +2 −6
@@ -100,7 +100,7 @@ describe("the Later gate in plain sight", () => {
100100 expect(heldLine({ app } as unknown as Ctx, alice)).toBeNull();
101101 });
102102
103 test("a new gate shows up on home: how many, who set it", async () => {
103 test("a new gate is counted on its held page, and home no longer draws a held line", async () => {
104104 const a = open("Later thing one");
105105 const b = open("Later thing two");
106106 expect(linkIssue(app, alice, fresh(), current(a), gate).ok).toBe(true);
@@ -108,11 +108,7 @@ describe("the Later gate in plain sight", () => {
108108 const hold = gateHold(app.db, fresh())!;
109109 expect(hold.held).toBe(2);
110110 expect(hold.by).toBe("alice");
111 const home = await get("/");
112 expect(home).toContain('id="held-line"');
113 expect(home).toContain("2 issues are held");
114 expect(home).toContain("set by alice");
115 expect(home).toContain("/alice/engine/held");
111 expect(await get("/")).not.toContain('id="held-line"');
116112 });
117113
118114 test("a held issue says so at its top with Lift, and Lift lifts it", async () => {
test/mcp-asks-card-decide.test.ts +1 −1
@@ -39,7 +39,7 @@ const rpc = async (token: string, name: string, args: Record<string, unknown>) =
3939 return (await res.json()) as any;
4040 };
4141 const page = async (): Promise<string> =>
42 (await (await fetch(`${servers.url}/asks`, { headers: { cookie: `${cookie}; forge_mode=studio` } })).text()).replace(/\s+/g, " ");
42 (await (await fetch(`${servers.url}/live/on-you`, { headers: { cookie: `${cookie}; forge_mode=studio` } })).text()).replace(/\s+/g, " ");
4343
4444 beforeAll(async () => {
4545 dataDir = await mkdtemp(join(tmpdir(), "forge-asks-card-"));
test/no-alarm-banner.test.ts +3 −4
@@ -162,9 +162,9 @@ const said = (html: string): string =>
162162 const ALARMS: readonly { readonly alarm: string; readonly says: string; readonly pages: readonly string[] }[] = [
163163 { alarm: "disk full", says: "disk has 0.0% free", pages: ["/", "/alice/forge/next", "/alice/forge", "/system"] },
164164 { alarm: "disk full, as the board needs it", says: "Disk is nearly full", pages: ["/board"] },
165 { alarm: "backup overdue", says: "the bucket refused", pages: ["/asks", "/board"] },
165 { alarm: "backup overdue", says: "the bucket refused", pages: ["/board"] },
166166 // The home (the lanes first, since 2026-11-15) counts what is broken about the forge in one
167 // quiet line, with the first of them beside the count; each sentence in full is on /asks, and
167 // quiet line, with the first of them beside the count; each sentence in full is on /board and
168168 // every alarm's on /boards.
169169 { alarm: "what is broken, as home counts it", says: "2 problems with the forge", pages: ["/"] },
170170 { alarm: "bug past its clock", says: "Bug past its clock: alice/forge#1", pages: ["/boards"] },
@@ -179,8 +179,7 @@ const PAGES = ["/", "/alice/forge/next", "/alice/forge", "/board", "/boards", "/
179179 test("each alarm is raised, said on its page, and no page draws a banner for any of them", async () => {
180180 const w = await open(0);
181181 const html = new Map<string, string>();
182 // /asks is read for its words alone: its own cards are not this file's to judge.
183 for (const path of [...PAGES, "/asks"]) {
182 for (const path of PAGES) {
184183 const page = await read(w, path);
185184 expect(page).toContain("<main");
186185 html.set(path, page);
test/palette-roster.test.ts +3 −1
@@ -128,10 +128,11 @@ test("a site-admin person is offered the whole roster", () => {
128128 ["system", "System", "the machine now: CPU, memory, disks, processes"],
129129 ["pulls-to-land", "Pulls to land", "approved pulls, stale crew pulls, unproposed work"],
130130 ["valves", "Valves", "the week's budget as a valve per repository; turn one and the crew obeys"],
131 ["health-voice", "Health — spoken", "how the forge is, in two plain sentences"],
131 ["waiting-for-me", "Waiting for me", "issues and pulls that wait for you"],
132132 ["refused-asks", "Refused first asks", "the last 20 first asks turned away"],
133133 ["disks", "Disks", "machines' disk readings: 30-day write rate and projected rated-TBW date"],
134134 ["telemetry", "Telemetry", "which agents may read flow and system; enter flips the grant"],
135 ["health-voice", "Health — spoken", "how the forge is, in two plain sentences"],
135136 ["stalls", "Main-thread stalls", "the last hour's stall ms by route"],
136137 ["footing", "What the forge stands on", "each piece on another machine, in the order it would break the forge"],
137138 ["maintenanceweek", "Maintenance, last 7 days", "what each maintenance worker found and did this week"],
@@ -409,6 +410,7 @@ test("a member person is offered the signed-in roster without the admin entries"
409410 ["payments", "Payments", "what was charged for the forges you claimed"],
410411 ["bugs", "Bugs", "open bugs and the bug clock"],
411412 ["health-voice", "Health — spoken", "how the forge is, in two plain sentences"],
413 ["waiting-for-me", "Waiting for me", "issues and pulls that wait for you"],
412414 ["audit", "Who can do what", "each app's doors from its contract.json: yes, own or no"],
413415 ["archived", "Archived repositories", "put away, not gone: open one or restore it"],
414416 ["apps-crew", "What the crew is doing", "one plain sentence per app: who is on what"],
test/planner-declined.test.ts +2 −2
@@ -215,7 +215,7 @@ describe("the planner declined, waiting for a person", () => {
215215 `garden: the planner declined the direction and waits for you (issue #${direction.number})`,
216216 );
217217 expect(await shown(bob)).not.toContain("the planner declined");
218 const asks = await page(aliceCookie, "/asks");
218 const asks = await page(aliceCookie, "/live/on-you");
219219 expect(asks).toContain("The planner declined the direction");
220220 expect(asks).toContain(
221221 `/alice/garden/issues/${direction.number}#comment-body`,
@@ -249,7 +249,7 @@ describe("the planner declined, waiting for a person", () => {
249249 test("an ask quotes the planner's words as one escaped, clamped line, whole in its title (#10199)", async () => {
250250 const words = "nothing to plan:\n\n - `main` is **done**\n - see [the map](http://x.test) <b>now</b>";
251251 decline(words, new Date().toISOString());
252 const asks = await page(await signIn("alice"), "/asks");
252 const asks = await page(await signIn("alice"), "/live/on-you");
253253 const flat = "nothing to plan: - `main` is **done** - see [the map](http://x.test) &lt;b&gt;now&lt;/b&gt;";
254254 expect(asks).toContain(`The planner declined the direction: \u201c<span class="row-note" title="${flat}">${flat}</span>\u201d.`);
255255 expect(asks).not.toContain("<b>now</b>");
test/proposal-card.test.ts +2 −2
@@ -113,7 +113,7 @@ describe("a wave proposal is one inbox card", () => {
113113 const [row] = rows();
114114 expect(row!.proposal!.title).toBe("Refused wave");
115115 expect(row!.proposal!.issues).toEqual(["First <b>step</b>", "Second step"]);
116 const page = await (await fetch(`${servers.url}/asks`, { headers: { cookie: `${aliceCookie}; forge_mode=studio` } })).text();
116 const page = await (await fetch(`${servers.url}/live/on-you`, { headers: { cookie: `${aliceCookie}; forge_mode=studio` } })).text();
117117 expect(page).toContain("First &lt;b&gt;step&lt;/b&gt;");
118118 expect(page).toContain("because &lt;script&gt;");
119119 expect(page).not.toContain("<b>step</b>");
@@ -157,7 +157,7 @@ describe("a wave proposal is one inbox card", () => {
157157 test("home shows the Redirect box on the card, and Later's way back", async () => {
158158 const id = propose("Home wave");
159159 const get = async () =>
160 (await (await fetch(`${servers.url}/asks`, { headers: { cookie: `${aliceCookie}; forge_mode=studio` } })).text());
160 (await (await fetch(`${servers.url}/live/on-you`, { headers: { cookie: `${aliceCookie}; forge_mode=studio` } })).text());
161161 expect(await get()).toContain(`/asks/proposal/${id}/redirect`);
162162 await post(aliceCookie, `/asks/proposal/${id}/later`, [["back", "/"]]);
163163 const page = await get();
test/review-page.test.ts −5
@@ -161,11 +161,6 @@ test("signed out, /review sends to sign-in", async () => {
161161 expect(res.headers.get("location")).toContain("/signin");
162162 });
163163
164 test("the asks page links to /review", async () => {
165 const res = await fetch(`${servers.url}/asks`, { headers: { cookie } });
166 expect(await res.text()).toContain('href="/review"');
167 });
168
169164 test("each row says what the crew advises and why, or that it has not advised yet", async () => {
170165 const body = await (await fetch(`${servers.url}/review`, { headers: { cookie } })).text();
171166 const rows = body.split("<li").filter((r) => r.includes('class="row"'));
test/review-wait.test.ts +1 −1
@@ -35,7 +35,7 @@ describe("a green agent pull and its reviewer", () => {
3535
3636 const home = async (): Promise<string> =>
3737 (
38 await (await fetch(`${servers.url}/asks`, { headers: { cookie } })).text()
38 await (await fetch(`${servers.url}/live/on-you`, { headers: { cookie } })).text()
3939 ).replace(/\s+/g, " ");
4040 const wordCtx = (): WordCtx => ({ db: app.db }) as unknown as WordCtx;
4141
test/server-timing-sweep.test.ts +1
@@ -42,6 +42,7 @@ const NOT_PAGES = new Set([
4242 * by redirecting.
4343 */
4444 const REDIRECTS = new Set([
45 "/asks",
4546 "/.well-known/change-password",
4647 "/alice/forge/changes",
4748 "/alice/forge/files",
test/stuck-pile-doors.test.ts +16 −16
@@ -1,7 +1,7 @@
11 /**
2 * The doors of a repository standing still (#12611): its row on `/asks`, the MCP `forge` tool and
3 * the terminal's needs screen each take one choice about it, turning the app off among them, and
4 * each refuses who may not and plans before it acts. The home draws none of it: its lanes come
2 * The doors of a repository standing still (#12611): its row on the apps list, the MCP `forge` tool
3 * and the terminal's needs screen each take one choice about it, turning the app off among them,
4 * and each refuses who may not and plans before it acts. The home draws none of it: its lanes come
55 * first, on every width.
66 */
77 import { afterAll, beforeAll, beforeEach, expect, test } from "bun:test";
@@ -98,44 +98,44 @@ test("the home: the lanes are the first thing under the header, on a phone as on
9898 expect(html).not.toContain(`action="${path}/stuck"`);
9999 });
100100
101 test("/asks lists it under Standing still: the calm sentence, its choices as buttons, what turning off does, and the approved pull", async () => {
101 test("/apps lists it under Standing still: the calm sentence, its choices as buttons, what turning off does, and the approved pull", async () => {
102102 approve(9);
103 const html = await page("/asks");
103 const html = await page("/apps");
104104 const still = html.slice(html.indexOf('id="standing"'));
105105 expect(still).toContain("<h2>Standing still</h2>");
106106 expect(still).toContain(`${path.slice(1)}: 3 pulls nobody has touched since `);
107107 expect(still).toContain("Nothing new can start there until they move.");
108108 expect(still).toContain(`action="${path}/stuck"`);
109 expect(still).toContain('name="next" value="/asks"');
109 expect(still).toContain('name="next" value="/apps"');
110110 for (const [value, label] of [["recheck", "Re-check its pulls"], ["builders", "Hand its pulls to builders"], ["close", "Close its stale pulls"], ["off", "Turn this app off"]])
111111 expect(still).toMatch(new RegExp(`<button[^>]*name="choice"[^>]*value="${value}"[^>]*>[\\s\\S]*?${label}`));
112112 expect(still).toContain(OFF_SAYS);
113113 expect(still).toMatch(new RegExp(`href="${path}/pulls/${n}"[^>]*>[^<]*was approved 9 days ago and has not landed`));
114114 expect(still).not.toMatch(/is stuck/);
115115 // Someone who cannot write there is shown none of it.
116 expect(await page("/asks", f.peerCookie)).not.toContain('id="standing"');
116 expect(await page("/apps", f.peerCookie)).not.toContain('id="standing"');
117117 });
118118
119119 test("Turn this app off: the row's button archives the repository, its row is gone from every door, and nothing counts it", async () => {
120 const off = await post({ origin: f.base, cookie: f.ownerCookie }, { choice: "off", next: "/asks" });
120 const off = await post({ origin: f.base, cookie: f.ownerCookie }, { choice: "off", next: "/apps" });
121121 expect(off.status).toBe(303);
122 expect(off.headers.get("location")).toBe(`/asks?off=${repoId}#standing`);
122 expect(off.headers.get("location")).toBe(`/apps?off=${repoId}#standing`);
123123 expect(getRepoById(f.app.db, repoId)!.archivedAt).not.toBeNull();
124124 expect(open()).toBe(3);
125125 forgetStuckRepos(f.app.db);
126 expect(await page("/asks")).not.toContain(`action="${path}/stuck"`);
126 expect(await page("/apps")).not.toContain(`action="${path}/stuck"`);
127127 // Where its row was, the page says it is off and offers the way back in one button.
128 const there = await page(`/asks?off=${repoId}`);
128 const there = await page(`/apps?off=${repoId}`);
129129 const row = there.slice(there.indexOf(`data-standing-off="${repoId}"`) - 200).slice(0, 900);
130130 expect(row).toContain(`action="${path}/settings/archive"`);
131131 expect(row).toContain('name="archived" value="0"');
132132 expect(row).toContain(`${path.slice(1)} is off.`);
133133 expect(row).toContain("Turn it back on");
134134 // Someone who does not administer it is offered nothing.
135 expect(await page(`/asks?off=${repoId}`, f.peerCookie)).not.toContain("data-standing-off");
135 expect(await page(`/apps?off=${repoId}`, f.peerCookie)).not.toContain("data-standing-off");
136136 expect(needsStack({ app: f.app }, f.owner).filter((x) => x.id.startsWith("stuck:"))).toEqual([]);
137137 // Off already, there is nothing left to choose about it.
138 const again = await post({ origin: f.base, cookie: f.ownerCookie }, { choice: "close", next: "/asks" });
138 const again = await post({ origin: f.base, cookie: f.ownerCookie }, { choice: "close", next: "/apps" });
139139 expect(again.status).toBe(303);
140140 expect(open()).toBe(3);
141141 // The button: one press and the app is on again, its row back with its choices.
@@ -143,13 +143,13 @@ test("Turn this app off: the row's button archives the repository, its row is go
143143 method: "POST",
144144 redirect: "manual",
145145 headers: { "content-type": "application/x-www-form-urlencoded", origin: f.base, cookie: f.ownerCookie },
146 body: new URLSearchParams({ archived: "0", to: "/asks" }),
146 body: new URLSearchParams({ archived: "0", to: "/apps" }),
147147 });
148148 expect(on.status).toBe(303);
149 expect(on.headers.get("location")).toBe("/asks");
149 expect(on.headers.get("location")).toBe("/apps");
150150 expect(getRepoById(f.app.db, repoId)!.archivedAt).toBeNull();
151151 forgetStuckRepos(f.app.db);
152 const back = await page(`/asks?off=${repoId}`);
152 const back = await page(`/apps?off=${repoId}`);
153153 expect(back).toContain(`action="${path}/stuck"`);
154154 expect(back).not.toContain("data-standing-off");
155155 });
test/talk-decisions.test.ts +3 −3
@@ -117,13 +117,13 @@ describe("talk answers what needs me", () => {
117117 }
118118 const text = await answer(alice, "inbox");
119119 expect(text.split("\n").filter((l) => /^\d+\. \[/.test(l)).length).toBe(DECISIONS_MAX);
120 expect(text).toMatch(/\[\d+ more in your inbox\]\(\/asks\)/);
120 expect(text).toMatch(/\[\d+ more in your inbox\]\(\/\?waits=me\)/);
121121 });
122122
123 test("a proposal row links /asks with Approve", () => {
123 test("a proposal row links the waits-for-me view with Approve", () => {
124124 const proposal: Proposal = { id: "1", repoId: repo.id, authorId: alice.id, title: "Plan", why: "", issues: [], state: "pending", createdAt: "2026-11-14T00:00:00.000Z" };
125125 const d: Decision = { kind: "proposal", id: "proposal:1", repo, proposal, who: "planner", says: "", short: 'proposes "Plan"', consequence: KIND_TIER.proposal, waiting: { word: "a decision", on: "you" } };
126 expect(actionHref(d)).toBe("/asks");
126 expect(actionHref(d)).toBe("/?waits=me");
127127 expect(primaryLabel(d)).toBe("Approve");
128128 });
129129
test/tui-yours-asks.test.ts +1 −1
@@ -135,7 +135,7 @@ describe("terminal On you: the week's asks", () => {
135135 try {
136136 expect(t.text()).toContain("W asks on the web");
137137 await t.key("W");
138 expect(t.text()).toContain("Asks is on the web at /asks");
138 expect(t.text()).toContain("Waiting is on the web at /?waits=me");
139139 } finally {
140140 t.app.stop();
141141 }
test/waits-for-me.test.ts added +54
@@ -0,0 +1,54 @@
1 /**
2 * What waits for a person: one read shared by the board's filter and the terminal's list; the
3 * read is held per viewer, and a lane's ETag carries the set so a change is never answered 304.
4 */
5
6 import { afterAll, beforeAll, expect, test } from "bun:test";
7 import { mkdtemp, rm } from "node:fs/promises";
8 import { tmpdir } from "node:os";
9 import { join } from "node:path";
10 import { createApp, type App as Forge } from "../src/app.ts";
11 import type { User } from "../src/core/users.ts";
12 import { Session } from "../src/tui/session.ts";
13 import { waitingForMeLines, entry } from "../src/tui/screens/waiting_for_me.ts";
14 import { waitingRows, waitsDigest } from "../src/web/studio/waiting_on_me.ts";
15 import { quietLogs } from "./helpers/globals.ts";
16 import { seedAdmin } from "./helpers/admin.ts";
17
18 quietLogs();
19
20 let dir: string;
21 let forge: Forge;
22 let alice: User;
23
24 beforeAll(async () => {
25 dir = await mkdtemp(join(tmpdir(), "forge-waits-me-"));
26 forge = createApp({ dataDir: dir, port: 0 });
27 const a = await seedAdmin(forge, { username: "alice", email: "[email protected]", password: "a-long-passphrase" });
28 if (!a.ok) throw new Error("signup failed");
29 alice = a.value;
30 });
31 afterAll(async () => {
32 await rm(dir, { recursive: true, force: true });
33 });
34
35 test("the digest changes with the set and not with its order", () => {
36 expect(waitsDigest(new Set(["a#1", "b#2"]))).toBe(waitsDigest(new Set(["b#2", "a#1"])));
37 expect(waitsDigest(new Set(["a#1"]))).not.toBe(waitsDigest(new Set(["a#1", "a#2"])));
38 expect(waitsDigest(new Set())).not.toBe(waitsDigest(new Set(["a#1"])));
39 });
40
41 test("the read is held for a moment per viewer, then read again", () => {
42 const reader = { app: forge, auth: { user: alice } };
43 const t = Date.now();
44 const first = waitingRows(reader, alice, t);
45 expect(waitingRows(reader, alice, t + 1_000)).toBe(first);
46 expect(waitingRows(reader, alice, t + 60_000)).not.toBe(first);
47 });
48
49 test("the terminal lists each card with what it waits for, and offers itself to people only", () => {
50 const lines = waitingForMeLines([{ key: "r#7", repo: "a/b", number: 7, kind: "pull", title: "Add x", short: "ready to land" }]);
51 expect(lines).toEqual(["a/b#7 pull: Add x", " ready to land"]);
52 expect(entry.offered(new Session(forge, { sshUsername: "alice", remoteAddress: "127.0.0.1", user: alice }))).toBe(true);
53 expect(entry.offered(new Session(forge, { sshUsername: "guest", remoteAddress: "127.0.0.1" }))).toBe(false);
54 });
test/web-apps.test.ts +3 −3
@@ -961,11 +961,11 @@ describe("apps, runs and the crew on the web", () => {
961961 form: { assignee: "alice" },
962962 });
963963 expect(assigned.status).toBe(303);
964 const dash = await bodyOf(alice, "/asks");
964 const dash = await bodyOf(alice, "/live/on-you");
965965 expect(dash).toContain('<section id="needs-you"');
966966 expect(dash).toMatch(/<h2 id="asks-sentence">\d+ things? needs? you<\/h2>/);
967967 expect(dash).toContain("Say hello");
968 expect(await bodyOf(bob, "/asks")).not.toContain('<section id="needs-you"');
968 expect(await bodyOf(bob, "/live/on-you")).not.toContain('<section id="needs-you"');
969969
970970 // Needs you: a pull the crew opened, in a repository alice can write.
971971 expect(addToCrew(app, aliceUser, hello, "bot").ok).toBe(true);
@@ -986,7 +986,7 @@ describe("apps, runs and the crew on the web", () => {
986986 // racing to finish here: when it does, the dashboard links to /asks
987987 // rather than listing it (test/asks.test.ts holds that page to account).
988988 // Bob can read the public repo but not write it: not his inbox.
989 expect(await bodyOf(bob, "/asks")).not.toContain('<section id="needs-you"');
989 expect(await bodyOf(bob, "/live/on-you")).not.toContain('<section id="needs-you"');
990990 });
991991
992992 test("the assignee select offers the people who can read the repository", async () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs