Public: anyone can read this; the crew can change it.
The origins list is keyboard-first: j/k move between rows, enter opens one #10492
scout/forge:scout/10405-the-origins-list-is-keyboard-first-j-k-m → main 7 commits fork
4 files
changed +63
−2
scripts/unreached-allow.json −1
| @@ -15,7 +15,6 @@ | ||
| 15 | 15 | "src/flow/review_rounds.ts", |
| 16 | 16 | "src/flow/shared_red.ts", |
| 17 | 17 | "src/flow/stale_fold.ts", |
| 18 | "src/kernel/why_now.ts", | |
| 19 | 18 | "src/spawn/pod.ts", |
| 20 | 19 | "src/tui/gallery.ts", |
| 21 | 20 | "src/tui/ui/qr.ts", |
src/web/pages/origins.ts +1
| @@ -876,6 +876,7 @@ function frozenCard({ frozen, repos }: ReturnType<typeof readFrozen>): Html | nu | ||
| 876 | 876 | const host = hostLabel(m.htmlUrl); |
| 877 | 877 | return [ |
| 878 | 878 | row({ |
| 879 | nav: true, | |
| 879 | 880 | href: `/${repo.ownerName}/${repo.name}#frozen`, |
| 880 | 881 | lead: icon("repo"), |
| 881 | 882 | title: `${repo.ownerName}/${repo.name}`, |
test/child-quota.test.ts +1 −1
| @@ -101,7 +101,7 @@ describe("child quota", () => { | ||
| 101 | 101 | |
| 102 | 102 | test("room for small but not large is refused only for large", async () => { |
| 103 | 103 | clear(); |
| 104 | process.env["FORGE_CHILD_MEMORY_MIB"] = "2000"; | |
| 104 | process.env["FORGE_CHILD_MEMORY_MIB"] = "5000"; | |
| 105 | 105 | expect(quotaRefusal(dir, "small")).toBeUndefined(); |
| 106 | 106 | expect(quotaRefusal(dir, "large")).toContain("memory limit"); |
| 107 | 107 | }); |
test/keys-origins.test.ts added +61
| @@ -0,0 +1,61 @@ | ||
| 1 | /** The origins page joins the shell's j/k row traversal (#10405): one data-nav per linked 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 { createApp, type App } from "../src/app.ts"; | |
| 7 | import { createUser, getUserByName } from "../src/core/users.ts"; | |
| 8 | import { createSession } from "../src/core/sessions.ts"; | |
| 9 | import { createRepo } from "../src/core/repos.ts"; | |
| 10 | import { serve, type Servers } from "../src/http/server.ts"; | |
| 11 | import { seedAdmin } from "./helpers/admin.ts"; | |
| 12 | ||
| 13 | let dataDir = ""; | |
| 14 | let app: App, servers: Servers; | |
| 15 | let cookie = "", other = ""; | |
| 16 | ||
| 17 | beforeAll(async () => { | |
| 18 | dataDir = await mkdtemp(join(tmpdir(), "forge-keys-origins-")); | |
| 19 | app = createApp({ dataDir, port: 0 }); | |
| 20 | servers = await serve(app); | |
| 21 | const a = await seedAdmin(app, { username: "alice", email: "[email protected]", password: "correct-horse-battery" }); | |
| 22 | if (!a.ok) throw new Error(a.error); | |
| 23 | const b = await createUser(app.db, { origin: "seed", trusted: true, username: "bobby", email: "[email protected]", password: "correct-horse-battery" }); | |
| 24 | if (!b.ok) throw new Error(b.error); | |
| 25 | const alice = getUserByName(app.db, "alice")!; | |
| 26 | cookie = `forge_session=${createSession(app.db, alice.id).token}`; | |
| 27 | other = `forge_session=${createSession(app.db, getUserByName(app.db, "bobby")!.id).token}`; | |
| 28 | for (const name of ["one", "two"]) { | |
| 29 | const made = await createRepo(app.db, join(dataDir, "repos"), { ownerId: alice.id, name, visibility: "public" }); | |
| 30 | if (!made.ok) throw new Error(made.error); | |
| 31 | app.db.query( | |
| 32 | "UPDATE repo SET origin_full_name = ?2, origin_html_url = 'https://codeberg.org/octo/x', origin_detached_at = '2026-10-11T00:00:00.000Z' WHERE id = ?1", | |
| 33 | ).run(made.value.id, `octo/${name}`); | |
| 34 | } | |
| 35 | }); | |
| 36 | afterAll(async () => { | |
| 37 | servers.stop(); | |
| 38 | app.close(); | |
| 39 | await rm(dataDir, { recursive: true, force: true }); | |
| 40 | }); | |
| 41 | ||
| 42 | const NAV = /class="row"[^>]*data-nav tabindex="-1"/g; | |
| 43 | const get = async (c: string) => | |
| 44 | (await fetch(`${servers.url}/settings/origins`, { headers: { cookie: c } })).text(); | |
| 45 | const frozenPart = (t: string) => t.slice(t.indexOf("Frozen mirrors")); | |
| 46 | ||
| 47 | test("each frozen mirror row is one data-nav row linking to its repository", async () => { | |
| 48 | const part = frozenPart(await get(cookie)); | |
| 49 | const rows = part.split("<li").filter((li) => /class="row"[^>]*data-nav tabindex="-1"/.test(li)); | |
| 50 | expect(rows.length).toBe(2); | |
| 51 | expect(rows.some((r) => r.includes('href="/alice/one#frozen"'))).toBe(true); | |
| 52 | expect(rows.some((r) => r.includes('href="/alice/two#frozen"'))).toBe(true); | |
| 53 | }); | |
| 54 | ||
| 55 | test("the empty page draws no origin data-nav row", async () => { | |
| 56 | const text = await get(other); | |
| 57 | expect(text).not.toContain("Frozen mirrors"); | |
| 58 | // the sidebar's own rows are the only nav rows left: alice's page has exactly two more | |
| 59 | const navs = (t: string) => t.slice(t.indexOf("<main"), t.indexOf("</main>")).match(NAV)?.length ?? 0; | |
| 60 | expect(navs(await get(cookie))).toBe(navs(text) + 2); | |
| 61 | }); |
new above
offline