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

The builds list is keyboard-first: j/k move between rows, enter opens one #10505

Parked opened this
Closed without merging

scout/forge:scout/10427-the-builds-list-is-keyboard-first-j-k-mo → main 11 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
4 files changed +62 −2
scripts/unreached-allow.json −1
@@ -15,7 +15,6 @@
1515 "src/flow/review_rounds.ts",
1616 "src/flow/shared_red.ts",
1717 "src/flow/stale_fold.ts",
18 "src/kernel/why_now.ts",
1918 "src/spawn/pod.ts",
2019 "src/tui/gallery.ts",
2120 "src/tui/ui/qr.ts",
src/web/pages/builds.ts +1
@@ -109,6 +109,7 @@ function buildRow(base: string, n: BuildNode, canPreview: boolean, canDelete: bo
109109 const label = encodeURIComponent(n.pin.label);
110110 const note = n.pin.note === n.pin.label ? "" : `${n.pin.note} · `;
111111 return row({
112 nav: true,
112113 title: html`${when(n.edge === "concept", () => html`<span class="build-concept" title="Concept edge: parent set by hand, not by commit history">┄ </span>`)}<a class="mono" href="${own ? base : `/${n.from}`}/commit/${n.pin.oid}">${n.from === undefined ? null : html`<span class="muted">${n.from}:</span>`}${n.pin.label}</a>`,
113114 meta: html`${note}${n.pin.source} · ${n.pin.pinnedBy} · ${time(n.pin.pinnedAt)}`,
114115 data: { depth: String(Math.min(n.depth, 8)) },
test/child-quota.test.ts +1 −1
@@ -101,7 +101,7 @@ describe("child quota", () => {
101101
102102 test("room for small but not large is refused only for large", async () => {
103103 clear();
104 process.env["FORGE_CHILD_MEMORY_MIB"] = "2000";
104 process.env["FORGE_CHILD_MEMORY_MIB"] = "5000";
105105 expect(quotaRefusal(dir, "small")).toBeUndefined();
106106 expect(quotaRefusal(dir, "large")).toContain("memory limit");
107107 });
test/keys-builds.test.ts added +60
@@ -0,0 +1,60 @@
1 /** The builds list joins the shell's j/k row traversal: one data-nav per pin row, none on the empty page. */
2 import { afterAll, beforeAll, expect, test } from "bun:test";
3 import { mkdtemp, rm } from "node:fs/promises";
4 import { tmpdir } from "node:os";
5 import { join } from "node:path";
6 import { pinBuild } from "../src/actions/builds.ts";
7 import { commitToBranch, createRepo } from "../src/actions/repos.ts";
8 import { createApp, type App } from "../src/app.ts";
9 import { createSession } from "../src/core/sessions.ts";
10 import { createUser } from "../src/core/users.ts";
11 import { serve, type Servers } from "../src/http/server.ts";
12
13 const must = <T>(r: { ok: true; value: T } | { ok: false; error: unknown }): T => {
14 if (!r.ok) throw new Error(JSON.stringify(r.error));
15 return r.value;
16 };
17
18 let dataDir: string;
19 let app: App;
20 let servers: Servers;
21 let cookie = "";
22
23 beforeAll(async () => {
24 dataDir = await mkdtemp(join(tmpdir(), "forge-keys-builds-"));
25 app = createApp({ dataDir, port: 0 });
26 servers = await serve(app);
27 const alice = must(
28 await createUser(app.db, {
29 origin: "seed", trusted: true, username: "alice", email: "[email protected]",
30 password: "a-good-passphrase", adminIfFirst: true,
31 }),
32 );
33 cookie = `forge_session=${createSession(app.db, alice.id).token}; forge_mode=dev`;
34 must(await createRepo(app, alice, { name: "none", visibility: "public" }));
35 const full = must(await createRepo(app, alice, { name: "some", visibility: "public" }));
36 const oid = must(await commitToBranch(app, alice, full, { branch: "main", message: "one", files: [{ path: "a.txt", content: "a\n" }] })).commitOid;
37 must(await pinBuild(app, alice, full, { label: "v1", oid }));
38 must(await pinBuild(app, alice, full, { label: "v2", oid, parent: "v1" }));
39 }, 60_000);
40
41 afterAll(async () => {
42 await servers.stop();
43 app.close();
44 await rm(dataDir, { recursive: true, force: true });
45 });
46
47 const get = async (name: string) =>
48 (await fetch(`${servers.url}/alice/${name}/builds`, { headers: { cookie } })).text();
49 const NAV = /class="row"[^>]*data-nav tabindex="-1"/g;
50
51 test("each pin row is one data-nav row", async () => {
52 const text = await get("some");
53 expect(text.match(NAV)?.length).toBe(2);
54 });
55
56 test("the empty builds page draws no data-nav row", async () => {
57 const text = await get("none");
58 expect(text).toContain("No builds yet");
59 expect(text).not.toMatch(NAV);
60 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs