Public: anyone can read this; the crew can change it.
The owner's home has no things-for-me list #2756
scout/forge:scout/2738-the-owner-s-home-has-no-things-for-me-li → main 2 commits fork
17 files
changed +116
−63
README.md +1 −1
| @@ -566,7 +566,7 @@ my machine", and the dashboard grows an **On your machine** card listing them. | ||
| 566 | 566 | The server remembers only the choice — nothing about the state of a laptop — |
| 567 | 567 | and `forge sync` below is what acts on it. |
| 568 | 568 | |
| 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 (`/asks`), 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. | |
| 570 | 570 | |
| 571 | 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. |
| 572 | 572 |
docs/FEED.md +1 −1
| @@ -62,7 +62,7 @@ that item has gone). | ||
| 62 | 62 | `/` for a signed-in viewer is the feed (#599): the composer on top (a tell to |
| 63 | 63 | one of your apps; through the outbox to `POST /api/v1/feed/tells`, or `POST |
| 64 | 64 | /tell` without a script), then the first 20 items as posts, server-side; your |
| 65 | apps and what is on you in a narrow column on a desk, a tab away on a phone. | |
| 65 | apps in a narrow column (what is on you is not on the home: it is `/asks`, linked from the top bar without a count) on a desk, a tab away on a phone. | |
| 66 | 66 | The app rows and the cost line are `/apps`. `/live/feed` answers the timeline |
| 67 | 67 | region for the live-regions client (etag, 304). A post: who did it, what it |
| 68 | 68 | says as a link into the thing, a small line of why, Steer (run |
src/web/layout.ts +27
| @@ -287,6 +287,7 @@ const STATIC_PALETTE: PaletteItem[] = [ | ||
| 287 | 287 | { t: "Apps", h: "/apps", c: "Go to" }, |
| 288 | 288 | { t: "Explore", h: "/explore", c: "Go to" }, |
| 289 | 289 | { t: "Map", h: "/map", c: "Go to" }, |
| 290 | { t: "Asks", h: "/asks", c: "Go to" }, | |
| 290 | 291 | { t: "What you asked for", h: "/asked", c: "Go to" }, |
| 291 | 292 | { t: "Front page", h: "/front", c: "Go to" }, |
| 292 | 293 | { t: "New app", h: "/apps/new", c: "Create" }, |
| @@ -462,7 +463,33 @@ function topbar( | ||
| 462 | 463 | )} |
| 463 | 464 | <span class="spacer"></span> |
| 464 | 465 | <span class="topbar-tools"> |
| 466 | <<<<<<< HEAD | |
| 467 | ${when( | |
| 468 | user?.isAdmin === true, | |
| 469 | () => | |
| 470 | html`<a | |
| 471 | id="flow-link" | |
| 472 | class="btn" | |
| 473 | data-size="sm" | |
| 474 | href="/flow" | |
| 475 | title="The pipeline and its bottleneck" | |
| 476 | >${icon("activity")}<span class="hide-sm">Flow</span></a | |
| 477 | >`, | |
| 478 | )}${when( | |
| 479 | user !== undefined, | |
| 480 | () => | |
| 481 | html`<a | |
| 482 | id="asks-link" | |
| 483 | class="btn" | |
| 484 | data-size="sm" | |
| 485 | href="/asks" | |
| 486 | title="What is waiting for you" | |
| 487 | >${icon("check")}<span class="hide-sm">Asks</span></a | |
| 488 | >`, | |
| 489 | )}${searchBar()}<span class="hide-sm">${helpButton()}</span>${themeMenu(theme)} | |
| 490 | ======= | |
| 465 | 491 | ${searchBar()} |
| 492 | >>>>>>> origin/main | |
| 466 | 493 | ${user |
| 467 | 494 | ? html`<span class="hide-sm">${newMenu(ctx)}</span>${userMenu( |
| 468 | 495 | ctx, |
src/web/pages/board.ts +2 −2
| @@ -394,7 +394,7 @@ function reviewStrip(ctx: Ctx, scope: BoardScope): Html | null { | ||
| 394 | 394 | if (!none && waits.length === 0) return []; |
| 395 | 395 | const oldest = waits.map((w) => w.since).sort()[0]; |
| 396 | 396 | return [ |
| 397 | html`<a class="board-asks" href="/#needs-you" | |
| 397 | html`<a class="board-asks" href="/asks" | |
| 398 | 398 | ><b>${repo.name}</b>: ${none ? "No reviewer: agent pulls wait for you" : "agent pulls wait for your review"}${waits.length === 0 |
| 399 | 399 | ? null |
| 400 | 400 | : html` · <b>${waits.length}</b> waiting since ${oldest!.slice(0, 10)}`}</a |
| @@ -421,7 +421,7 @@ function asksStrip(ctx: Ctx): Html | null { | ||
| 421 | 421 | const since = new Date(Date.now() - ASKS_WINDOW_DAYS * 86_400_000).toISOString(); |
| 422 | 422 | const m = askMeasure(ctx.app.db, user.id, since); |
| 423 | 423 | 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" | |
| 425 | 425 | >Asks, ${ASKS_WINDOW_DAYS} days: <b>${m.raised}</b> raised · <b>${m.acted}</b> acted |
| 426 | 426 | on · <b>${m.dismissed}</b> dismissed · <b>${m.expired}</b> went by themselves</a |
| 427 | 427 | >`; |
src/web/pages/site.ts +1 −2
| @@ -24,7 +24,6 @@ import { hasAnyUser, verifyPasswordThrottled, type User } from "../../core/users | ||
| 24 | 24 | import { isThemeName } from "../../design/themes.ts"; |
| 25 | 25 | import { cookieValue, crossOrigin, type Ctx } from "../../http/context.ts"; |
| 26 | 26 | import { studioDoor, studioHome } from "../studio/home.ts"; |
| 27 | import { homeTop } from "../studio/asks_page.ts"; | |
| 28 | 27 | import { edgeLoginUrl } from "../../http/edge.ts"; |
| 29 | 28 | import { sshCommand } from "../../ssh/command.ts"; |
| 30 | 29 | import { hostOf, pageHead, signInFirst } from "../chrome.ts"; |
| @@ -208,7 +207,7 @@ export function terminalCard(ctx: Ctx): Html { | ||
| 208 | 207 | export async function home(ctx: Ctx): Promise<Response> { |
| 209 | 208 | const user = ctx.auth.user; |
| 210 | 209 | if (user === undefined) return studioDoor(ctx); |
| 211 | return await studioHome(ctx, user, homeTop(ctx)); | |
| 210 | return await studioHome(ctx, user); | |
| 212 | 211 | } |
| 213 | 212 | |
| 214 | 213 | // ---- authentication ---- |
src/web/studio/asks_page.ts +12 −15
| @@ -27,7 +27,7 @@ import { needLine } from "../../actions/health.ts"; | ||
| 27 | 27 | import type { Degraded } from "../../kernel/vitals.ts"; |
| 28 | 28 | import type { Ctx } from "../../http/context.ts"; |
| 29 | 29 | import type { User } from "../../core/users.ts"; |
| 30 | import { onYouAnswer, studioHome } from "./home.ts"; | |
| 30 | import { asksHome, onYouAnswer } from "./home.ts"; | |
| 31 | 31 | import { notFoundPage, repoBase, signInFirst } from "../chrome.ts"; |
| 32 | 32 | import { backTo, field, readForm } from "../form.ts"; |
| 33 | 33 | import { MAX_BODY } from "../../core/issues.ts"; |
| @@ -332,15 +332,12 @@ export interface AsksTop { | ||
| 332 | 332 | readonly reason?: string; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | /** GET /asks — the home, scrolled to what needs you; `?op=<id>` (a bulk | |
| 336 | * action's receipt) rides along. */ | |
| 335 | /** GET /asks — what needs you, on its own page; `?op=<id>` (a bulk | |
| 336 | * action's receipt) or `?decided=<id>` rides along. */ | |
| 337 | 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 | ); | |
| 338 | const user = ctx.auth.user; | |
| 339 | if (!user) return signInFirst(ctx); | |
| 340 | return asksHome(ctx, user, homeTop(ctx)); | |
| 344 | 341 | } |
| 345 | 342 | |
| 346 | 343 | /** The receipt `?op=<id>` names on the home, when it is the viewer's own. */ |
| @@ -487,12 +484,12 @@ export function needsYouSection( | ||
| 487 | 484 | return { body, scriptJs: SELECT_JS }; |
| 488 | 485 | } |
| 489 | 486 | |
| 490 | /** The home with a bulk step's preview or receipt on top of what needs | |
| 487 | /** The asks page with a bulk step's preview or receipt on top of what needs | |
| 491 | 488 | * you — where every bulk answer lands. */ |
| 492 | 489 | async function asksScreen(ctx: Ctx, top: AsksTop): Promise<Response> { |
| 493 | 490 | const user = ctx.auth.user; |
| 494 | 491 | if (!user) return signInFirst(ctx); |
| 495 | return await studioHome(ctx, user, top); | |
| 492 | return asksHome(ctx, user, top); | |
| 496 | 493 | } |
| 497 | 494 | |
| 498 | 495 | // ---- many at once: select, preview, do it, undo — all on this screen ---- |
| @@ -641,7 +638,7 @@ export async function asksBulkSubmit(ctx: Ctx): Promise<Response> { | ||
| 641 | 638 | : `${why.length} not done: ${[...new Set(why.filter((w) => w !== ""))].join("; ") || "refused"}`; |
| 642 | 639 | return onYouAnswer(ctx, ctx.auth.user, note); |
| 643 | 640 | } |
| 644 | return redirect(`/?op=${op.value.id}#asks-bulk-result`); | |
| 641 | return redirect(`/asks?op=${op.value.id}#asks-bulk-result`); | |
| 645 | 642 | } |
| 646 | 643 | const plan = previewAsksBulk(ctx.app, ctx.auth.user, action, items, reason); |
| 647 | 644 | if (!plan.ok) return await asksScreen(ctx, nothingDone(plan.error.message)); |
| @@ -675,7 +672,7 @@ export async function asksBulkUndo(ctx: Ctx): Promise<Response> { | ||
| 675 | 672 | return op.error.code === "not_found" |
| 676 | 673 | ? notFoundPage(ctx) |
| 677 | 674 | : await asksScreen(ctx, nothingDone(op.error.message)); |
| 678 | return redirect(`/?op=${op.value.id}#asks-bulk-result`); | |
| 675 | return redirect(`/asks?op=${op.value.id}#asks-bulk-result`); | |
| 679 | 676 | } |
| 680 | 677 | |
| 681 | 678 | /** POST /asks/decide — hand one hand-over card to the decider; the ledger keeps what it saw. */ |
| @@ -685,7 +682,7 @@ export async function asksDecide(ctx: Ctx): Promise<Response> { | ||
| 685 | 682 | if (form instanceof Response) return form; |
| 686 | 683 | const done = await decideAsk(ctx.app, ctx.auth.user, field(form, "ask")); |
| 687 | 684 | if (!done.ok) return await asksScreen(ctx, nothingDone(done.error.message)); |
| 688 | return redirect(`/?decided=${done.value.id}#asks-bulk-result`); | |
| 685 | return redirect(`/asks?decided=${done.value.id}#asks-bulk-result`); | |
| 689 | 686 | } |
| 690 | 687 | |
| 691 | 688 | /** POST /asks/proposal/:id/(approve|redirect|later|again) — one wave proposal, then back to the page the person came from. */ |
| @@ -732,7 +729,7 @@ export async function asksDecideUndo(ctx: Ctx): Promise<Response> { | ||
| 732 | 729 | return undone.error.code === "not_found" |
| 733 | 730 | ? notFoundPage(ctx) |
| 734 | 731 | : await asksScreen(ctx, nothingDone(undone.error.message)); |
| 735 | return redirect(`/?decided=${undone.value.id}#asks-bulk-result`); | |
| 732 | return redirect(`/asks?decided=${undone.value.id}#asks-bulk-result`); | |
| 736 | 733 | } |
| 737 | 734 | |
| 738 | 735 | /** POST /asks/listen — take back the viewer's own mute of the repositories named. */ |
src/web/studio/home.ts +19 −8
| @@ -202,12 +202,7 @@ export function liveOnYouFragment(ctx: Ctx): Response { | ||
| 202 | 202 | * your repositories are one step away on your own page. On a phone they are |
| 203 | 203 | * a tab away. The app rows and the cost line live on `/apps`. |
| 204 | 204 | */ |
| 205 | export async function studioHome( | |
| 206 | ctx: Ctx, | |
| 207 | user: User, | |
| 208 | top?: AsksTop, | |
| 209 | ): Promise<Response> { | |
| 210 | const needsYou = needsYouSection(ctx, user, top); | |
| 205 | export async function studioHome(ctx: Ctx, user: User): Promise<Response> { | |
| 211 | 206 | const { repos: appRepos } = writableAppsOf(ctx, user); |
| 212 | 207 | // A spawned forge says where it lives: the address its person shares. |
| 213 | 208 | const spawned = await spawnedOrg(ctx.app); |
| @@ -256,7 +251,7 @@ export async function studioHome( | ||
| 256 | 251 | ${homeTabs("feed")} |
| 257 | 252 | <div class="dash"> |
| 258 | 253 | <div class="dash-main stack"> |
| 259 | ${onYouRegion(ctx, user, undefined, needsYou.body)} ${composer(ctx, user)} | |
| 254 | ${composer(ctx, user)} | |
| 260 | 255 | <div class="bar feed-head"> |
| 261 | 256 | <span class="spacer"></span> |
| 262 | 257 | <a class="small muted" href="/asked">What you asked for</a> |
| @@ -281,7 +276,23 @@ export async function studioHome( | ||
| 281 | 276 | ctx, |
| 282 | 277 | title: "Home", |
| 283 | 278 | body, |
| 284 | scriptJs: `${liveClientJs}\n${liveRegionsJs}\n${feedJs}\n${needsYou.scriptJs}${ask ? `\n${passkeyJs}` : ""}`, | |
| 279 | scriptJs: `${liveClientJs}\n${liveRegionsJs}\n${feedJs}${ask ? `\n${passkeyJs}` : ""}`, | |
| 280 | }); | |
| 281 | } | |
| 282 | ||
| 283 | /** | |
| 284 | * The asks, on their own page (#2738): what is on the viewer, with a bulk | |
| 285 | * step's preview or receipt on top. The home carries none of it; the top | |
| 286 | * bar links here, without a count. | |
| 287 | */ | |
| 288 | export function asksHome(ctx: Ctx, user: User, top?: AsksTop): Response { | |
| 289 | const needsYou = needsYouSection(ctx, user, top); | |
| 290 | return page({ | |
| 291 | ctx, | |
| 292 | title: "Asks", | |
| 293 | body: html`<h1 class="sr-only">Asks</h1> | |
| 294 | <div class="stack">${onYouRegion(ctx, user, undefined, needsYou.body)}</div>`, | |
| 295 | scriptJs: `${liveClientJs}\n${liveRegionsJs}\n${needsYou.scriptJs}`, | |
| 285 | 296 | }); |
| 286 | 297 | } |
| 287 | 298 |
test/asks-bulk.test.ts +1 −1
| @@ -76,7 +76,7 @@ describe("acting on many asks at once", () => { | ||
| 76 | 76 | }); |
| 77 | 77 | const location = res.headers.get("location"); |
| 78 | 78 | if (res.status === 303 && location !== null) { |
| 79 | expect(location).toStartWith("/?op="); | |
| 79 | expect(location).toStartWith("/asks?op="); | |
| 80 | 80 | const next = await fetch(`${servers.url}${location}`, { headers, redirect: "manual" }); |
| 81 | 81 | expect(next.status).toBe(200); |
| 82 | 82 | 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", () => { | ||
| 126 | 126 | pears = await botPull("pears", [{ path: "PEARS.md", content: "pears\n" }]); |
| 127 | 127 | green(apples); |
| 128 | 128 | green(pears); |
| 129 | const page = await get("/"); | |
| 129 | const page = await get("/asks"); | |
| 130 | 130 | expect(sentence(page)).toBe("1 thing needs you"); |
| 131 | 131 | expect(headerCount(page)).toBe(1); |
| 132 | 132 | expect(page).toContain("2 green changes wait for your look"); |
| @@ -152,7 +152,7 @@ describe("asks that expire, hold and collapse", () => { | ||
| 152 | 152 | // card at all, so there is nothing to mute. |
| 153 | 153 | const fragment = await get("/live/feed"); |
| 154 | 154 | expect(fragment).not.toContain('data-kind="ask"'); |
| 155 | const home = await get("/"); | |
| 155 | const home = await get("/asks"); | |
| 156 | 156 | expect(home).toContain('<section id="needs-you"'); |
| 157 | 157 | const at = home.indexOf('<section id="needs-you"'); |
| 158 | 158 | expect(home.slice(at, home.indexOf("</section>", at))).not.toContain( |
| @@ -169,7 +169,7 @@ describe("asks that expire, hold and collapse", () => { | ||
| 169 | 169 | repoId: repo.id, |
| 170 | 170 | actorId: null, |
| 171 | 171 | }); |
| 172 | let page = await get("/"); | |
| 172 | let page = await get("/asks"); | |
| 173 | 173 | expect(sentence(page)).toBe("All fine"); |
| 174 | 174 | expect(headerCount(page)).toBe(0); |
| 175 | 175 | expect(askLinesFor(app.db, aliceUser)).toHaveLength(0); |
| @@ -179,7 +179,7 @@ describe("asks that expire, hold and collapse", () => { | ||
| 179 | 179 | // A new check on one of them: that one asks again, on its own. |
| 180 | 180 | await tick(); |
| 181 | 181 | green(apples); |
| 182 | page = await get("/"); | |
| 182 | page = await get("/asks"); | |
| 183 | 183 | expect(sentence(page)).toBe("1 thing needs you"); |
| 184 | 184 | const pinned = page.slice( |
| 185 | 185 | page.indexOf('<section id="needs-you"'), |
| @@ -203,7 +203,7 @@ describe("asks that expire, hold and collapse", () => { | ||
| 203 | 203 | repoId: repo.id, |
| 204 | 204 | actorId: null, |
| 205 | 205 | }); |
| 206 | expect(sentence(await get("/"))).toBe("All fine"); | |
| 206 | expect(sentence(await get("/asks"))).toBe("All fine"); | |
| 207 | 207 | // The merge box is the change's Files step (#628). |
| 208 | 208 | const change = await get( |
| 209 | 209 | `/${repo.ownerName}/${repo.name}/pulls/${apples.number}/files`, |
| @@ -231,7 +231,7 @@ describe("asks that expire, hold and collapse", () => { | ||
| 231 | 231 | }); |
| 232 | 232 | await sweepStaleAsks(app); |
| 233 | 233 | expect(askLinesFor(app.db, aliceUser)).toHaveLength(0); |
| 234 | expect(sentence(await get("/"))).toBe("All fine"); | |
| 234 | expect(sentence(await get("/asks"))).toBe("All fine"); | |
| 235 | 235 | // The feed and the MCP's asks carry no green line for it either. |
| 236 | 236 | expect( |
| 237 | 237 | readFeed(app.db, aliceUser, { limit: 50 }).items.some( |
| @@ -241,7 +241,7 @@ describe("asks that expire, hold and collapse", () => { | ||
| 241 | 241 | expect(JSON.stringify(asksAnswer({ app, auth: { user: aliceUser } } as never, aliceUser))).not.toContain("is green"); |
| 242 | 242 | // Assigned to alice, the home's one list says it conflicts, never ready. |
| 243 | 243 | setAssignee(app.db, plums.id, aliceUser.id); |
| 244 | const home = await get("/"); | |
| 244 | const home = await get("/asks"); | |
| 245 | 245 | expect(home).toContain("conflicts with main"); |
| 246 | 246 | expect(askLinesFor(app.db, aliceUser).map((l) => l.waitingFor.word)).toEqual(["conflicts with main"]); |
| 247 | 247 | // 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", () => { | ||
| 60 | 60 | return ((await res.json()) as { rows: unknown[] }).rows; |
| 61 | 61 | }; |
| 62 | 62 | 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()); | |
| 64 | 64 | |
| 65 | 65 | const signIn = async (username: string) => { |
| 66 | 66 | const res = await fetch(`${servers.url}/signin`, { |
test/asks-rank.test.ts +4 −4
| @@ -204,7 +204,7 @@ describe("asks that earn their place", () => { | ||
| 204 | 204 | expect(row.words).toEqual(ASK_WORDS.look); |
| 205 | 205 | expect(row.words.options.length).toBeGreaterThan(0); |
| 206 | 206 | } |
| 207 | const asks = await page("/"); | |
| 207 | const asks = await page("/asks"); | |
| 208 | 208 | expect(asks).toContain("If nobody acts, it waits; nothing ships."); |
| 209 | 209 | expect(asks).toContain("<b>security</b>"); |
| 210 | 210 | // The long sentence the card used to repeat is gone. |
| @@ -236,7 +236,7 @@ describe("asks that earn their place", () => { | ||
| 236 | 236 | for (const name of ["r4", "r5", "r6"]) |
| 237 | 237 | await greenPull(name, `Work in ${name}`); |
| 238 | 238 | // 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 | 240 | const asks = home.slice(home.indexOf('<section id="needs-you"')); |
| 241 | 241 | const cards = (s: string) => (s.match(/class="card[" ]/g) ?? []).length; |
| 242 | 242 | // Two before the phone's "more", three more inside it before the wide |
| @@ -340,7 +340,7 @@ describe("asks that earn their place", () => { | ||
| 340 | 340 | expect((await mcpAsks()).measure.raised).toBe(6); |
| 341 | 341 | }); |
| 342 | 342 | 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("/"); | |
| 343 | const home = await page("/asks"); | |
| 344 | 344 | const asks = home.slice(home.indexOf('<section id="needs-you"')); |
| 345 | 345 | expect(asks).toContain("ask-card"); |
| 346 | 346 | expect(asks).toContain('<b class="ask-kind">'); |
| @@ -357,7 +357,7 @@ describe("asks that earn their place", () => { | ||
| 357 | 357 | // The security pull went red above; a new green one joins it in a row of two. |
| 358 | 358 | check(security, "ok"); |
| 359 | 359 | await greenPull("security", "Another change here"); |
| 360 | const asks = await page("/"); | |
| 360 | const asks = await page("/asks"); | |
| 361 | 361 | expect(asks).toContain("2 green changes wait for your look"); |
| 362 | 362 | expect(asks).toContain("<b>security</b>: \u201cWiden the board id\u201d"); |
| 363 | 363 | // 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", () => { | ||
| 150 | 150 | expect(text).toContain("ready to land"); |
| 151 | 151 | expect(text).toContain("waitingFor"); |
| 152 | 152 | |
| 153 | const page = await (await fetch(`${servers.url}/`, { headers: { cookie } })).text(); | |
| 153 | const page = await (await fetch(`${servers.url}/asks`, { headers: { cookie } })).text(); | |
| 154 | 154 | expect(page).toContain('data-waiting="ready to land"'); |
| 155 | 155 | expect(page).toContain('<span class="sr-only">waiting for </span>ready to land'); |
| 156 | 156 | expect(page).toContain("ready to land · on you"); |
test/asks.test.ts +15 −15
| @@ -104,16 +104,16 @@ describe("the asks page", () => { | ||
| 104 | 104 | }); |
| 105 | 105 | |
| 106 | 106 | 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"); | |
| 108 | 108 | expect(sentence(page)).toBe("All fine"); |
| 109 | 109 | 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"'); | |
| 111 | 111 | }); |
| 112 | 112 | |
| 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 its own page, and a signed-out reader gets the sign-in, no asks", async () => { | |
| 114 | 114 | const response = await fetch(`${servers.url}/asks`, { redirect: "manual" }); |
| 115 | 115 | expect(response.status).toBe(303); |
| 116 | expect(response.headers.get("location")).toBe("/#needs-you"); | |
| 116 | expect(response.headers.get("location")).toStartWith("/signin"); | |
| 117 | 117 | const door = await (await fetch(`${servers.url}/`)).text(); |
| 118 | 118 | expect(door).not.toContain('id="needs-you"'); |
| 119 | 119 | expect(door).not.toContain('id="asks-sentence"'); |
| @@ -146,7 +146,7 @@ describe("the asks page", () => { | ||
| 146 | 146 | claimRun(app.db, run.id); |
| 147 | 147 | finishRun(app.db, run.id, { state: "failed", summary: "red" }); |
| 148 | 148 | // 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"); | |
| 150 | 150 | recordDecision(app.db, { |
| 151 | 151 | kind: "retry", |
| 152 | 152 | repoId: repo.id, |
| @@ -157,16 +157,16 @@ describe("the asks page", () => { | ||
| 157 | 157 | by: "rule", |
| 158 | 158 | ms: 1, |
| 159 | 159 | }); |
| 160 | const page = await get(alice, "/"); | |
| 160 | const page = await get(alice, "/asks"); | |
| 161 | 161 | expect(sentence(page)).toBe("1 thing needs you"); |
| 162 | 162 | expect(page).toContain("Bot did a thing"); |
| 163 | 163 | expect(headerCount(page)).toBe(1); |
| 164 | 164 | // The home counts it in the header's Asks link; the dev dashboard's |
| 165 | 165 | // own "needs you" line went with the dashboard (#625). |
| 166 | const home = await get(alice, "/"); | |
| 166 | const home = await get(alice, "/asks"); | |
| 167 | 167 | expect(headerCount(home)).toBe(1); |
| 168 | 168 | // 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"); | |
| 170 | 170 | }); |
| 171 | 171 | |
| 172 | 172 | 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", () => { | ||
| 174 | 174 | app.db |
| 175 | 175 | .query("UPDATE run SET created_at = ?1 WHERE state = 'queued'") |
| 176 | 176 | .run(new Date(Date.now() - 3 * 3_600_000).toISOString()); |
| 177 | const admin = await get(alice, "/"); | |
| 177 | const admin = await get(alice, "/asks"); | |
| 178 | 178 | expect(admin).toContain("behind one lane"); |
| 179 | 179 | expect(sentence(admin)).toBe("2 things need you"); |
| 180 | 180 | expect(headerCount(admin)).toBe(2); |
| 181 | const other = await get(bob, "/"); | |
| 181 | const other = await get(bob, "/asks"); | |
| 182 | 182 | expect(other).not.toContain("behind one lane"); |
| 183 | 183 | expect(sentence(other)).toBe("All fine"); |
| 184 | 184 | }); |
| @@ -224,17 +224,17 @@ describe("the asks page", () => { | ||
| 224 | 224 | ms: 1, |
| 225 | 225 | }); |
| 226 | 226 | const card = `id="ask-stopped:${pull.id}"`; |
| 227 | expect(await get(alice, "/")).toContain(card); | |
| 227 | expect(await get(alice, "/asks")).toContain(card); | |
| 228 | 228 | // The re-run passes: the stop is answered, and the pull is green. |
| 229 | 229 | check("ok"); |
| 230 | 230 | resolveOpen(app.db, pull.id, "retry", "green"); |
| 231 | const green = await get(alice, "/"); | |
| 231 | const green = await get(alice, "/asks"); | |
| 232 | 232 | expect(green).not.toContain(card); |
| 233 | 233 | expect(green).toContain(`id="ask-look:${pull.id}"`); |
| 234 | 234 | // Red again, before anything new is decided: the old stop is spent, and |
| 235 | 235 | // the crew's tries are what the card is counted from. |
| 236 | 236 | check("failed"); |
| 237 | expect(await get(alice, "/")).not.toContain(card); | |
| 237 | expect(await get(alice, "/asks")).not.toContain(card); | |
| 238 | 238 | }); |
| 239 | 239 | |
| 240 | 240 | test("a green change's card says what its tests did", async () => { |
| @@ -309,11 +309,11 @@ describe("the asks page", () => { | ||
| 309 | 309 | expect(card.says).toContain("alice"); |
| 310 | 310 | expect(card.says).toContain("checks.concurrency"); |
| 311 | 311 | expect(ASK_WORDS.setting.options).toEqual(["Keep", "Put back"]); |
| 312 | const page = await get(alice, "/"); | |
| 312 | const page = await get(alice, "/asks"); | |
| 313 | 313 | expect(page).toContain("Keep"); |
| 314 | 314 | expect(page).toContain("Put back"); |
| 315 | 315 | // 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"); | |
| 317 | 317 | expect(listEvents(app.db, { kind: "issue.assigned" }).length).toBe(0); |
| 318 | 318 | }); |
| 319 | 319 |
test/hand-decider.test.ts +1 −1
| @@ -81,7 +81,7 @@ describe("let the decider answer a hand-over", () => { | ||
| 81 | 81 | redirect: "manual", |
| 82 | 82 | }); |
| 83 | 83 | |
| 84 | const home = async (path = "/"): Promise<string> => | |
| 84 | const home = async (path = "/asks"): Promise<string> => | |
| 85 | 85 | (await (await fetch(`${servers.url}${path}`, { headers: { cookie } })).text()).replace(/\s+/g, " "); |
| 86 | 86 | |
| 87 | 87 | beforeAll(async () => { |
test/home-feed.test.ts +21 −2
| @@ -371,7 +371,7 @@ describe("home is the feed", () => { | ||
| 371 | 371 | if (!one.ok || !two.ok) throw new Error("issues"); |
| 372 | 372 | for (const [repo, issue] of [[garden, one.value], [vault, two.value]] as const) |
| 373 | 373 | 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(); | |
| 375 | 375 | const card = text.slice(text.indexOf('id="live-on-you"')).replace(/\s+/g, " "); |
| 376 | 376 | expect(card).toContain("things need you"); |
| 377 | 377 | expect(card).toContain("assigned to you"); |
| @@ -389,7 +389,26 @@ describe("home is the feed", () => { | ||
| 389 | 389 | expect(text).toContain("fleet.operated"); |
| 390 | 390 | expect(text).toContain("data-pick"); |
| 391 | 391 | // 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(); | |
| 393 | 393 | expect(bobCard).not.toContain('id="asks-bulk"'); |
| 394 | 394 | }); |
| 395 | test("The owner's home carries no list of what is on them: six open asks are on /asks and nowhere on /", async () => { | |
| 396 | const titles = ["Mow", "Prune", "Weed", "Rake", "Water", "Mulch"].map((w) => `Home-free ask: ${w}`); | |
| 397 | for (const title of titles) { | |
| 398 | const made = openIssue(app, alice, garden, { title }); | |
| 399 | if (!made.ok) throw new Error("issue"); | |
| 400 | expect(assignIssue(app, alice, garden, made.value, alice).ok).toBe(true); | |
| 401 | } | |
| 402 | const asks = await (await get("/asks", aliceCookie)).text(); | |
| 403 | for (const title of titles) expect(asks).toContain(title); | |
| 404 | const home = await (await get("/", aliceCookie)).text(); | |
| 405 | // The feed may tell of the issues; the list of asks to act on is not there. | |
| 406 | expect(home).not.toContain("assigned to you"); | |
| 407 | expect(home).not.toContain("things need you"); | |
| 408 | expect(home).not.toContain("assigned:"); | |
| 409 | for (const marker of ['id="needs-you"', 'id="live-on-you"', 'id="asks-sentence"', 'id="asks-bulk"']) | |
| 410 | expect(home).not.toContain(marker); | |
| 411 | // The top bar links to them, with no count. | |
| 412 | expect(home).toMatch(/<a\s+id="asks-link"[^>]*href="\/asks"[^>]*>[^<]*<svg[\s\S]*?<\/svg><span class="hide-sm">Asks<\/span>/); | |
| 413 | }); | |
| 395 | 414 | }); |
test/proposal-card.test.ts +1 −1
| @@ -156,7 +156,7 @@ describe("a wave proposal is one inbox card", () => { | ||
| 156 | 156 | test("home shows the Redirect box on the card, and Later's way back", async () => { |
| 157 | 157 | const id = propose("Home wave"); |
| 158 | 158 | 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()); | |
| 160 | 160 | expect(await get()).toContain(`/asks/proposal/${id}/redirect`); |
| 161 | 161 | await post(aliceCookie, `/asks/proposal/${id}/later`, [["back", "/"]]); |
| 162 | 162 | const page = await get(); |
test/review-wait.test.ts +1 −1
| @@ -34,7 +34,7 @@ describe("a green agent pull and its reviewer", () => { | ||
| 34 | 34 | |
| 35 | 35 | const home = async (): Promise<string> => |
| 36 | 36 | ( |
| 37 | await (await fetch(`${servers.url}/`, { headers: { cookie } })).text() | |
| 37 | await (await fetch(`${servers.url}/asks`, { headers: { cookie } })).text() | |
| 38 | 38 | ).replace(/\s+/g, " "); |
| 39 | 39 | const wordCtx = (): WordCtx => ({ db: app.db }) as unknown as WordCtx; |
| 40 | 40 |
new above
offline