From e2071eff5269f2354ec80328009e25b6d2a313e5 Mon Sep 17 00:00:00 2001 From: Nam Rodriguez Date: Fri, 13 Nov 2026 17:28:03 -0500 Subject: [PATCH] Security: when no fix can be selected the list says why and what to do next On the Security page, a page of fixes that were all in a pull request, or all being worked on by a fix run, showed every checkbox off, the header's too, with the reason only in a tooltip. - When no row on the page can be selected, a strip at the top of the list says why and offers the next step: "All 20 are in pull request #412" with a link to it, "A fix run is working on these" with a link to the run, no fixed version yet, or the count of each reason for a mix. The header checkbox carries the same reason for a pointer and a screen reader. With one selectable row the header works as before. - A row that can't be selected says why in the row itself, without hovering, and a row with a fix run links to the run. - A pull request closed without merging shows who closed it and when, and its fix can be selected again. A finding's page offers Open fix PR again beside the closed pull request. - The docs page for security fixes describes the same. Infrastructure findings have no selection (one button per finding), so nothing changes there. --- dashboard/e2e/security.spec.ts | 156 +++++++++++++++++- dashboard/src/app/security/detail/page.tsx | 16 +- dashboard/src/app/security/groups.tsx | 95 ++++++++++- dashboard/src/lib/security.ts | 98 ++++++++++- .../docs/getting-started/security-fixes.mdx | 4 + 5 files changed, 359 insertions(+), 10 deletions(-) diff --git a/dashboard/e2e/security.spec.ts b/dashboard/e2e/security.spec.ts index 315f79a5..81695fe3 100644 --- a/dashboard/e2e/security.spec.ts +++ b/dashboard/e2e/security.spec.ts @@ -351,10 +351,10 @@ const call = (db: Db, c: string) => db.calls.filter((x) => x.call === c); // Screenshots for a person to look at: SECURITY_SHOTS= writes them. const SHOTS = process.env.SECURITY_SHOTS; -async function shot(page: Page, name: string) { +async function shot(page: Page, name: string, at = "bulk-bar") { if (!SHOTS) return; // The bar at the top of the view (below the page's top bar), as a person who just used it sees it. - await page.getByTestId("bulk-bar").evaluate((e) => e.scrollIntoView({ block: "start" })); + await page.getByTestId(at).evaluate((e) => e.scrollIntoView({ block: "start" })); await page.screenshot({ path: `${SHOTS}/${name}.png`, fullPage: false }); } @@ -1437,4 +1437,156 @@ test.describe("Security", () => { const keys = await page.getByTestId("finding-row").evaluateAll((rows) => rows.map((r) => r.getAttribute("data-key"))); expect(keys.indexOf("acme/web-app|npm|ws|8.17.0")).toBeGreaterThan(keys.indexOf("acme/api|npm|python-multipart|0.0.9")); }); + + // A page where no fix can be selected: the header says why and offers the + // next step, and each row says its own reason without a pointer over it. + const PR412 = { number: 412, url: "https://github.com/acme/web-app/pull/412", ci: "passing", state: "open", adopted: false }; + const oneRepo = (n: number, over: Record) => + manyGroups(n).map((g) => ({ ...g, repo: "acme/web-app", key: g.key.replace(/^[^|]+/, "acme/web-app"), ...over })); + const listOf = (groups: unknown[]) => ({ groups: { groups, total: groups.length, fixable_total: 0, next_cursor: null } }); + + test("every fix on the page is in one pull request: the header says so and links to it, and each row says why", async ({ page }) => { + await mockApi(page, listOf(oneRepo(20, { status: "pr_open", pr: PR412, ticket: "SEC-0A1B2C3D4E5F" }))); + await page.goto("/security?repo=acme/web-app"); + await expect(page.getByTestId("finding-row")).toHaveCount(20); + const none = page.getByTestId("pick-none"); + await expect(none).toContainText("All 20 are in pull request #412."); + await expect(none).toContainText("Merge it to fix them, or close it to ask for a new one: they can be selected again once it closes."); + const link = none.getByTestId("pick-none-link"); + await expect(link).toHaveText("Open pull request #412"); + await expect(link).toHaveAttribute("href", "https://github.com/acme/web-app/pull/412"); + // The header checkbox is off, and says why to a pointer and to a screen reader. + const all = page.getByTestId("pick-all"); + await expect(all).toBeDisabled(); + await expect(all).toHaveAttribute("title", "All 20 are in pull request #412"); + await expect(all).toHaveAttribute("aria-describedby", "pick-none"); + await expect(all).toHaveAccessibleName("No fix on this page can be selected: All 20 are in pull request #412"); + // Each row: off, with the reason in the row itself. + await expect(page.getByTestId("finding-row").first().getByTestId("pick")).toBeDisabled(); + await expect(page.getByTestId("finding-row").getByTestId("pick-why")).toHaveCount(20); + await expect(page.getByTestId("finding-row").getByTestId("pick-why").first()).toBeVisible(); + await expect(page.getByTestId("finding-row").getByTestId("pick-why").first()).toHaveText("Can't be selected: PR #412 is already open."); + await expect(page.getByTestId("quick-select")).toHaveCount(0); + await expect(page.getByTestId("bulk-bar")).toHaveCount(0); + await shot(page, "none-selectable-one-pr", "list-toolbar"); + }); + + test("a fix run working on every fix: the header says so and links to the run", async ({ page }) => { + await mockApi(page, listOf(oneRepo(3, { status: "fixing", pr: null, ticket: "SEC-0A1B2C3D4E5F" }))); + await page.goto("/security"); + const none = page.getByTestId("pick-none"); + await expect(none).toContainText("A fix run is working on these."); + await expect(none).toContainText("Their pull request shows here when it opens. Cancel the run to select them again."); + await expect(none.getByTestId("pick-none-link")).toHaveText("See the run"); + await expect(none.getByTestId("pick-none-link")).toHaveAttribute("href", /\/\?q=SEC-0A1B2C3D4E5F$/); + await expect(page.getByTestId("finding-row").getByTestId("pick-why").first()).toHaveText("Can't be selected: a fix run is already working on it."); + await expect(page.getByTestId("finding-row").first().getByTestId("fix-run")).toHaveAttribute("href", /\/\?q=SEC-0A1B2C3D4E5F$/); + await expect(page.getByTestId("pick-all")).toBeDisabled(); + }); + + test("no fixed version anywhere, one row alone, and a mix: each says exactly what holds it", async ({ page }) => { + const db = await mockApi(page, listOf(oneRepo(3, { fixed_version: null, no_fix: 1 }))); + await page.goto("/security"); + await expect(page.getByTestId("pick-none")).toContainText("None of these 3 has a fixed version yet."); + await expect(page.getByTestId("pick-none")).toContainText("Coderhelm opens the fix when a fixed version is published."); + await expect(page.getByTestId("pick-none-link")).toHaveCount(0); + await expect(page.getByTestId("finding-row").getByTestId("pick-why").first()).toHaveText("Can't be selected: no fixed version yet."); + + db.groups = listOf(oneRepo(1, { status: "pr_open", pr: PR412 })).groups; + await page.reload(); + await expect(page.getByTestId("pick-none")).toContainText("This fix is in pull request #412."); + + // Two pull requests: no single one to link to. + const two = oneRepo(4, { status: "pr_open", pr: PR412 }).map((g, i) => (i < 2 ? g : { ...g, pr: { ...PR412, number: 413, url: "https://github.com/acme/web-app/pull/413" } })); + db.groups = listOf(two).groups; + await page.reload(); + await expect(page.getByTestId("pick-none")).toContainText("All 4 are in 2 open pull requests."); + await expect(page.getByTestId("pick-none-link")).toHaveCount(0); + + // A mix: the counts of each reason, and the one pull request's link. + const mix = [ + ...oneRepo(5, { status: "pr_open", pr: PR412 }).slice(0, 2), + ...oneRepo(5, { status: "fixing", pr: null, ticket: "SEC-0A1B2C3D4E5F" }).slice(2, 3), + ...oneRepo(5, { fixed_version: null, no_fix: 1 }).slice(3, 5), + ]; + db.groups = listOf(mix).groups; + await page.reload(); + await expect(page.getByTestId("pick-none")).toContainText( + "None of these 5 can be selected: 2 are in pull request #412, 1 has a fix run working on it, 2 have no fixed version yet.", + ); + await expect(page.getByTestId("pick-none-link")).toHaveAttribute("href", "https://github.com/acme/web-app/pull/412"); + + // The fixed list has no checkbox to explain row by row; the header still says why. + db.groups = listOf(oneRepo(2, { status: "fixed", pr: { ...PR412, state: "merged" } })).groups; + await page.goto("/security?status=fixed"); + await expect(page.getByTestId("pick-none")).toContainText("None of these 2 needs a fix."); + await expect(page.getByTestId("finding-row").getByTestId("pick-why")).toHaveCount(0); + }); + + test("one selectable row keeps the header as it was, and a closed pull request's fix can be selected again", async ({ page }) => { + const closed = { ...PR412, state: "closed", ci: null, closed_at: iso(-2), closed_by: "octo", closed_by_person: true }; + const rows = [...oneRepo(3, { status: "pr_open", pr: PR412 }).slice(0, 2), ...oneRepo(3, { status: "open", pr: closed }).slice(2)]; + await mockApi(page, { groups: { groups: rows, total: 3, fixable_total: 1, next_cursor: null }, plan: { ...PLAN, units: [PLAN.units[0]] } }); + await page.goto("/security"); + await expect(page.getByTestId("finding-row")).toHaveCount(3); + await expect(page.getByTestId("pick-none")).toHaveCount(0); + const all = page.getByTestId("pick-all"); + await expect(all).toBeEnabled(); + await expect(all).toHaveAccessibleName("Select every fix on this page"); + await expect(all).not.toHaveAttribute("title", /.+/); + // The rows in the open pull request still say why; the released one doesn't. + await expect(page.getByTestId("finding-row").getByTestId("pick-why")).toHaveCount(2); + const released = rowOf(page, "pkg-002"); + await expect(released.getByTestId("pick-why")).toHaveCount(0); + await expect(released.getByTestId("fix-state")).toContainText("PR #412"); + await expect(released.getByTestId("fix-state")).toContainText(/closed by octo on \w+ \d+/); + await expect(released.getByTestId("pick")).toBeEnabled(); + await all.check(); + await expect(page.getByTestId("bulk-summary")).toHaveText(/^1 fix selected in web-app/); + await expect(released.getByTestId("pick")).toBeChecked(); + }); + + test("at 390 wide nothing selectable: the reason and its link, no dead checkbox row, nothing scrolls sideways", async ({ page }) => { + await mockApi(page, listOf(oneRepo(20, { status: "pr_open", pr: PR412 }))); + await page.setViewportSize({ width: 390, height: 844 }); + await page.goto("/security"); + await expect(page.getByTestId("finding-card")).toHaveCount(20); + await expect(page.getByTestId("pick-none")).toBeVisible(); + await expect(page.getByTestId("pick-none")).toContainText("All 20 are in pull request #412."); + await expect(page.getByTestId("pick-none-link")).toBeVisible(); + await expect(page.getByTestId("pick-all-cards")).toHaveCount(0); + await expect(page.getByTestId("finding-card").first().getByTestId("pick-why")).toBeVisible(); + expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true); + await shot(page, "390-none-selectable", "list-toolbar"); + }); + + test("someone who can't select sees no reason about selecting", async ({ page }) => { + await mockApi(page, { role: "member", ...listOf(oneRepo(3, { status: "pr_open", pr: PR412 })) }); + await page.goto("/security"); + await expect(page.getByTestId("finding-row")).toHaveCount(3); + await expect(page.getByTestId("pick-none")).toHaveCount(0); + await expect(page.getByTestId("finding-row").getByTestId("pick-why")).toHaveCount(0); + }); + + test("a finding whose pull request a person closed says who and when, and a new fix can be asked for", async ({ page }) => { + const closed = { ...PR412, state: "closed", ci: null, closed_at: iso(-2), closed_by: "octo", closed_by_person: true }; + const db = await mockApi(page, { detail: { finding: { ...TAR[2], pr: closed }, timeline: [] }, plan: { ...PLAN, units: [PLAN.units[0]] } }); + await page.goto("/security/detail?id=tar_3"); + await expect(page.getByTestId("fix-closed")).toContainText(/PR #412 was closed by octo on \w+ \d+ without merging\./); + await expect(page.getByTestId("fix-closed")).toContainText("Open a new one when you want the fix"); + await expect(page.getByTestId("fix-pr-link")).toHaveText("PR #412, closed"); + const btn = page.getByTestId("open-fix-pr"); + await expect(btn).toBeEnabled(); + await btn.click(); + await page.getByTestId("fix-confirm").click(); + await expect(page.getByTestId("fix-results")).toContainText("1 started"); + expect(call(db, "POST /api/security/fix")[0].body).toEqual({ finding_ids: ["tar_3"], raise_limit: false, combine: "per_package" }); + + // Still open: the link to it, and no second button. + db.detail = { finding: { ...TAR[2], status: "pr_open", pr: PR412 }, timeline: [] }; + await page.goto("/security/detail?id=tar_3"); + await expect(page.getByTestId("fix-pr-link")).toHaveText("PR #412, CI passing"); + await expect(page.getByTestId("open-fix-pr")).toHaveCount(0); + await expect(page.getByTestId("fix-closed")).toHaveCount(0); + }); }); diff --git a/dashboard/src/app/security/detail/page.tsx b/dashboard/src/app/security/detail/page.tsx index 9c898243..dfc6a0b7 100644 --- a/dashboard/src/app/security/detail/page.tsx +++ b/dashboard/src/app/security/detail/page.tsx @@ -23,6 +23,7 @@ import { STATUS_LOOK, advisoryIds, cannotFix, + closedWords, dueIn, epssText, isActive, @@ -373,6 +374,8 @@ function FixBlock({ onAsk: (c: Combine) => void; }) { const cannot = cannotFix(f); + // Its pull request closed without merging: a new one can be asked for. + const reask = !!f.pr && f.pr.state === "closed" && admin && isActive(f) && !!f.fixed_version; const ci = f.pr?.ci === "passing" ? "CI is passing" @@ -405,7 +408,7 @@ function FixBlock({ )}
- {f.pr ? ( + {f.pr && !reask ? ( PR #{f.pr.number} {f.pr.state === "merged" @@ -425,6 +428,11 @@ function FixBlock({ isActive(f) && f.fixed_version && ( <> + {f.pr && ( + + PR #{f.pr.number}, closed + + )} {!cannot && openPr && (
+ {f.pr?.state === "closed" && isActive(f) && ( +

+ PR #{f.pr.number} was {closedWords(f.pr)} without merging.{" "} + {reask ? "Open a new one when you want the fix; Coderhelm does not open one by itself for a week after a pull request is closed." : "A new one can be opened by an admin."} +

+ )} {cannot && f.fixed_version && admin && !f.pr && isActive(f) && (

{cannot} diff --git a/dashboard/src/app/security/groups.tsx b/dashboard/src/app/security/groups.tsx index f85b231b..5981e866 100644 --- a/dashboard/src/app/security/groups.tsx +++ b/dashboard/src/app/security/groups.tsx @@ -27,13 +27,16 @@ import { MAX_PICKED_IDS, TIERS, cannotFix, + closedWords, epssText, fixWords, isActive, isMajor, prCount, repoName, + runsHref, securityApi, + whyNoneSelectable, type FindingGroup, type GroupFilter, type Bundle, @@ -656,7 +659,7 @@ function FixCell({ g }: { g: FindingGroup }) { g.pr.state === "merged" ? "merged" : g.pr.state === "closed" - ? "closed" + ? closedWords(g.pr) : g.pr.ci === "passing" ? "CI passing" : g.pr.ci === "failing" @@ -685,12 +688,60 @@ function FixCell({ g }: { g: FindingGroup }) { g.manifests.every((m) => /(^|\/)(package-lock\.json|yarn\.lock|pnpm-lock\.yaml|poetry\.lock|Cargo\.lock|go\.sum|Gemfile\.lock|composer\.lock)$/.test(m)); const words = g.status === "fixing" ? "Working on the fix" : !g.fixed_version ? "No fix yet" : lockOnly ? "Lockfile update" : `Upgrade to ${g.fixed_version}`; return ( - + {words} + {g.status === "fixing" && g.ticket && ( + + See the run + + )} ); } +/** + * Why an open row has no checkbox to tick, in the row itself (the + * checkbox's tooltip says the same, for a pointer). Rows already fixed or + * dismissed say so by where they are listed. + */ +function PickWhy({ g }: { g: FindingGroup }) { + const why = isActive(g) ? cannotFix(g) : null; + if (!why) return null; + const words = why.startsWith("PR ") ? why : why.charAt(0).toLowerCase() + why.slice(1); + return ( +

+ Can't be selected: {words}. +

+ ); +} + +/** The strip above the rows when none of them can be selected: why, and the next step. */ +function NoneSelectable({ rows }: { rows: FindingGroup[] }) { + const none = whyNoneSelectable(rows); + if (!none) return null; + return ( +
+ {none.words}. + {none.next} + {none.link && + (none.link.external ? ( + + {none.link.label} + + ) : ( + + {none.link.label} + + ))} +
+ ); +} + function AdvisoryList({ g }: { g: FindingGroup }) { return (
    @@ -762,7 +813,24 @@ function PickBox({ g, pick }: { g: FindingGroup; pick: Pick }) { } /** The header checkbox: on, off, or partly on when some rows are picked. */ -function AllBox({ all, some, disabled, onChange, label, testId }: { all: boolean; some: boolean; disabled: boolean; onChange: () => void; label?: string; testId: string }) { +function AllBox({ + all, + some, + disabled, + onChange, + label, + testId, + why, +}: { + all: boolean; + some: boolean; + disabled: boolean; + onChange: () => void; + label?: string; + testId: string; + /** Off because no row can be selected: the reason, also in the strip above the rows. */ + why?: string; +}) { const ref = useRef(null); useEffect(() => { if (ref.current) ref.current.indeterminate = some; @@ -776,6 +844,8 @@ function AllBox({ all, some, disabled, onChange, label, testId }: { all: boolean disabled={disabled} onChange={onChange} aria-label={label} + aria-describedby={why ? "pick-none" : undefined} + title={why} data-testid={testId} /> ); @@ -790,8 +860,11 @@ function GroupsTable({ rows, showRepo, pick }: { rows: FindingGroup[]; showRepo: const on = pick ? selectable.filter((g) => pick.isOn(g)).length : 0; const allOn = selectable.length > 0 && on === selectable.length; const someOn = on > 0 && !allOn; + // No row to select: the header says why and what to do, instead of a dead checkbox. + const none = pick ? whyNoneSelectable(rows) : null; return (
    + {none && }
    @@ -800,14 +873,22 @@ function GroupsTable({ rows, showRepo, pick }: { rows: FindingGroup[]; showRepo: {showRepo && } - + {pick && ( )} {head.map((h) => ( @@ -853,6 +934,7 @@ function GroupsTable({ rows, showRepo, pick }: { rows: FindingGroup[]; showRepo:
    - pick.all(!allOn)} label="Select every fix on this page" testId="pick-all" /> + pick.all(!allOn)} + label={none ? `No fix on this page can be selected: ${none.words}` : "Select every fix on this page"} + testId="pick-all" + why={none?.words} + /> + {pick && } @@ -873,7 +955,7 @@ function GroupsTable({ rows, showRepo, pick }: { rows: FindingGroup[]; showRepo:
    {/* Below `lg:` one card per fix, so nothing hides off the right edge; the header checkbox is a row of its own. */} - {pick && ( + {pick && !none && (
    + {pick && }
    toggle(g.key)} /> diff --git a/dashboard/src/lib/security.ts b/dashboard/src/lib/security.ts index 3fe08b57..cc227dc5 100644 --- a/dashboard/src/lib/security.ts +++ b/dashboard/src/lib/security.ts @@ -145,6 +145,8 @@ export interface FindingGroup { epss: number | null; manifests: string[]; pr: Finding["pr"]; + /** The fix run working on it, or behind its open pull request (older servers: absent). */ + ticket?: string | null; finding_ids: string[]; advisories: { finding_id: string; primary: string; ids: string[]; title: string; tier: Tier; fixed_version: string | null; status: FindingStatus }[]; /** Why its fix hasn't started though it's due (a daily limit). */ @@ -213,7 +215,18 @@ export interface Finding { waiting?: string | null; due_at: string; status: FindingStatus; - pr: { number: number; url: string; ci: "pending" | "passing" | "failing" | null; state: "open" | "merged" | "closed"; adopted: boolean } | null; + pr: { + number: number; + url: string; + ci: "pending" | "passing" | "failing" | null; + state: "open" | "merged" | "closed"; + adopted: boolean; + /** Closed without merging: when, and who closed it (a GitHub login, or the person who closed its run). Absent while open, and on older servers. */ + closed_at?: string; + closed_by?: string; + /** False when Coderhelm closed it itself. */ + closed_by_person?: boolean; + } | null; dependabot_alert: { number: number; url: string } | null; /** A private report against the repository's own code (its advisory is still in triage or draft): never posted or fixed in public (older servers: absent). */ private_report?: boolean; @@ -532,6 +545,89 @@ export function cannotFix(f: { status: FindingStatus; fixed_version: string | nu return null; } +/** The runs list, searched for a fix run's ticket. */ +export function runsHref(ticket: string): string { + return `/?q=${encodeURIComponent(ticket)}`; +} + +/** "closed by octo on Nov 13": a pull request that closed without merging, with who and when as far as the server knows. */ +export function closedWords(pr: NonNullable): string { + const who = pr.closed_by_person === false ? "Coderhelm" : pr.closed_by; + const t = pr.closed_at ? new Date(pr.closed_at).getTime() : NaN; + const on = Number.isNaN(t) ? "" : ` on ${new Date(t).toLocaleDateString(undefined, { month: "short", day: "numeric" })}`; + return `closed${who ? ` by ${who}` : ""}${on}`; +} + +/** Why nothing on a page of fixes can be selected, and the next step. */ +export interface NoneSelectable { + /** The reason, a sentence without its full stop: "All 20 are in pull request #412". */ + words: string; + /** What to do about it. */ + next: string; + link: { href: string; label: string; external: boolean } | null; +} + +/** + * When no row of `rows` can be selected: why, in plain words, with the next + * step. Null when the page is empty or at least one row can be selected + * (the header checkbox then works as usual). + */ +export function whyNoneSelectable(rows: FindingGroup[]): NoneSelectable | null { + if (rows.length === 0 || rows.some((g) => !cannotFix(g))) return null; + const n = rows.length; + const one = n === 1; + const inPr = rows.filter((g) => g.pr?.state === "open"); + const fixing = rows.filter((g) => g.pr?.state !== "open" && g.status === "fixing"); + const noFix = rows.filter((g) => g.pr?.state !== "open" && g.status !== "fixing" && isActive(g) && !g.fixed_version); + const done = n - inPr.length - fixing.length - noFix.length; + const prs = [...new Map(inPr.map((g) => [`${g.repo}#${g.pr!.number}`, g.pr!])).values()]; + const tickets = [...new Set(fixing.map((g) => g.ticket).filter((t): t is string => !!t))]; + const prLink = prs.length === 1 ? { href: prs[0].url, label: `Open pull request #${prs[0].number}`, external: true } : null; + const runLink = tickets.length === 1 ? { href: runsHref(tickets[0]), label: "See the run", external: false } : null; + if (inPr.length === n) { + if (prs.length === 1) + return { + words: `${one ? "This fix is" : `All ${n} are`} in pull request #${prs[0].number}`, + next: `Merge it to fix ${one ? "it" : "them"}, or close it to ask for a new one: ${one ? "it" : "they"} can be selected again once it closes.`, + link: prLink, + }; + return { + words: `All ${n} are in ${prs.length} open pull requests`, + next: "Each row links to its pull request. A fix can be selected again once its pull request closes.", + link: null, + }; + } + if (fixing.length === n) + return { + words: `A fix run is working on ${one ? "this" : "these"}`, + next: `${one ? "Its" : "Their"} pull request shows here when it opens. Cancel the run to select ${one ? "it" : "them"} again.`, + link: runLink, + }; + if (noFix.length === n) + return { + words: one ? "This has no fixed version yet" : `None of these ${n} has a fixed version yet`, + next: "Coderhelm opens the fix when a fixed version is published. There is nothing to select until then.", + link: null, + }; + if (done === n) + return { + words: one ? "This needs no fix" : `None of these ${n} needs a fix`, + next: `${one ? "It is" : "They are"} fixed or dismissed already. Show the open findings to select fixes.`, + link: null, + }; + const parts = [ + inPr.length > 0 ? `${inPr.length} ${inPr.length === 1 ? "is" : "are"} in ${prs.length === 1 ? `pull request #${prs[0].number}` : "open pull requests"}` : null, + fixing.length > 0 ? `${fixing.length} ${fixing.length === 1 ? "has" : "have"} a fix run working on ${fixing.length === 1 ? "it" : "them"}` : null, + noFix.length > 0 ? `${noFix.length} ${noFix.length === 1 ? "has" : "have"} no fixed version yet` : null, + done > 0 ? `${done} ${done === 1 ? "is" : "are"} fixed or dismissed` : null, + ].filter(Boolean); + return { + words: `None of these ${n} can be selected: ${parts.join(", ")}`, + next: "Each row says why and links to its pull request or run.", + link: prLink ?? runLink, + }; +} + export const securityApi = { fixPlan: (ask: FixAsk, combine: Combine = "policy") => request("/api/security/fix/plan", json("POST", { ...ask, combine })).then(checkFixPlan), fix: (ask: FixAsk, raise_limit = false, combine: Combine = "policy") => diff --git a/docs/content/docs/getting-started/security-fixes.mdx b/docs/content/docs/getting-started/security-fixes.mdx index 0231ab7d..a43aeafd 100644 --- a/docs/content/docs/getting-started/security-fixes.mdx +++ b/docs/content/docs/getting-started/security-fixes.mdx @@ -108,6 +108,10 @@ Admins can pick findings on the Security page and send them as one pull request: From a finding's page, **Open fix PR** opens a pull request for that package, and **Add to the open PR** adds the fix to the repository's open security pull request (or starts one). +A fix that is already in an open pull request, or that a fix run is working on, can't be picked, and its row says so. When no fix on the page can be picked, the list's header says why and links to the next step, for example "All 20 are in pull request #412" with a link to it, or "A fix run is working on these" with a link to the run. + +Closing a fix pull request without merging it gives its fixes back. They can be picked again at once, each finding keeps which pull request was closed, by whom and when, and CoderHelm waits 7 days before it opens one for them by itself. Cancelling or closing a fix run releases its fixes the same way. **Retry** on a fix run whose pull request was closed opens a new pull request from the findings as they stand now; it never reopens the closed one. + A request starts at once even in a preview, for those findings only, within the daily limits; past them the rest wait for tomorrow, unless the admin raises today's limit for that request, which is recorded in the audit log. ## The pull request