Public: anyone can read this; the crew can change it.
Every repository admin can hold a path from the flow panel on /boards, even before their first hold #7004
scout/forge:scout/6846-every-repository-admin-can-hold-a-path-f → main 3 commits fork 7 threads · 7 unresolved
README.md +1
| @@ -371,6 +371,7 @@ This page is the front door. Everything else is a file of its own under | ||
| 371 | 371 | - [](docs/FLOW.md) — 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. |
| 372 | 372 | - Flow reads: `bun scripts/flow-report.ts [--db <path>] [--public] [--json]` prints one line per read; see [](docs/FLOW.md). |
| 373 | 373 | - Under it, the panel says the crew's build yield over 24 h (runs finished, pushed, landed; `src/flow/build_yield.ts`) and the median hours to first review (`src/flow/review_latency.ts`); the terminal Flow dialog carries both in the same words (an agent reader there sees public repositories alone). `/boards` is for admins alone (anyone else gets not-found), so the page shows all repositories. |
| 374 | - Under the flow panel on `/boards`, the Held files card lists held paths in the repositories you administer (a repository's holds are its admins' book-keeping), with who held each and when, and a Release on each. Anyone who administers a repository gets the hold form there, before the first hold; both are same-origin POSTs to `/boards/holds` (`src/web/pages/boards-holds.ts`) that go through the same admin check as a repository's settings, so a non-admin's POST changes nothing. | |
| 374 | 375 | - The flow panel on `/boards` also says the time to land (median and slowest of the last 24 h, `src/flow/lead_time.ts`) and who opened the last hour's pulls (names linked, `src/flow/openers.ts`); non-admins read public repositories alone. The terminal Flow dialog carries the same two facts in its own words. |
| 375 | 376 | - The flow panel's Hot files card and the terminal Flow dialog also name files that gained open pulls over the last hour ("warming: src/a.ts 2 → 4 pulls", at most 5; `src/flow/hot_trend.ts`). The hour-old counts are samples kept in memory by `src/crew/hot_history.ts`, so after a restart nothing is named until a half-hour-old sample exists; an agent sees public repositories only. The MCP `flow` tool does not carry it yet. |
| 376 | 377 | - The flow panel on `/boards` and the terminal Flow dialog say how the open crew pulls sort into piles (red, conflicted, changes asked, approved and waiting, awaiting review), each pull counted once in the first pile it fits (`src/flow/pile.ts`). |
src/http/server.ts +2
| @@ -29,6 +29,7 @@ import { limitsPage, limitsSet, quotasSet, signupSet, inviteMint, inviteRevoke } | ||
| 29 | 29 | import { measureSubmit } from "./measure.ts"; |
| 30 | 30 | import { boardsPage } from "../web/pages/boards.ts"; |
| 31 | 31 | import { boardNew, boardPin, boardPost, pinPost } from "../web/pages/boards-edit.ts"; |
| 32 | import { boardHold } from "../web/pages/boards-holds.ts"; | |
| 32 | 33 | import { boardLive, boardShow, boardsList } from "../web/pages/boards-view.ts"; |
| 33 | 34 | import { |
| 34 | 35 | closeStreamsOf, |
| @@ -890,6 +891,7 @@ export function buildRouter(): Router<Handler> { | ||
| 890 | 891 | router.add("GET", "/boards/data", boardsPage); |
| 891 | 892 | router.add("POST", "/boards/new", boardNew); |
| 892 | 893 | router.add("POST", "/boards/pin", boardPin); |
| 894 | router.add("POST", "/boards/holds", boardHold); | |
| 893 | 895 | for (const op of ["pin-panel", "unpin-panel", "move-pin"]) router.add("POST", `/boards/${op}`, pinPost); |
| 894 | 896 | router.add("GET", "/boards/:slug", boardShow); |
| 895 | 897 | router.add("GET", "/boards/:slug/live", boardLive); |
src/web/pages/boards-holds.ts added +112
| @@ -0,0 +1,112 @@ | ||
| 1 | /** | |
| 2 | * The "Held files" card under the flow panel on /boards (#6846): every held | |
| 3 | * path in the repositories the viewer administers, who held it and when, a | |
| 4 | * Release on each, and the hold form, before the first hold. Holds are their | |
| 5 | * admins' book-keeping (`actions/file_holds.ts`), so no other repository's | |
| 6 | * are listed. Hold and release are | |
| 7 | * one same-origin POST (`boardHold`) that leaves the checks to | |
| 8 | * `actions/file_holds.ts`; a viewer who is no admin of the repository | |
| 9 | * changes nothing. Two small reads, outside the panel's cache because the | |
| 10 | * card is the viewer's. | |
| 11 | */ | |
| 12 | ||
| 13 | import type { Database } from "bun:sqlite"; | |
| 14 | import { canAdmin, getRepo, listReposWritableTo, type Repo } from "../../core/repos.ts"; | |
| 15 | import { getUserById, type User } from "../../core/users.ts"; | |
| 16 | import { MAX_HOLD_PATH } from "../../crew/file_holds.ts"; | |
| 17 | import type { Ctx } from "../../http/context.ts"; | |
| 18 | import { field, readForm } from "../form.ts"; | |
| 19 | import { html, type Html } from "../html.ts"; | |
| 20 | import { icon } from "../icons.ts"; | |
| 21 | import { holdOrRelease } from "./file_holds.ts"; | |
| 22 | import { btn, card, row, selectField, time, field as input } from "../ui.ts"; | |
| 23 | ||
| 24 | /** The most holds and administered repositories the card draws. */ | |
| 25 | const LISTED = 100; | |
| 26 | ||
| 27 | const slugOf = (r: Repo): string => `${r.ownerName}/${r.name}`; | |
| 28 | ||
| 29 | interface Held { | |
| 30 | readonly repo: Repo; | |
| 31 | readonly path: string; | |
| 32 | readonly by: string; | |
| 33 | readonly at: string; | |
| 34 | } | |
| 35 | ||
| 36 | /** The holds in `mine` alone, one query: a repository's holds are its admins' book-keeping. */ | |
| 37 | function readHolds(db: Database, mine: readonly Repo[]): Held[] { | |
| 38 | if (mine.length === 0) return []; | |
| 39 | const byId = new Map(mine.map((r) => [r.id, r])); | |
| 40 | const rows = db | |
| 41 | .query<{ repo_id: string; path: string; by: string; at: string }, string[]>( | |
| 42 | `SELECT repo_id, path, by, at FROM file_hold WHERE repo_id IN (${mine.map((_, i) => `?${i + 1}`).join(",")}) ORDER BY at, path LIMIT ${LISTED}`, | |
| 43 | ) | |
| 44 | .all(...byId.keys()); | |
| 45 | const names = new Map<string, string>(); | |
| 46 | return rows.map((r) => { | |
| 47 | if (!names.has(r.by)) names.set(r.by, getUserById(db, r.by)?.username ?? "someone"); | |
| 48 | return { repo: byId.get(r.repo_id)!, path: r.path, by: names.get(r.by)!, at: r.at }; | |
outdated
No test covers this |
||
| 49 | }); | |
| 50 | } | |
| 51 | ||
| 52 | /** The card, with controls only where the viewer administers; `admin` is whether they administer any repository. */ | |
| 53 | export function holdsCard(ctx: Ctx, viewer: User): { card: Html; admin: boolean } { | |
| 54 | const db = ctx.app.db; | |
| 55 | const mine = listReposWritableTo(db, viewer, { limit: LISTED, withoutArchived: true }).filter((r) => canAdmin(db, r, viewer)); | |
This attaches |
||
| 56 | const held = readHolds(db, mine); | |
| 57 | const form = | |
| 58 | mine.length === 0 | |
| 59 | ? null | |
| 60 | : html`<form method="post" action="/boards/holds"> | |
| 61 | <input type="hidden" name="verb" value="hold" /> | |
| 62 | ${selectField({ | |
| 63 | label: "Repository", | |
| 64 | name: "repo", | |
| 65 | id: "hold-repo", | |
| 66 | options: mine.map((r) => ({ value: slugOf(r), label: slugOf(r) })), | |
| 67 | })} | |
| 68 | ${input({ | |
| 69 | label: "Hold new work on", | |
| 70 | name: "path", | |
| 71 | id: "hold-path", | |
| 72 | placeholder: "src/http/mcp.ts", | |
| 73 | mono: true, | |
| 74 | required: true, | |
| 75 | spellcheck: false, | |
| 76 | hint: `A path in the repository, relative, at most ${MAX_HOLD_PATH} characters.`, | |
| 77 | })} | |
| 78 | <div class="form-actions">${btn("Hold file", { variant: "primary" })}</div> | |
| 79 | </form>`; | |
| 80 | const drawn = card( | |
| 81 | html`<p class="muted small">No build starts on an issue that names a held path. Nothing already running is cut.</p> | |
| 82 | ${held.length === 0 | |
| 83 | ? html`<p class="muted" data-no-holds>No file is held.</p>` | |
| 84 | : html`<ul class="list setting-list"> | |
| 85 | ${held.map((h) => | |
| 86 | row({ | |
| 87 | title: html`<span class="mono">${h.path}</span> <span class="muted small">${slugOf(h.repo)}</span>`, | |
| 88 | meta: html`held by <span data-by>${h.by}</span> · ${time(h.at)}`, | |
| 89 | data: { "file-hold": h.path }, | |
| 90 | trail: html`<form method="post" action="/boards/holds"> | |
| 91 | <input type="hidden" name="repo" value="${slugOf(h.repo)}" /> | |
| 92 | <input type="hidden" name="path" value="${h.path}" /> | |
| 93 | <input type="hidden" name="verb" value="release" /> | |
| 94 | ${btn("Release", { variant: "ghost" })} | |
| 95 | </form>`, | |
| 96 | }), | |
| 97 | )} | |
| 98 | </ul>`} | |
| 99 | ${form}`, | |
| 100 | { id: "file-holds", head: html`${icon("alert")}<h2>Held files</h2>` }, | |
| 101 | ); | |
| 102 | return { card: drawn, admin: mine.length > 0 }; | |
| 103 | } | |
| 104 | ||
| 105 | /** POST /boards/holds — hold or release one path in one repository, as the signed-in viewer. */ | |
| 106 | export async function boardHold(ctx: Ctx): Promise<Response> { | |
| 107 | const form = await readForm(ctx, "admin"); | |
| 108 | if (form instanceof Response) return form; | |
| 109 | const slug = field(form, "repo").split("/"); | |
| 110 | const repo = slug.length === 2 ? getRepo(ctx.app.db, slug[0]!, slug[1]!) : undefined; | |
| 111 | return holdOrRelease(ctx, repo, form, "/boards#file-holds"); | |
| 112 | } |
src/web/pages/boards-view.ts +8 −2
| @@ -19,6 +19,7 @@ import { notFoundPage, signInFirst } from "../chrome.ts"; | ||
| 19 | 19 | import { html, when, type Html } from "../html.ts"; |
| 20 | 20 | import { fragment, page } from "../layout.ts"; |
| 21 | 21 | import { btn, card, chartBox, empty, field, selectField } from "../ui.ts"; |
| 22 | import { holdsCard } from "./boards-holds.ts"; | |
| 22 | 23 | import { flowPanel } from "./flow-panel.ts"; |
| 23 | 24 | import { forgeCeiling } from "../../flow/ceiling.ts"; |
| 24 | 25 | import { alarmLines, cachedAlarms } from "../studio/alarm_lines.ts"; |
| @@ -85,7 +86,12 @@ export async function boardsList(ctx: Ctx): Promise<Response> { | ||
| 85 | 86 | notePhase(ctx.request, "session", takeSessionTime(ctx.request)); |
| 86 | 87 | if (ctx.auth.user === undefined) return signInFirst(ctx); |
| 87 | 88 | const listed = await timePhaseAsync(ctx.request, "boards", () => listAllBoards(ctx.app, ctx.auth.user)); |
| 88 | if (!listed.ok) return notFoundPage(ctx); | |
| 89 | if (!listed.ok) { | |
| 90 | // Not a forge admin: the boards stay theirs, but a repository's admin still reaches its holds here (#6846). | |
| 91 | const holds = holdsCard(ctx, ctx.auth.user); | |
| 92 | if (!holds.admin) return notFoundPage(ctx); | |
| 93 | return page({ ctx, title: "Boards", body: html`<div class="page-head"><h1>Boards</h1></div>${holds.card}` }); | |
| 94 | } | |
| 89 | 95 | const make = html`<form method="post" action="/boards/new" class="bar"> |
| 90 | 96 | ${field({ label: "New board", name: "title", id: "new-board-title", required: true, maxlength: MAX_TITLE, placeholder: "Title" })} |
| 91 | 97 | ${btn("Make board", { variant: "primary" })} |
| @@ -112,7 +118,7 @@ export async function boardsList(ctx: Ctx): Promise<Response> { | ||
| 112 | 118 | body: html`<div class="page-head"><h1>Boards</h1> |
| 113 | 119 | ${btn("Explore the data", { href: "/boards/data", variant: "ghost" })}</div> |
| 114 | 120 | ${alarmLines(cachedAlarms(ctx.app.db, new Date(), forgeCeiling(ctx.app.config)))} |
| 115 | ${card(make)} ${body} ${flow}`, | |
| 121 | ${card(make)} ${body} ${flow} ${holdsCard(ctx, ctx.auth.user).card}`, | |
The forge-admin path pays the card's reads too, outside the panel cache that #6840 added. Once the query is slim this is fine; as it stands, every forge-admin load of |
||
| 116 | 122 | }); |
| 117 | 123 | notePhase(ctx.request, "render", performance.now() - rendering); |
| 118 | 124 | return response; |
src/web/pages/file_holds.ts +19 −11
| @@ -5,40 +5,48 @@ | ||
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | import { holdFileAs, releaseFileAs } from "../../actions/file_holds.ts"; |
| 8 | import type { Repo } from "../../core/repos.ts"; | |
| 8 | 9 | import type { Ctx } from "../../http/context.ts"; |
| 9 | 10 | import { repoBase } from "../chrome.ts"; |
| 10 | import { field } from "../form.ts"; | |
| 11 | import { field, type Form } from "../form.ts"; | |
| 11 | 12 | import { flashTo } from "../layout.ts"; |
| 12 | 13 | import { adminForm } from "./settings.ts"; |
| 13 | 14 | |
| 14 | export async function fileHoldUpdate(ctx: Ctx): Promise<Response> { | |
| 15 | const gate = await adminForm(ctx); | |
| 16 | if (gate instanceof Response) return gate; | |
| 17 | const { repo, form } = gate; | |
| 18 | const to = `${repoBase(repo)}/settings#file-holds`; | |
| 15 | /** | |
| 16 | * Hold or release `form`'s path in `repo` as the signed-in admin and flash to | |
| 17 | * `to`. A repository that is missing and one the caller may not administer | |
| 18 | * get the one same message, so the answer never says whether it exists. | |
| 19 | */ | |
| 20 | export function holdOrRelease(ctx: Ctx, repo: Repo | undefined, form: Form, to: string): Response { | |
| 19 | 21 | const path = field(form, "path"); |
| 20 | 22 | if (field(form, "verb") === "release") { |
| 21 | const released = releaseFileAs(ctx.app, ctx.auth.user, repo, path); | |
| 23 | const released = repo === undefined ? undefined : releaseFileAs(ctx.app, ctx.auth.user, repo, path); | |
| 22 | 24 | return flashTo( |
| 23 | 25 | ctx, |
| 24 | 26 | to, |
| 25 | released.ok | |
| 27 | released?.ok | |
| 26 | 28 | ? { message: released.value ? `${path} is free again.` : `${path} was not held.` } |
| 27 | 29 | : { tone: "danger", message: "That path could not be released." }, |
| 28 | 30 | ); |
| 29 | 31 | } |
| 30 | const held = holdFileAs(ctx.app, ctx.auth.user, repo, path); | |
| 32 | const held = repo === undefined ? undefined : holdFileAs(ctx.app, ctx.auth.user, repo, path); | |
| 31 | 33 | return flashTo( |
| 32 | 34 | ctx, |
| 33 | 35 | to, |
| 34 | held.ok | |
| 36 | held?.ok | |
| 35 | 37 | ? { message: `New work on ${held.value.path} is held.` } |
| 36 | 38 | : { |
| 37 | 39 | tone: "danger", |
| 38 | 40 | message: |
| 39 | held.error === "invalid_path" | |
| 41 | held?.error === "invalid_path" | |
| 40 | 42 | ? "A held path is relative, without .. or empty parts, and under 300 characters." |
| 41 | 43 | : "That file could not be held.", |
| 42 | 44 | }, |
| 43 | 45 | ); |
| 44 | 46 | } |
| 47 | ||
| 48 | export async function fileHoldUpdate(ctx: Ctx): Promise<Response> { | |
| 49 | const gate = await adminForm(ctx); | |
| 50 | if (gate instanceof Response) return gate; | |
| 51 | return holdOrRelease(ctx, gate.repo, gate.form, `${repoBase(gate.repo)}/settings#file-holds`); | |
| 52 | } |
test/boards-holds.test.ts added +129
| @@ -0,0 +1,129 @@ | ||
| 1 | /** The Held files card on /boards (#6846): a repository's admin who is no forge admin holds a first path and releases it; others read the list and a POST from them changes nothing. */ | |
| 2 | import { afterAll, beforeAll, describe, 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, type User } from "../src/core/users.ts"; | |
| 8 | import { heldFiles, holdFile } from "../src/crew/file_holds.ts"; | |
| 9 | import { serve, type Servers } from "../src/http/server.ts"; | |
| 10 | ||
| 11 | let dir: string; | |
| 12 | let app: App; | |
| 13 | let servers: Servers; | |
| 14 | let bob: User; | |
| 15 | let carol: User; | |
| 16 | const cookies: Record<string, string> = {}; | |
| 17 | ||
| 18 | const person = async (username: string, first = false): Promise<User> => { | |
| 19 | const made = await createUser(app.db, { | |
| 20 | origin: "seed", trusted: true, username, email: `${username}@forge.local`, | |
| 21 | password: "a-good-passphrase", adminIfFirst: first, | |
| 22 | }); | |
| 23 | if (!made.ok) throw new Error(made.error); | |
| 24 | return made.value; | |
| 25 | }; | |
| 26 | const signIn = async (username: string): Promise<string> => | |
| 27 | ((await fetch(`${servers.url}/signin`, { method: "POST", body: new URLSearchParams({ username, password: "a-good-passphrase" }), redirect: "manual" })).headers.get("set-cookie") ?? "").split(";")[0]!; | |
| 28 | const page = (who: string) => fetch(`${servers.url}/boards`, { headers: { cookie: cookies[who]! } }); | |
| 29 | const post = (who: string, body: Record<string, string>, origin = servers.url) => | |
| 30 | fetch(`${servers.url}/boards/holds`, { method: "POST", headers: { cookie: cookies[who]!, origin }, body: new URLSearchParams(body), redirect: "manual" }); | |
| 31 | const held = (id: string) => heldFiles(app.db, id).map((h) => h.path); | |
| 32 | ||
| 33 | beforeAll(async () => { | |
| 34 | dir = await mkdtemp(join(tmpdir(), "boards-holds-")); | |
| 35 | app = createApp({ dataDir: dir, port: 0 }); | |
| 36 | servers = await serve(app); | |
| 37 | await person("alice", true); | |
| 38 | bob = await person("bob"); | |
| 39 | carol = await person("carol"); | |
| 40 | await person("dave"); | |
| 41 | app.db.run("INSERT INTO repo (id, owner_id, name, visibility) VALUES ('bobs', ?1, 'bobs', 'public')", [bob.id]); | |
| 42 | app.db.run("INSERT INTO repo (id, owner_id, name, visibility) VALUES ('carols', ?1, 'carols', 'public')", [carol.id]); | |
| 43 | app.db.run("INSERT INTO repo (id, owner_id, name, visibility) VALUES ('secret', ?1, 'secret', 'private')", [bob.id]); | |
| 44 | for (const u of ["alice", "bob", "carol", "dave"]) cookies[u] = await signIn(u); | |
| 45 | }); | |
| 46 | afterAll(async () => { | |
| 47 | servers.stop(); | |
| 48 | app.close(); | |
| 49 | await rm(dir, { recursive: true, force: true }); | |
| 50 | }); | |
| 51 | ||
| 52 | describe("Held files on /boards", () => { | |
| 53 | test("a repository owner who is no forge admin sees the form before any hold, and makes the first", async () => { | |
| 54 | const before = await page("bob"); | |
| 55 | expect(before.status).toBe(200); | |
| 56 | const body = await before.text(); | |
| 57 | expect(body).toContain('id="file-holds"'); | |
| 58 | expect(body).toContain("No file is held."); | |
| 59 | expect(body).toContain('action="/boards/holds"'); | |
| 60 | expect(body).toContain("bob/bobs"); | |
| 61 | expect(body).not.toContain("carol/carols</option>"); | |
| 62 | ||
| 63 | const made = await post("bob", { repo: "bob/bobs", path: "src/a.ts", verb: "hold" }); | |
| 64 | expect(made.status).toBe(303); | |
| 65 | expect(made.headers.get("location")).toBe("/boards#file-holds"); | |
| 66 | expect(held("bobs")).toEqual(["src/a.ts"]); | |
| 67 | const after = await (await page("bob")).text(); | |
| 68 | expect(after).toContain("src/a.ts"); | |
| 69 | expect(after).toContain("held by <span data-by>bob</span>"); | |
| 70 | expect(after).toContain('value="release"'); | |
| 71 | }); | |
| 72 | ||
| 73 | test("another repository's admin does not see its holds, and a refused POST changes nothing", async () => { | |
| 74 | const body = await (await page("carol")).text(); | |
This asserts the leak. Carol does not administer bob/bobs, and the terminal and the MCP |
||
| 75 | expect(body).not.toContain("src/a.ts"); | |
| 76 | expect(body).not.toContain('value="release"'); | |
| 77 | for (const verb of ["release", "hold"]) { | |
| 78 | const r = await post("carol", { repo: "bob/bobs", path: verb === "release" ? "src/a.ts" : "src/b.ts", verb }); | |
| 79 | expect(r.status).toBe(303); | |
| 80 | expect(r.headers.get("set-cookie") ?? "").toContain("flash"); | |
| 81 | } | |
| 82 | expect(held("bobs")).toEqual(["src/a.ts"]); | |
| 83 | }); | |
| 84 | ||
| 85 | test("a viewer who administers nothing has no card, and their POST changes nothing", async () => { | |
| 86 | expect((await page("dave")).status).toBe(404); | |
| 87 | await post("dave", { repo: "bob/bobs", path: "src/c.ts", verb: "hold" }); | |
| 88 | await post("dave", { repo: "bob/bobs", path: "src/a.ts", verb: "release" }); | |
| 89 | expect(held("bobs")).toEqual(["src/a.ts"]); | |
| 90 | }); | |
| 91 | ||
| 92 | test("a cross-origin POST is refused", async () => { | |
| 93 | expect((await post("bob", { repo: "bob/bobs", path: "src/x.ts", verb: "hold" }, "https://evil.example")).status).toBe(403); | |
| 94 | expect(held("bobs")).toEqual(["src/a.ts"]); | |
| 95 | }); | |
| 96 | ||
| 97 | test("the admin releases it, and a bad path is refused with a flash", async () => { | |
| 98 | expect((await post("bob", { repo: "bob/bobs", path: "../x", verb: "hold" })).status).toBe(303); | |
| 99 | expect(held("bobs")).toEqual(["src/a.ts"]); | |
| 100 | const r = await post("bob", { repo: "bob/bobs", path: "src/a.ts", verb: "release" }); | |
| 101 | expect(r.status).toBe(303); | |
| 102 | expect(held("bobs")).toEqual([]); | |
| 103 | }); | |
| 104 | ||
| 105 | test("a hold shows who held it and when, from the time given", async () => { | |
| 106 | holdFile(app.db, "carols", "lib/z.ts", carol.id, new Date("2026-01-02T03:04:05Z")); | |
| 107 | const body = await (await page("carol")).text(); | |
| 108 | expect(body).toContain("lib/z.ts"); | |
| 109 | expect(body).toContain("carol/carols"); | |
| 110 | expect(body).toContain("2026-01-02T03:04:05"); | |
| 111 | }); | |
| 112 | ||
| 113 | test("a private repository's holds are for its admins alone", async () => { | |
| 114 | holdFile(app.db, "secret", "vault/key.ts", bob.id, new Date("2026-01-01T00:00:00Z")); | |
| 115 | expect(await (await page("bob")).text()).toContain("vault/key.ts"); | |
| 116 | expect(await (await page("carol")).text()).not.toContain("vault/key.ts"); | |
| 117 | }); | |
| 118 | ||
| 119 | test("a private repository and a missing one answer a POST alike", async () => { | |
| 120 | const flash = async (repo: string, verb: string) => { | |
| 121 | const r = await post("dave", { repo, path: "vault/key.ts", verb }); | |
| 122 | expect(r.status).toBe(303); | |
| 123 | return r.headers.get("set-cookie"); | |
| 124 | }; | |
| 125 | for (const verb of ["hold", "release"]) | |
| 126 | expect(await flash("bob/secret", verb)).toBe(await flash("bob/nothing-here", verb)); | |
| 127 | expect(held("secret")).toEqual(["vault/key.ts"]); | |
| 128 | }); | |
| 129 | }); |
High. This reads
file_holdaround the action layer.listFileHoldslets only a repository's admin read its holds, and this lets any reader of the repository see them. Filter by the repositories inmine(WHERE repo_id IN (…)) or calllistFileHoldsfor each, and drop thecanReadper row on line 47.