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

/flow answers 301 to /boards and the top bar has no Flow button #2827

Parked opened this
Closed without merging

scout/forge:scout/2808-flow-answers-301-to-boards-and-the-top-b → main 3 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
10 files changed +38 −78
README.md +5 −5
@@ -875,7 +875,7 @@ code never blocks. If the verdict is on the current head and no run is in
875875 flight, one feedback run is queued to the pull's builder, and a builder is
876876 assigned when the pull has none. That run takes a builder slot like any
877877 other. The tick log names each pull it moved, or why it did not, and
878 `/flow`, the terminal's Flow dialog and the MCP `flow` tool list the pulls
878 `/boards`, the terminal's Flow dialog and the MCP `flow` tool list the pulls
879879 waiting on a builder and those waiting on a reviewer, oldest first.
880880
881881 **Already done.** A builder that finds its issue already built on the base
@@ -909,7 +909,7 @@ gated tree. Red bisects: the front half is gated by itself, a green half
909909 lands, and the red pull is handed back with the failing tests named. Pulls
910910 that turn green while a candidate is gating wait for the next one. Each
911911 queue's numbers — how many pulls are queued, how many are gating, and how
912 many landed in the last hour — show in three places: the /flow page, the
912 many landed in the last hour — show in three places: the /boards page, the
913913 terminal's Flow command, and the MCP `flow` tool's `queue` field.
914914
915915 An autonomous app's planner is **held** while nothing is landing or the plate
@@ -924,7 +924,7 @@ under the first filter that holds it (`crew/held.ts`): `held: running=1
924924 open_pull=10 stalled=12 run_cap=11` — a run on it, an open pull proposing it,
925925 the planner's, found done on main and waiting for a person to close it
926926 (`done_on_main`, never re-planned), stalled, at its run cap, parked twice, covered by a red-main
927 fix, or a setting's finding. `/flow` draws the same per autonomous app as one
927 fix, or a setting's finding. `/boards` draws the same per autonomous app as one
928928 bar, and the terminal's Flow command prints it as a line per app
929929 (`flow/held.ts`, kept 5 s). When nothing is startable while builder slots are free and some of the
930930 held are stalled, capped or parked twice, the planner is owed one pass with
@@ -972,13 +972,13 @@ from before this record say nothing).
972972 mechanical rather than advisory.
973973
974974 `docs/FLOW.md` is where every issue stands: `GET /api/v1/repos/:owner/:name/flow` returns each open issue's stage, since, stalled and unblock, plus what went live in the last 24 h.
975 Where the whole forge waits is a forge admin's: `/flow` shows each stage from ready to live with what waits, the oldest wait and its capacity, under one sentence naming the bottleneck, and beside each what it let out in the last hour with a 24-hour sparkline, under a line of landings and the median ask→live — every count links to the items it counts. A stalled step is a card on the home (Studio mode) for anyone who can write to the repository: an open pull whose check was never asked for, or is red, past its stage's allowance, with its stage, how long it has been stuck, and one button — Run check or Re-run — that asks for a check at the head and returns to the home. The terminal's **Stalled steps** command (palette) lists the same steps, live, and Enter or `r` does the same re-run; both read `flow/stalled.ts` and act through `flow/unblock.ts`, and neither shows anything to someone who cannot write. A conflicted pull never sits: every tick the crew's open pulls that no longer merge get one bring-up-to-date run each (one in flight per pull); after 2 failed tries in the same conflict, or 24 h since the first, the pull is closed with the conflicting files named and its issue goes back to ready, unassigned, with no strike against the builder. Conflicted pulls are listed oldest first on `/flow`. The terminal's Flow command and the MCP `flow` tool read the same: the sentence, the landings line, and each stage's count out in the last hour and in 24 h.
975 Where the whole forge waits is a forge admin's: `/boards` shows each stage from ready to live with what waits, the oldest wait and its capacity, under one sentence naming the bottleneck, and beside each what it let out in the last hour with a 24-hour sparkline, under a line of landings and the median ask→live — every count links to the items it counts. A stalled step is a card on the home (Studio mode) for anyone who can write to the repository: an open pull whose check was never asked for, or is red, past its stage's allowance, with its stage, how long it has been stuck, and one button — Run check or Re-run — that asks for a check at the head and returns to the home. The terminal's **Stalled steps** command (palette) lists the same steps, live, and Enter or `r` does the same re-run; both read `flow/stalled.ts` and act through `flow/unblock.ts`, and neither shows anything to someone who cannot write. A conflicted pull never sits: every tick the crew's open pulls that no longer merge get one bring-up-to-date run each (one in flight per pull); after 2 failed tries in the same conflict, or 24 h since the first, the pull is closed with the conflicting files named and its issue goes back to ready, unassigned, with no strike against the builder. Conflicted pulls are listed oldest first on `/boards`. The terminal's Flow command and the MCP `flow` tool read the same: the sentence, the landings line, and each stage's count out in the last hour and in 24 h. `GET /flow` answers 301 to `/boards` (#2808), and no menu links it.
976976
977977 `/resilience` is a forge admin's too (a guest is sent to sign in, anyone else gets 404): each protection in `docs/THREATS.md` as one line, green, red, untested or "no test yet", judged by the test file it cites in the last full gate of the forge's own repository (`FORGE_REPO`; other repositories' gates never touch it). The terminal's **Resilience** command (palette, admins) lists the same lines.
978978
979979 The terminal also has an Access command (`:` → Access), a site admin's: it reads the same last-day non-browser requests as Settings → Access and the `access` MCP tool, newest first, and filters them with `s` (since), `u` (user agent) and `p` (path), `c` to clear.
980980
981 `/system` is the machine, for the owner (#1789), laid out like btop (#2721): a meter and a 30-reading block-character history per core, memory and swap meters, load, hwmon temperatures, disk use per mount, disk and network rates (`/proc/diskstats`, `/proc/net/dev`), and a table of every process grouped forge / check (`check:<run>`) / app (`app:<slug>/<env>`) / host with CPU, memory and age, sortable by CPU (`c`) or memory (`m`) or the buttons (shown only with a script; without one the order is by CPU). It reads `/proc` and `/sys` and updates in place over one event stream, `/system/stream` (`?pause` holds it still; no reload, no polling); the 2 s push timer runs only while someone is subscribed, so it costs nothing unwatched. Its history is the `machine` board source. A test file running in more than one check at once is counted at the top of `/system` and `/flow`, with the checks. Command lines are never kept — only `*.test.ts` arguments.
981 `/system` is the machine, for the owner (#1789), laid out like btop (#2721): a meter and a 30-reading block-character history per core, memory and swap meters, load, hwmon temperatures, disk use per mount, disk and network rates (`/proc/diskstats`, `/proc/net/dev`), and a table of every process grouped forge / check (`check:<run>`) / app (`app:<slug>/<env>`) / host with CPU, memory and age, sortable by CPU (`c`) or memory (`m`) or the buttons (shown only with a script; without one the order is by CPU). It reads `/proc` and `/sys` and updates in place over one event stream, `/system/stream` (`?pause` holds it still; no reload, no polling); the 2 s push timer runs only while someone is subscribed, so it costs nothing unwatched. Its history is the `machine` board source. A test file running in more than one check at once is counted at the top of `/system` and `/boards`, with the checks. Command lines are never kept — only `*.test.ts` arguments.
982982 In the terminal, `:` → System shows the same view (the owner's only): per-core CPU with a block-character history, memory, swap, disk and network rates, and each group's top two processes (no sort; the dialog is read-only), and `:` → Telemetry lists the agents and flips `telemetry:read` for the one you press Enter on.
983983 An agent the owner grants `telemetry:read` (Settings → Telemetry, one switch per agent, revoked the same way) reads the same through `GET /api/v1/telemetry/{system,flow,sources,history}` and the MCP `flow` and `system` tools; private repositories' checks and apps are renamed `check:private-N` and lose their processes and test files, and `flow` (like `system`, an admin agent account needs the grant too: only a person who is an admin reads without it) names only public repositories' conflicted pulls, every read is listed on that page, and an agent without the grant is refused. `/contribute`, `GET /api/v1/contribute` and the MCP `contribute` tool are open to anyone: what the forge is, the bottleneck now, open issues labelled “help wanted” in public repositories, and how to propose (fork, pull, the same gate). The grant is a table, not a token scope, so no token has to be re-issued.
984984
forge.json +1 −1
@@ -3,7 +3,7 @@
33 "api.anthropic.com"
44 ],
55 "app": {
6 "looks": ["/", "/forges", "/family", "/front", "/explore", "/board", "/boards", "/asked", "/search", "/new", "/audit", "/releases", "/apps", "/migrate", "/map", "/flow", "/system", "/contribute", "/resilience", "/settings"],
6 "looks": ["/", "/forges", "/family", "/front", "/explore", "/board", "/boards", "/asked", "/search", "/new", "/audit", "/releases", "/apps", "/migrate", "/map", "/system", "/contribute", "/resilience", "/settings"],
77 "run": "bun run src/main.ts",
88 "install": "",
99 "health": "/healthz",
src/web/layout.ts −4
@@ -241,9 +241,6 @@ function userMenu(
241241 ]
242242 : []),
243243 { separator: true, label: "" },
244 ...(user.isAdmin
245 ? [{ label: "Flow", href: "/flow", icon: "activity" as const }]
246 : []),
247244 helpItem,
248245 themeForm(theme),
249246 { separator: true, label: "" },
@@ -334,7 +331,6 @@ function paletteIndex(ctx: Ctx, extra: PaletteItem[]): Html {
334331 : []),
335332 ...(ctx.auth.user?.isAdmin
336333 ? [
337 { t: "Flow", h: "/flow", c: "Go to" },
338334 { t: "System", h: "/system", c: "Go to" },
339335 { t: "Forges you sent", h: "/forges", c: "Go to" },
340336 { t: "Family of forges", h: "/family", c: "Go to" },
src/web/pages/boards-view.ts +3 −1
@@ -93,7 +93,9 @@ export async function boardsList(ctx: Ctx): Promise<Response> {
9393 ctx,
9494 title: "Boards",
9595 body: html`<div class="page-head"><h1>Boards</h1>
96 ${btn("Explore the data", { href: "/boards/data", variant: "ghost" })}</div>
96 ${btn("Explore the data", { href: "/boards/data", variant: "ghost" })}
97 ${btn("Resilience", { href: "/resilience", variant: "ghost" })}
98 ${btn("Contribute", { href: "/contribute", variant: "ghost" })}</div>
9799 ${card(make)} ${body} ${flowPanel(ctx.app, { kind: "owner" }, ctx.url, "/boards")}`,
98100 styleCss: flowPanelCss,
99101 });
src/web/pages/flow.ts +5 −51
@@ -1,57 +1,11 @@
11 /**
2 * /flow, for a forge admin: the pipeline from a ready issue to a live
3 * deploy as rows, one per stage, each with how much is in it now, how long
4 * its oldest waiting item has waited, and the capacity that limits it
5 * (#1554). One sentence above names the stage with the longest wait — the
6 * bottleneck. The numbers are `flow/pipeline.ts`'s; the knobs stay on
7 * Settings → Capacity, linked from here.
8 *
9 * Beside what each stage holds, what it let out (#1779): items out in the
10 * last hour and a 24-bar sparkline per stage, and a headline line of
11 * landings and the median ask→live — `flow/throughput.ts`'s numbers, the
12 * same ones the MCP `flow` tool and the terminal's Flow command read. Every
13 * count links back here with `?out=<what>[&hour=<0–23>]`, which lists the
14 * items it counted under the table.
15 *
16 * Under it, the merge queue (#2036): per repository, what is queued for the
17 * next candidate, what the candidate at the gate carries, and what landed
18 * in the last hour — `flow/queue.ts`'s numbers, which the terminal's Flow
19 * command and the MCP `flow` tool read too.
20 *
21 * Beside the conflicted pulls, the pulls with changes requested (#2172):
22 * those waiting on a builder apart from those waiting on a reviewer, by
23 * age — `flow/requested.ts`'s, the rows the tick moves.
24 *
25 * Under the pipeline, why ready issues cannot start (#2244): per autonomous
26 * repository, its ready list as one bar, startable beside each filter that
27 * holds the rest — `flow/held.ts`'s rows, the same the tick line says and
28 * the terminal's Flow command prints.
2 * GET /flow — the pipeline moved to `/boards` (#2767), so the old address
3 * answers 301 there for bookmarks and old links. No auth check: it reveals
4 * nothing, and `/boards` makes its own.
295 */
306
31 import { noteRead, telemetryReader } from "../../actions/telemetry.ts";
327 import type { Ctx } from "../../http/context.ts";
33 import { notFoundPage, signInFirst } from "../chrome.ts";
34 import { html } from "../html.ts";
35 import { page } from "../layout.ts";
36 import { flowPanel, flowPanelCss } from "./flow-panel.ts";
378
38 // GET /flow
39 export function flowPage(ctx: Ctx): Response {
40 if (!ctx.auth.user) return signInFirst(ctx);
41 const reader = telemetryReader(ctx.app, ctx.auth.user);
42 if (!reader) return notFoundPage(ctx);
43 noteRead(ctx.app, ctx.auth.user, reader, "flow");
44 const body = html`<div class="page-head">
45 <h1>Flow</h1>
46 <p class="muted">
47 From a ready issue to a live deploy: what is in each stage now, how
48 long its oldest has waited, and what limits it. The limits are set on
49 <a href="/settings/capacity">Capacity</a> and in each repository's
50 autonomy settings. How the forge stands against its threats is on
51 <a href="/resilience">Resilience</a>. Where an outside agent can
52 help is on <a href="/contribute">Contribute</a>.
53 </p>
54 </div>
55 ${flowPanel(ctx.app, reader, ctx.url, "/flow")}`;
56 return page({ ctx, title: "Flow", body, styleCss: flowPanelCss });
9 export function flowPage(_ctx: Ctx): Response {
10 return new Response(null, { status: 301, headers: { location: "/boards" } });
5711 }
src/web/pages/system.ts +1 −2
@@ -160,8 +160,7 @@ export function systemPage(ctx: Ctx): Response {
160160 <p class="muted">
161161 The machine now, updated in place about every 2 s over one event
162162 stream; <a href="/system?pause">pause</a>. Its history is on
163 <a href="/boards">Boards</a> (the machine source); the pipeline is on
164 <a href="/flow">Flow</a>.
163 <a href="/boards">Boards</a> (the machine source), with the pipeline.
165164 </p>
166165 </div>
167166 <div id="sys-dup">${at("sys-dup")}</div>
src/web/pages/telemetry.ts +1 −1
@@ -25,7 +25,7 @@ export function telemetryPage(ctx: Ctx): Response {
2525 const reads = recentReads(ctx.app.db);
2626 const body = html`${card(
2727 html`<div class="card-body"><p class="muted small">
28 A granted agent reads <a href="/flow">Flow</a>, <a href="/system">System</a> and the
28 A granted agent reads Flow, <a href="/system">System</a> and the
2929 boards' sources through the API and MCP — counts and rates, with
3030 private repositories and sealed values cut out. Revoke at any time;
3131 every read is listed below.
test/flow-pipeline.test.ts +16 −8
@@ -248,28 +248,36 @@ describe("/flow: the forge shows its own bottleneck", () => {
248248 for (const key of ["ready", "building", "checking", "review", "approved", "landed", "live"])
249249 expect(page).toContain(`data-stage="${key}"`);
250250 expect(page).toContain('href="/settings/capacity"');
251 // An admin reaches Flow from every page, through the user menu.
252 expect(await (await get("/", cookie)).text()).toContain('href="/flow"');
251 // Flow has no link anywhere: its address answers 301 to /boards.
252 expect(await (await get("/", cookie)).text()).not.toContain('href="/flow"');
253253 });
254254
255255 test("nobody but a forge admin reads it", async () => {
256256 const bob = await login("bob");
257 expect((await get("/flow", bob)).status).toBe(404);
258 expect(await (await get("/", bob)).text()).not.toContain('href="/flow"');
259 expect((await get("/flow", "")).status).not.toBe(200);
257 expect((await get("/boards", bob)).status).toBe(404);
258 expect((await get("/boards", "")).status).not.toBe(200);
260259 });
261260
262 test("the top bar holds search, New and the user menu; Flow, help and theme live in menus", async () => {
261 test("/flow is a 301 to /boards, for anyone, and the home's top bar has no link to it", async () => {
262 for (const cookie of [await login("alice"), await login("bob"), ""]) {
263 const res = await get("/flow", cookie);
264 expect(res.status).toBe(301);
265 expect(res.headers.get("location")).toBe("/boards");
266 expect(await (await get("/", cookie)).text()).not.toContain('href="/flow"');
267 }
268 });
269
270 test("the top bar holds search, New and the user menu; help and theme live in menus", async () => {
263271 expect(alice.isAdmin).toBe(true);
264272 const page = await (await get("/", await login("alice"))).text();
265273 const bar = page.slice(page.indexOf('<header class="topbar"'), page.indexOf("</header>"));
266 // Nothing but menus and search sits in the bar: no bare Flow link, no help button.
274 // Nothing but menus and search sits in the bar: no Flow link, no help button.
267275 expect(bar).not.toContain("flow-link");
268276 expect(bar).not.toContain("theme-menu");
269277 expect(bar.match(/<details/g)?.length).toBe(2);
270278 // They are still one open away, in the user menu.
271279 const panel = bar.slice(bar.lastIndexOf('<details'));
272 expect(panel).toContain('href="/flow"');
280 expect(panel).not.toContain('href="/flow"');
273281 expect(panel).toContain("data-help");
274282 expect(panel).toContain('action="/theme"');
275283 });
test/forge-looks.test.ts +1
@@ -37,6 +37,7 @@ const NOT_A_PAGE: Record<string, string> = {
3737 "/theme": "a mutation, answers 404 to a GET",
3838 "/tell": "answers 404 to a GET",
3939 "/asks": "redirects to /#needs-you",
40 "/flow": "301 to /boards",
4041 "/big": "redirects to /board?wall",
4142 "/mcp": "a protocol endpoint, answers 405 to a GET",
4243 "/_measure": "the page-load beacon, a POST endpoint",
test/system-telemetry.test.ts +5 −5
@@ -1,7 +1,7 @@
11 /**
22 * Live machine telemetry and its open read hooks (#1789): /proc and /sys
33 * read into one view; the same test file in two checks counted as duplicate
4 * work; /system and /flow read by the owner and by an agent holding
4 * work; /system and the flow API read by the owner and by an agent holding
55 * `telemetry:read` — with private repositories cut out — and refused to an
66 * agent without it; the grant is the owner's alone and every agent read is
77 * logged; the funnel is open to all.
@@ -373,7 +373,7 @@ describe("telemetry:read: the owner grants it, an agent reads with it, nobody el
373373 }
374374 });
375375
376 test("an admin agent reads flow only with the grant, in the page and the terminal, and sees the agent view", async () => {
376 test("an admin agent reads flow only with the grant, in the API and the terminal, and sees the agent view", async () => {
377377 const made = await createAgent(app, alice, { username: "zadminbot" });
378378 if (!made.ok) throw new Error(String(made.error));
379379 app.db.query("UPDATE user SET is_admin = 1 WHERE id = ?1").run(made.value.user.id);
@@ -385,11 +385,11 @@ describe("telemetry:read: the owner grants it, an agent reads with it, nobody el
385385 const session = new Session(app, { sshUsername: "zadminbot", remoteAddress: "127.0.0.1", fingerprint: "SHA256:t", user: adminbot });
386386 return forgeCommands(session)(ctx).find((c) => c.id === "flow");
387387 };
388 expect((await get(token, "/flow")).status).toBe(404);
388 expect((await get(token, "/api/v1/telemetry/flow")).status).toBe(403);
389389 expect(flowCommand()).toBeUndefined();
390390
391391 expect(setTelemetryGrant(app, alice, "zadminbot", true).ok).toBe(true);
392 const page = await get(token, "/flow");
392 const page = await get(token, "/api/v1/telemetry/flow");
393393 expect(page.status).toBe(200);
394394 const text = await page.text();
395395 // (the page's palette index lists every repo an admin can open; the telemetry body must not)
@@ -399,7 +399,7 @@ describe("telemetry:read: the owner grants it, an agent reads with it, nobody el
399399 expect(recentReads(app.db).some((r) => r.username === "zadminbot" && r.what === "flow")).toBe(true);
400400 // Revoked, the door closes again.
401401 setTelemetryGrant(app, alice, "zadminbot", false);
402 expect((await get(token, "/flow")).status).toBe(404);
402 expect((await get(token, "/api/v1/telemetry/flow")).status).toBe(403);
403403 });
404404
405405 test("in the terminal, the owner is offered System and Telemetry; nobody else is", () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs