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

The owner's home shows no asks; the planner's decline moves to /board and the asks page (test updated on purpose) #2782

Parked opened this
Closed without merging

scout/forge:scout/2764-the-owner-s-home-shows-no-asks-the-plann → main 2 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
20 files changed +116 −112
README.md +5 −3
@@ -566,11 +566,11 @@ my machine", and the dashboard grows an **On your machine** card listing them.
566566 The server remembers only the choice — nothing about the state of a laptop —
567567 and `forge sync` below is what acts on it.
568568
569 **What an ask row waits for.** Every ask row carries one word, `waitingFor` (`src/core/waiting_for.ts`, computed once), and who it waits on, e.g. "ready to land · on you". The first that applies wins: `conflicts with main` (the last sweep found files stopping the pull, on its author), `ready to land` (a green change to look at and ship), `a review` (a review or a hand-over), `assigned to you` (the pull or issue is assigned to the viewer), otherwise `a decision`. It shows as a chip on each row of the home, as `waitingFor: {word, on}` in `GET /api/v1/asks` and the MCP `asks` tool, and in the terminal's On you card. A grouped row shares one word (the weightiest of its items), and the terminal's card shows its row's word.
569 **What an ask row waits for.** Every ask row carries one word, `waitingFor` (`src/core/waiting_for.ts`, computed once), and who it waits on, e.g. "ready to land · on you". The first that applies wins: `conflicts with main` (the last sweep found files stopping the pull, on its author), `ready to land` (a green change to look at and ship), `a review` (a review or a hand-over), `assigned to you` (the pull or issue is assigned to the viewer), otherwise `a decision`. It shows as a chip on each row of the asks page, as `waitingFor: {word, on}` in `GET /api/v1/asks` and the MCP `asks` tool, and in the terminal's On you card. A grouped row shares one word (the weightiest of its items), and the terminal's card shows its row's word.
570570
571 **Muting a repository from the home**: each ask row on the home carries a "Mute owner/name" chip. A muted repository's asks leave the home, `/api/v1/asks`, the header count and the phone's pushes (the same per-user mute the On you card uses, no new table); the home says "N muted repositories still ask" with a "Listen again" button, and an app's own page still counts them.
571 **Muting a repository from the asks page**: each ask row on `/asks` carries a "Mute owner/name" chip. A muted repository's asks leave the asks page, `/api/v1/asks`, the header count and the phone's pushes (the same per-user mute the On you card uses, no new table); the page says "N muted repositories still ask" with a "Listen again" button, and an app's own page still counts them.
572572
573 **A wave proposal is one card.** With "plans need a nod" on, a plan the planner writes is kept as a proposal and opens nothing. It is one row in the asks list (home, `/asks`, `/api/v1/asks`, MCP `asks`, the terminal's On you card) with its title, its why and its issue titles, all escaped, and it asks the app's owner only. Three taps, each one POST that leaves you on the page you were on: **Approve** opens the issues with their links, exactly as an unheld plan would; **Redirect** takes a text box and hands your words to the planner as a new run on the direction issue; **Later** hides it until you bring it back, from the "N waves put aside" line under the asks (each with a "Bring back" button). A proposal is decided once. The same four verbs (`approve`, `redirect`, `later`, `again`) are on every door, all calling `actions/proposals.ts`: the page (`/asks/proposal/<id>/<verb>`), the API (`POST /api/v1/asks/proposal/<id>/<verb>`, a `rw` token, `{"words": …}` for redirect), the MCP tool `asks_proposal` (`id`, `verb`, `words`), and in the terminal `y` approve, `R` redirect, `l` later and `B` bring every put-aside wave back, on a wave row of the On you card.
573 **A wave proposal is one card.** With "plans need a nod" on, a plan the planner writes is kept as a proposal and opens nothing. It is one row in the asks list (`/asks`, `/api/v1/asks`, MCP `asks`, the terminal's On you card) with its title, its why and its issue titles, all escaped, and it asks the app's owner only. Three taps, each one POST that leaves you on the page you were on: **Approve** opens the issues with their links, exactly as an unheld plan would; **Redirect** takes a text box and hands your words to the planner as a new run on the direction issue; **Later** hides it until you bring it back, from the "N waves put aside" line under the asks (each with a "Bring back" button). A proposal is decided once. The same four verbs (`approve`, `redirect`, `later`, `again`) are on every door, all calling `actions/proposals.ts`: the page (`/asks/proposal/<id>/<verb>`), the API (`POST /api/v1/asks/proposal/<id>/<verb>`, a `rw` token, `{"words": …}` for redirect), the MCP tool `asks_proposal` (`id`, `verb`, `words`), and in the terminal `y` approve, `R` redirect, `l` later and `B` bring every put-aside wave back, on a wave row of the On you card.
574574
575575 **Chips on the feed**: kind chips switch a kind of post off: `reviews` (pulls), `decisions` (decisions and choose decks), `crew` (tells, replies, looks) and `releases`; a person chip switches one person or agent off. Saved per user, one filter (`chipHides`) behind the home feed, `/api/v1/feed`, the Asks list and the terminal's inbox, and the MCP `feed` and `asks` tools, which also take `hide_kinds` and `hide_people` to replace the saved filter for that one call (`[]` lifts it). `/live/apps` (your apps) is not feed items, so chips do not apply there. `GET /api/v1/feed/chips` answers `{kinds, people}`; `POST /api/v1/feed/chips` takes `{"kind": "kind"|"person", "value": "reviews"|"<username>", "hidden": true|false}` (scope `rw`, same-origin). In the terminal dashboard `1`–`4` switch the kind chips `h` on an On you row switches its author off (not your own) and the author's rows leave the card, and `P` brings every person back. The `feed_chips` tool reads them (no arguments, any token) and switches one (`kind`, `value`, `hidden`; an `rw` token).
576576
@@ -1634,3 +1634,5 @@ operator. (The three guards of migrations 62, 70 and 81 predate the prefix and
16341634 are known by name in `src/http/refusal.ts`.) The terminal's toasts follow the
16351635 same rule. A guard installed by hand without the prefix answers `refused`
16361636 until it is re-created with `forge: ` in front of its message.
1637
1638 **The home shows no asks.** What needs you lives on its own page, `/asks` (a plain "Asks" link in the top bar, no count badge, and a line in the user menu). The signed-in home is the composer, the feed and your apps; it renders no for-you list, count or ask. A bulk step's preview and receipt, Undo, mute and decide all land on `/asks`.
src/http/server.ts +1 −1
@@ -254,6 +254,7 @@ import {
254254 asksListen,
255255 asksMute,
256256 asksPage,
257 liveOnYouFragment,
257258 } from "../web/studio/asks_page.ts";
258259 import { homeArchive, homeArchived, homeArchiveUndo } from "../web/studio/home_archive.ts";
259260 import { liveFeedFragment } from "../web/studio/feed.ts";
@@ -266,7 +267,6 @@ import {
266267 import {
267268 frontUpdate,
268269 liveAppsFragment,
269 liveOnYouFragment,
270270 studioDoor,
271271 } from "../web/studio/home.ts";
272272 import { appAnswersFragment } from "../web/studio/answers.ts";
src/web/layout.ts +3 −2
@@ -8,7 +8,6 @@
88 */
99
1010 import { protectionNotice } from "../kernel/protection.ts";
11 import { askCountFor } from "./studio/asks.ts";
1211 import { appsForRepos } from "../core/apps.ts";
1312 import { listReposVisibleTo } from "../core/repos.ts";
1413 import type { User } from "../core/users.ts";
@@ -215,6 +214,7 @@ function userMenu(
215214 { label: "Your profile", href: `/${user.username}`, icon: "user" },
216215 { label: "Your repositories", href: "/", icon: "repo" },
217216 { label: "Apps", href: "/apps", icon: "rocket" },
217 { label: "Asks", href: "/asks", icon: "alert" },
218218 { label: "Explore", href: "/explore", icon: "search" },
219219 { label: "Map", href: "/map", icon: "map" },
220220 { separator: true, label: "" },
@@ -464,7 +464,8 @@ function topbar(
464464 <span class="topbar-tools">
465465 ${searchBar()}
466466 ${user
467 ? html`<span class="hide-sm">${newMenu(ctx)}</span>${userMenu(
467 ? html`<a class="btn hide-sm" data-size="sm" href="/asks">Asks</a
468 ><span class="hide-sm">${newMenu(ctx)}</span>${userMenu(
468469 ctx,
469470 user,
470471 theme,
src/web/pages/board.ts +2 −2
@@ -394,7 +394,7 @@ function reviewStrip(ctx: Ctx, scope: BoardScope): Html | null {
394394 if (!none && waits.length === 0) return [];
395395 const oldest = waits.map((w) => w.since).sort()[0];
396396 return [
397 html`<a class="board-asks" href="/#needs-you"
397 html`<a class="board-asks" href="/asks"
398398 ><b>${repo.name}</b>: ${none ? "No reviewer: agent pulls wait for you" : "agent pulls wait for your review"}${waits.length === 0
399399 ? null
400400 : html` · <b>${waits.length}</b> waiting since ${oldest!.slice(0, 10)}`}</a
@@ -421,7 +421,7 @@ function asksStrip(ctx: Ctx): Html | null {
421421 const since = new Date(Date.now() - ASKS_WINDOW_DAYS * 86_400_000).toISOString();
422422 const m = askMeasure(ctx.app.db, user.id, since);
423423 if (m.raised + m.acted + m.dismissed + m.expired === 0) return null;
424 return html`<a class="board-asks" id="asks-measure" href="/#needs-you"
424 return html`<a class="board-asks" id="asks-measure" href="/asks"
425425 >Asks, ${ASKS_WINDOW_DAYS} days: <b>${m.raised}</b> raised · <b>${m.acted}</b> acted
426426 on · <b>${m.dismissed}</b> dismissed · <b>${m.expired}</b> went by themselves</a
427427 >`;
src/web/pages/site.ts +1 −2
@@ -24,7 +24,6 @@ import { hasAnyUser, verifyPasswordThrottled, type User } from "../../core/users
2424 import { isThemeName } from "../../design/themes.ts";
2525 import { cookieValue, crossOrigin, type Ctx } from "../../http/context.ts";
2626 import { studioDoor, studioHome } from "../studio/home.ts";
27 import { homeTop } from "../studio/asks_page.ts";
2827 import { edgeLoginUrl } from "../../http/edge.ts";
2928 import { sshCommand } from "../../ssh/command.ts";
3029 import { hostOf, pageHead, signInFirst } from "../chrome.ts";
@@ -208,7 +207,7 @@ export function terminalCard(ctx: Ctx): Html {
208207 export async function home(ctx: Ctx): Promise<Response> {
209208 const user = ctx.auth.user;
210209 if (user === undefined) return studioDoor(ctx);
211 return await studioHome(ctx, user, homeTop(ctx));
210 return await studioHome(ctx, user);
212211 }
213212
214213 // ---- authentication ----
src/web/studio/asks_page.ts +50 −27
@@ -1,10 +1,10 @@
11 /**
2 * What needs you, pinned at the top of the home (#634): a sentence — *N
2 * What needs you, on its own page (`/asks`; #634 pinned it to the home, which the owner asked to be rid of): a sentence — *N
33 * things need you* — and under it the decision cards (`asks.ts`), then, for
44 * a site admin, one card per thing the forge itself needs. Every button is a
55 * plain form post. Many asks at once stay here too: tick them, pick one
66 * action, and the preview, the receipt and its Undo appear on top
7 * (`actions/asks_bulk.ts`). `/asks` was its own screen; it lands here now.
7 * (`actions/asks_bulk.ts`). It is the page at `/asks`; the home shows none of it.
88 */
99
1010 import type { WaitingFor } from "../../core/waiting_for.ts";
@@ -27,7 +27,6 @@ import { needLine } from "../../actions/health.ts";
2727 import type { Degraded } from "../../kernel/vitals.ts";
2828 import type { Ctx } from "../../http/context.ts";
2929 import type { User } from "../../core/users.ts";
30 import { onYouAnswer, studioHome } from "./home.ts";
3130 import { notFoundPage, repoBase, signInFirst } from "../chrome.ts";
3231 import { backTo, field, readForm } from "../form.ts";
3332 import { MAX_BODY } from "../../core/issues.ts";
@@ -40,7 +39,9 @@ import {
4039 ownerFactRepoIds,
4140 } from "../../core/repos.ts";
4241 import { html, type Html } from "../html.ts";
43 import { redirect } from "../layout.ts";
42 import { fragment, page, redirect } from "../layout.ts";
43 import { liveRegionsJs } from "../client.ts";
44 import { liveClientJs } from "../live.ts";
4445 import { btn, card, icon, row } from "../ui.ts";
4546 import {
4647 askAnchor,
@@ -332,19 +333,36 @@ export interface AsksTop {
332333 readonly reason?: string;
333334 }
334335
335 /** GET /asks — the home, scrolled to what needs you; `?op=<id>` (a bulk
336 * action's receipt) rides along. */
337 export function asksPage(ctx: Ctx): Response {
338 const op = ctx.url.searchParams.get("op");
339 return redirect(
340 op === null
341 ? "/#needs-you"
342 : `/?op=${encodeURIComponent(op)}#asks-bulk-result`,
343 );
336 /** GET /asks — what needs you; `?op=<id>` (a bulk action's receipt) and
337 * `?decided=<id>` ride along. A stranger is sent to sign in. */
338 export async function asksPage(ctx: Ctx): Promise<Response> {
339 return await asksScreen(ctx, asksTop(ctx));
344340 }
345341
346 /** The receipt `?op=<id>` names on the home, when it is the viewer's own. */
347 export function homeTop(ctx: Ctx): AsksTop | undefined {
342 /** The events that can change what is on you. */
343 const ON_YOU_LIVE =
344 "issue.assigned,pull.assigned,issue.closed,pull.closed,issue.reopened,pull.reopened,pull.merged,fleet.operated";
345
346 const onYouRegion = (ctx: Ctx, user: User, note?: string, section: Html = needsYouSection(ctx, user).body): Html =>
347 html`<div id="live-on-you" data-live="${ON_YOU_LIVE}" data-live-src="/live/on-you">
348 ${note === undefined ? null : html`<p class="small" role="status">${note}</p>`}
349 ${section}
350 </div>`;
351
352 /** What a bulk step answers its own script with: the region as it is now. */
353 function onYouAnswer(ctx: Ctx, user: User, note?: string): Response {
354 return fragment(html`<div>${onYouRegion(ctx, user, note)}</div>`);
355 }
356
357 // GET /live/on-you — what is on the viewer, alone.
358 export function liveOnYouFragment(ctx: Ctx): Response {
359 const user = ctx.auth.user;
360 if (!user) return fragment(html``, { status: 404 });
361 return fragment(onYouRegion(ctx, user), { request: ctx.request });
362 }
363
364 /** The receipt `?op=<id>` names, when it is the viewer's own. */
365 function asksTop(ctx: Ctx): AsksTop | undefined {
348366 const decided = ctx.url.searchParams.get("decided");
349367 if (decided !== null) return handedTop(ctx, decided);
350368 const op = ctx.url.searchParams.get("op");
@@ -487,12 +505,17 @@ export function needsYouSection(
487505 return { body, scriptJs: SELECT_JS };
488506 }
489507
490 /** The home with a bulk step's preview or receipt on top of what needs
491 * you — where every bulk answer lands. */
492 async function asksScreen(ctx: Ctx, top: AsksTop): Promise<Response> {
508 /** The asks page, with a bulk step's preview or receipt on top of what needs you. */
509 async function asksScreen(ctx: Ctx, top?: AsksTop): Promise<Response> {
493510 const user = ctx.auth.user;
494511 if (!user) return signInFirst(ctx);
495 return await studioHome(ctx, user, top);
512 const needsYou = needsYouSection(ctx, user, top);
513 return page({
514 ctx,
515 title: "Asks",
516 body: html`<h1 class="sr-only">Asks</h1>${onYouRegion(ctx, user, undefined, needsYou.body)}`,
517 scriptJs: `${liveClientJs}\n${liveRegionsJs}\n${needsYou.scriptJs}`,
518 });
496519 }
497520
498521 // ---- many at once: select, preview, do it, undo — all on this screen ----
@@ -641,7 +664,7 @@ export async function asksBulkSubmit(ctx: Ctx): Promise<Response> {
641664 : `${why.length} not done: ${[...new Set(why.filter((w) => w !== ""))].join("; ") || "refused"}`;
642665 return onYouAnswer(ctx, ctx.auth.user, note);
643666 }
644 return redirect(`/?op=${op.value.id}#asks-bulk-result`);
667 return redirect(`/asks?op=${op.value.id}#asks-bulk-result`);
645668 }
646669 const plan = previewAsksBulk(ctx.app, ctx.auth.user, action, items, reason);
647670 if (!plan.ok) return await asksScreen(ctx, nothingDone(plan.error.message));
@@ -675,7 +698,7 @@ export async function asksBulkUndo(ctx: Ctx): Promise<Response> {
675698 return op.error.code === "not_found"
676699 ? notFoundPage(ctx)
677700 : await asksScreen(ctx, nothingDone(op.error.message));
678 return redirect(`/?op=${op.value.id}#asks-bulk-result`);
701 return redirect(`/asks?op=${op.value.id}#asks-bulk-result`);
679702 }
680703
681704 /** POST /asks/decide — hand one hand-over card to the decider; the ledger keeps what it saw. */
@@ -685,7 +708,7 @@ export async function asksDecide(ctx: Ctx): Promise<Response> {
685708 if (form instanceof Response) return form;
686709 const done = await decideAsk(ctx.app, ctx.auth.user, field(form, "ask"));
687710 if (!done.ok) return await asksScreen(ctx, nothingDone(done.error.message));
688 return redirect(`/?decided=${done.value.id}#asks-bulk-result`);
711 return redirect(`/asks?decided=${done.value.id}#asks-bulk-result`);
689712 }
690713
691714 /** POST /asks/proposal/:id/(approve|redirect|later|again) — one wave proposal, then back to the page the person came from. */
@@ -701,7 +724,7 @@ export function asksProposal(verb: ProposalVerb) {
701724 : done.error.code === "forbidden" || done.error.code === "unauthorized"
702725 ? new Response("forbidden", { status: 403 })
703726 : await asksScreen(ctx, nothingDone(done.error.message));
704 return redirect(backTo(form, "/"));
727 return redirect(backTo(form, "/asks"));
705728 };
706729 }
707730
@@ -719,7 +742,7 @@ export async function asksSetting(ctx: Ctx): Promise<Response> {
719742 };
720743 return await asksScreen(ctx, nothingDone(why[done.error] ?? "it no longer asks you"));
721744 }
722 return redirect("/");
745 return redirect("/asks");
723746 }
724747
725748 /** POST /asks/decide/:id/undo — put a set-aside card back on the board, within a day. */
@@ -732,7 +755,7 @@ export async function asksDecideUndo(ctx: Ctx): Promise<Response> {
732755 return undone.error.code === "not_found"
733756 ? notFoundPage(ctx)
734757 : await asksScreen(ctx, nothingDone(undone.error.message));
735 return redirect(`/?decided=${undone.value.id}#asks-bulk-result`);
758 return redirect(`/asks?decided=${undone.value.id}#asks-bulk-result`);
736759 }
737760
738761 /** POST /asks/listen — take back the viewer's own mute of the repositories named. */
@@ -745,7 +768,7 @@ export async function asksListen(ctx: Ctx): Promise<Response> {
745768 .filter((r): r is string => typeof r === "string" && /^[A-Za-z0-9_-]{1,64}$/.test(r))
746769 .slice(0, BULK_MAX);
747770 removeMutes(ctx.app.db, ctx.auth.user.id, repos.map((r) => `repo:${r}`));
748 return redirect("/");
771 return redirect("/asks");
749772 }
750773
751774 /** POST /asks/mute — the viewer mutes one repository they can read: its asks leave their home, inbox and phone. */
@@ -759,5 +782,5 @@ export async function asksMute(ctx: Ctx): Promise<Response> {
759782 const repo = getRepoById(ctx.app.db, id);
760783 if (!repo || !canRead(ctx.app.db, repo, ctx.auth.user)) return notFoundPage(ctx);
761784 muteRepo(ctx.app.db, ctx.auth.user.id, repo.id);
762 return redirect("/");
785 return redirect("/asks");
763786 }
src/web/studio/home.ts +3 −39
@@ -1,6 +1,6 @@
11 /**
22 * The home in the studio: signed in, the feed — the composer, then one
3 * timeline — with your apps and what is on you beside it (#599). Built from
3 * timeline — with your apps beside it (#599). Built from
44 * the same cards as the rest of the forge, from grouped reads only, so the
55 * page does not get slower as the apps grow. A stranger gets the door instead: the forge featured, then the
66 * best of what is public (`actions/front.ts`).
@@ -45,7 +45,6 @@ import {
4545 terminalCard,
4646 } from "../pages/site.ts";
4747 import { writableAppsOf } from "./asks.ts";
48 import { needsYouSection, type AsksTop } from "./asks_page.ts";
4948 import { flowCards } from "./flow_card.ts";
5049 import { composer, feedJs, feedNote, feedRegion } from "./feed.ts";
5150 import { homeTabs } from "./home_tabs.ts";
@@ -56,9 +55,6 @@ import { spawnedOrg } from "../../spawn/claim.ts";
5655 import { clientApps } from "./client_home.ts";
5756 import { passkeyJs } from "../passkey-client.ts";
5857
59 /** The events that can change what is on you. */
60 const ON_YOU_LIVE =
61 "issue.assigned,pull.assigned,issue.closed,pull.closed,issue.reopened,pull.reopened,pull.merged,fleet.operated";
6258 /** The events that can change how an app on the rail is. */
6359 const APPS_LIVE = "app.serving,app.stopped,run.finished,fleet.operated";
6460 /** How many of your apps the rail names before "All apps". */
@@ -155,21 +151,6 @@ const appsRegion = (ctx: Ctx, user: User): Html =>
155151 ${yourApps(ctx, user)}
156152 </div>`;
157153
158 const onYouRegion = (
159 ctx: Ctx,
160 user: User,
161 note?: string,
162 section: Html = needsYouSection(ctx, user).body,
163 ): Html =>
164 html`<div
165 id="live-on-you"
166 data-live="${ON_YOU_LIVE}"
167 data-live-src="/live/on-you"
168 >
169 ${note === undefined ? null : html`<p class="small" role="status">${note}</p>`}
170 ${section}
171 </div>`;
172
173154 // GET /live/apps — your apps alone, for the region that shows them.
174155 export function liveAppsFragment(ctx: Ctx): Response {
175156 const user = ctx.auth.user;
@@ -177,21 +158,6 @@ export function liveAppsFragment(ctx: Ctx): Response {
177158 return fragment(appsRegion(ctx, user), { request: ctx.request });
178159 }
179160
180 /**
181 * What a bulk step on the On you list answers its own script with: the
182 * region as it is now and the top bar's Asks link with its new count.
183 */
184 export function onYouAnswer(ctx: Ctx, user: User, note?: string): Response {
185 return fragment(html`<div>${onYouRegion(ctx, user, note)}</div>`);
186 }
187
188 // GET /live/on-you — what is on the viewer, alone.
189 export function liveOnYouFragment(ctx: Ctx): Response {
190 const user = ctx.auth.user;
191 if (!user) return fragment(html``, { status: 404 });
192 return fragment(onYouRegion(ctx, user), { request: ctx.request });
193 }
194
195161 /**
196162 * Home, signed in, is the feed (#599), for every viewer whatever the mode
197163 * (#625): like opening X — the composer on top, then one timeline of posts
@@ -205,9 +171,7 @@ export function liveOnYouFragment(ctx: Ctx): Response {
205171 export async function studioHome(
206172 ctx: Ctx,
207173 user: User,
208 top?: AsksTop,
209174 ): Promise<Response> {
210 const needsYou = needsYouSection(ctx, user, top);
211175 const { repos: appRepos } = writableAppsOf(ctx, user);
212176 // A spawned forge says where it lives: the address its person shares.
213177 const spawned = await spawnedOrg(ctx.app);
@@ -256,7 +220,7 @@ export async function studioHome(
256220 ${homeTabs("feed")}
257221 <div class="dash">
258222 <div class="dash-main stack">
259 ${onYouRegion(ctx, user, undefined, needsYou.body)} ${composer(ctx, user)}
223 ${composer(ctx, user)}
260224 <div class="bar feed-head">
261225 <span class="spacer"></span>
262226 <a class="small muted" href="/asked">What you asked for</a>
@@ -281,7 +245,7 @@ export async function studioHome(
281245 ctx,
282246 title: "Home",
283247 body,
284 scriptJs: `${liveClientJs}\n${liveRegionsJs}\n${feedJs}\n${needsYou.scriptJs}${ask ? `\n${passkeyJs}` : ""}`,
248 scriptJs: `${liveClientJs}\n${liveRegionsJs}\n${feedJs}${ask ? `\n${passkeyJs}` : ""}`,
285249 });
286250 }
287251
test/asks-bulk.test.ts +1 −1
@@ -76,7 +76,7 @@ describe("acting on many asks at once", () => {
7676 });
7777 const location = res.headers.get("location");
7878 if (res.status === 303 && location !== null) {
79 expect(location).toStartWith("/?op=");
79 expect(location).toStartWith("/asks?op=");
8080 const next = await fetch(`${servers.url}${location}`, { headers, redirect: "manual" });
8181 expect(next.status).toBe(200);
8282 return (await next.text()).replace(/\s+/g, " ");
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("/");
129 const page = await get("/asks");
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("/");
155 const home = await get("/asks");
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("/");
172 let page = await get("/asks");
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("/");
182 page = await get("/asks");
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("/"))).toBe("All fine");
206 expect(sentence(await get("/asks"))).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("/"))).toBe("All fine");
234 expect(sentence(await get("/asks"))).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("/");
244 const home = await get("/asks");
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
@@ -60,7 +60,7 @@ describe("muting a repository's asks", () => {
6060 return ((await res.json()) as { rows: unknown[] }).rows;
6161 };
6262 const home = async () =>
63 await fetch(`${servers.url}/`, { headers: headers(cookie) }).then((r) => r.text());
63 await fetch(`${servers.url}/asks`, { headers: headers(cookie) }).then((r) => r.text());
6464
6565 const signIn = async (username: string) => {
6666 const res = await fetch(`${servers.url}/signin`, {
test/asks-rank.test.ts +10 −4
@@ -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("/");
207 const asks = await page("/asks");
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,13 @@ 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("/");
239 const home = await page("/asks");
240 // ...and the owner's home carries none of the six, nor a count of them.
241 const door = await page("/");
242 expect(home).toContain("6 things need you");
243 for (const gone of ['id="needs-you"', 'id="live-on-you"', 'id="asks-sentence"', 'id="ask-', "things need you", "6 things"])
244 expect(door).not.toContain(gone);
245 expect(door).toMatch(/<a class="btn hide-sm"[^>]*href="\/asks">Asks<\/a/);
240246 const asks = home.slice(home.indexOf('<section id="needs-you"'));
241247 const cards = (s: string) => (s.match(/class="card[" ]/g) ?? []).length;
242248 // Two before the phone's "more", three more inside it before the wide
@@ -340,7 +346,7 @@ describe("asks that earn their place", () => {
340346 expect((await mcpAsks()).measure.raised).toBe(6);
341347 });
342348 test("a phone's ask is a full-width row: kind and repo on one line, the decider apart, the rest behind More", async () => {
343 const home = await page("/");
349 const home = await page("/asks");
344350 const asks = home.slice(home.indexOf('<section id="needs-you"'));
345351 expect(asks).toContain("ask-card");
346352 expect(asks).toContain('<b class="ask-kind">');
@@ -357,7 +363,7 @@ describe("asks that earn their place", () => {
357363 // The security pull went red above; a new green one joins it in a row of two.
358364 check(security, "ok");
359365 await greenPull("security", "Another change here");
360 const asks = await page("/");
366 const asks = await page("/asks");
361367 expect(asks).toContain("2 green changes wait for your look");
362368 expect(asks).toContain("<b>security</b>: \u201cWiden the board id\u201d");
363369 // On a phone the row is its head line, its two asks one tap away; a
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}/`, { headers: { cookie } })).text();
153 const page = await (await fetch(`${servers.url}/asks`, { 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.test.ts +15 −15
@@ -104,16 +104,16 @@ describe("the asks page", () => {
104104 });
105105
106106 test("when nothing asks, it says All fine, and so does the header", async () => {
107 const page = await get(alice, "/");
107 const page = await get(alice, "/asks");
108108 expect(sentence(page)).toBe("All fine");
109109 expect(headerCount(page)).toBe(0);
110 expect(await get(alice, "/")).not.toContain('<section id="needs-you"');
110 expect(await get(alice, "/asks")).not.toContain('<section id="needs-you"');
111111 });
112112
113 test("/asks lands on the home's pinned needs-you, and a signed-out reader there gets the door, no asks", async () => {
113 test("/asks is the page of asks; a signed-out reader is sent to sign in, and the door shows no asks", async () => {
114114 const response = await fetch(`${servers.url}/asks`, { redirect: "manual" });
115115 expect(response.status).toBe(303);
116 expect(response.headers.get("location")).toBe("/#needs-you");
116 expect(response.headers.get("location")).toBe("/signin?next=%2Fasks");
117117 const door = await (await fetch(`${servers.url}/`)).text();
118118 expect(door).not.toContain('id="needs-you"');
119119 expect(door).not.toContain('id="asks-sentence"');
@@ -146,7 +146,7 @@ describe("the asks page", () => {
146146 claimRun(app.db, run.id);
147147 finishRun(app.db, run.id, { state: "failed", summary: "red" });
148148 // Failed but the crew is still trying: that is working, not an ask.
149 expect(sentence(await get(alice, "/"))).toBe("All fine");
149 expect(sentence(await get(alice, "/asks"))).toBe("All fine");
150150 recordDecision(app.db, {
151151 kind: "retry",
152152 repoId: repo.id,
@@ -157,16 +157,16 @@ describe("the asks page", () => {
157157 by: "rule",
158158 ms: 1,
159159 });
160 const page = await get(alice, "/");
160 const page = await get(alice, "/asks");
161161 expect(sentence(page)).toBe("1 thing needs you");
162162 expect(page).toContain("Bot did a thing");
163163 expect(headerCount(page)).toBe(1);
164164 // The home counts it in the header's Asks link; the dev dashboard's
165165 // own "needs you" line went with the dashboard (#625).
166 const home = await get(alice, "/");
166 const home = await get(alice, "/asks");
167167 expect(headerCount(home)).toBe(1);
168168 // Bob can read the public repository but cannot write it: not his ask.
169 expect(sentence(await get(bob, "/"))).toBe("All fine");
169 expect(sentence(await get(bob, "/asks"))).toBe("All fine");
170170 });
171171
172172 test("a forge health problem is a card for an admin and for no one else", async () => {
@@ -174,11 +174,11 @@ describe("the asks page", () => {
174174 app.db
175175 .query("UPDATE run SET created_at = ?1 WHERE state = 'queued'")
176176 .run(new Date(Date.now() - 3 * 3_600_000).toISOString());
177 const admin = await get(alice, "/");
177 const admin = await get(alice, "/asks");
178178 expect(admin).toContain("behind one lane");
179179 expect(sentence(admin)).toBe("2 things need you");
180180 expect(headerCount(admin)).toBe(2);
181 const other = await get(bob, "/");
181 const other = await get(bob, "/asks");
182182 expect(other).not.toContain("behind one lane");
183183 expect(sentence(other)).toBe("All fine");
184184 });
@@ -224,17 +224,17 @@ describe("the asks page", () => {
224224 ms: 1,
225225 });
226226 const card = `id="ask-stopped:${pull.id}"`;
227 expect(await get(alice, "/")).toContain(card);
227 expect(await get(alice, "/asks")).toContain(card);
228228 // The re-run passes: the stop is answered, and the pull is green.
229229 check("ok");
230230 resolveOpen(app.db, pull.id, "retry", "green");
231 const green = await get(alice, "/");
231 const green = await get(alice, "/asks");
232232 expect(green).not.toContain(card);
233233 expect(green).toContain(`id="ask-look:${pull.id}"`);
234234 // Red again, before anything new is decided: the old stop is spent, and
235235 // the crew's tries are what the card is counted from.
236236 check("failed");
237 expect(await get(alice, "/")).not.toContain(card);
237 expect(await get(alice, "/asks")).not.toContain(card);
238238 });
239239
240240 test("a green change's card says what its tests did", async () => {
@@ -309,11 +309,11 @@ describe("the asks page", () => {
309309 expect(card.says).toContain("alice");
310310 expect(card.says).toContain("checks.concurrency");
311311 expect(ASK_WORDS.setting.options).toEqual(["Keep", "Put back"]);
312 const page = await get(alice, "/");
312 const page = await get(alice, "/asks");
313313 expect(page).toContain("Keep");
314314 expect(page).toContain("Put back");
315315 // not for a person who cannot put it back
316 expect(await get(bob, "/")).not.toContain("Put back");
316 expect(await get(bob, "/asks")).not.toContain("Put back");
317317 expect(listEvents(app.db, { kind: "issue.assigned" }).length).toBe(0);
318318 });
319319
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 = "/"): Promise<string> =>
84 const home = async (path = "/asks"): Promise<string> =>
8585 (await (await fetch(`${servers.url}${path}`, { headers: { cookie } })).text()).replace(/\s+/g, " ");
8686
8787 beforeAll(async () => {
test/home-feed.test.ts +2 −2
@@ -371,7 +371,7 @@ describe("home is the feed", () => {
371371 if (!one.ok || !two.ok) throw new Error("issues");
372372 for (const [repo, issue] of [[garden, one.value], [vault, two.value]] as const)
373373 expect(assignIssue(app, alice, repo, issue, alice).ok).toBe(true);
374 const text = await (await get("/", aliceCookie)).text();
374 const text = await (await get("/asks", aliceCookie)).text();
375375 const card = text.slice(text.indexOf('id="live-on-you"')).replace(/\s+/g, " ");
376376 expect(card).toContain("things need you");
377377 expect(card).toContain("assigned to you");
@@ -389,7 +389,7 @@ describe("home is the feed", () => {
389389 expect(text).toContain("fleet.operated");
390390 expect(text).toContain("data-pick");
391391 // Alone, a single row stays a plain link.
392 const bobCard = await (await get("/", bobCookie)).text();
392 const bobCard = await (await get("/asks", bobCookie)).text();
393393 expect(bobCard).not.toContain('id="asks-bulk"');
394394 });
395395 });
test/live-pages.test.ts +5 −1
@@ -161,8 +161,12 @@ describe("live browsing pages", () => {
161161 })
162162 ).text();
163163 expect(html).toContain('id="live-apps"');
164 expect(html).toContain('id="live-on-you"');
164 expect(html).not.toContain('id="live-on-you"');
165165 expect(html).toContain("new EventSource('/events')");
166 const asks = await (
167 await fetch(`${base}/asks`, { headers: { cookie: `${cookie}; forge_mode=studio` } })
168 ).text();
169 expect(asks).toContain('id="live-on-you"');
166170 });
167171
168172 test("a live region never swaps out from under a card that is mid-decision", async () => {
test/planner-declined.test.ts +3 −1
@@ -183,7 +183,9 @@ describe("the planner declined, waiting for a person", () => {
183183 expect(board).toContain(
184184 `action="/alice/garden/issues/${direction.number}/comments"`,
185185 );
186 const asks = await page(aliceCookie, "/");
186 // The owner's home shows no asks (#2764): the decline is on the asks page.
187 expect(await page(aliceCookie, "/")).not.toContain("The planner declined the direction");
188 const asks = await page(aliceCookie, "/asks");
187189 expect(asks).toContain("The planner declined the direction");
188190 expect(asks).toContain(
189191 `/alice/garden/issues/${direction.number}#comment-body`,
test/proposal-card.test.ts +1 −1
@@ -156,7 +156,7 @@ describe("a wave proposal is one inbox card", () => {
156156 test("home shows the Redirect box on the card, and Later's way back", async () => {
157157 const id = propose("Home wave");
158158 const get = async () =>
159 (await (await fetch(`${servers.url}/`, { headers: { cookie: `${aliceCookie}; forge_mode=studio` } })).text());
159 (await (await fetch(`${servers.url}/asks`, { headers: { cookie: `${aliceCookie}; forge_mode=studio` } })).text());
160160 expect(await get()).toContain(`/asks/proposal/${id}/redirect`);
161161 await post(aliceCookie, `/asks/proposal/${id}/later`, [["back", "/"]]);
162162 const page = await get();
test/review-wait.test.ts +1 −1
@@ -34,7 +34,7 @@ describe("a green agent pull and its reviewer", () => {
3434
3535 const home = async (): Promise<string> =>
3636 (
37 await (await fetch(`${servers.url}/`, { headers: { cookie } })).text()
37 await (await fetch(`${servers.url}/asks`, { headers: { cookie } })).text()
3838 ).replace(/\s+/g, " ");
3939 const wordCtx = (): WordCtx => ({ db: app.db }) as unknown as WordCtx;
4040
test/web.test.ts +3
@@ -1,4 +1,5 @@
11 import { afterAll, beforeAll, describe, expect, test } from "bun:test";
2 import { quietLogs } from "./helpers/globals.ts";
23 import { mkdtemp, rm } from "node:fs/promises";
34 import { tmpdir } from "node:os";
45 import { join } from "node:path";
@@ -900,6 +901,8 @@ describe("the security floor is on every response", () => {
900901 });
901902
902903 describe("a refused cross-origin mutation says why in the log", () => {
904 // The refusal is a warning: hold the floor there, whatever an earlier file left.
905 quietLogs("warn");
903906 let dataDir: string;
904907 let app: App;
905908 let servers: Servers;

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs