From f6acc1e9762b2f5ff1d152c13fecc8416039b582 Mon Sep 17 00:00:00 2001 From: iris Date: Wed, 21 Oct 2026 22:26:44 +0200 Subject: [PATCH 1/2] swarm-ui: keep the issue report's table, errors and repo filter consistent A failed report dropped its error under the previous repo's rows, the repo list and the report shared one error slot, a remembered repo that the list lacked left the select on all repos, and the report URL did not encode the repo path. Each request now has its own error, a failed report clears the rows, the remembered repo keeps an option, and the path parts are encoded. --- .../swarm-ui/src/pages/IssueReportPage.tsx | 48 ++++++++-------- .../swarm-ui/src/pages/issue-report-repo.ts | 42 ++++++++++++++ .../swarm-ui/test/issue-report-repo.test.mjs | 55 +++++++++++++++++++ 3 files changed, 121 insertions(+), 24 deletions(-) create mode 100644 frontend/packages/swarm-ui/src/pages/issue-report-repo.ts create mode 100644 frontend/packages/swarm-ui/test/issue-report-repo.test.mjs diff --git a/frontend/packages/swarm-ui/src/pages/IssueReportPage.tsx b/frontend/packages/swarm-ui/src/pages/IssueReportPage.tsx index 95f84da94..6d98772c9 100644 --- a/frontend/packages/swarm-ui/src/pages/IssueReportPage.tsx +++ b/frontend/packages/swarm-ui/src/pages/IssueReportPage.tsx @@ -35,6 +35,7 @@ import { useLocalSetting } from "@hive/shared/settings-storage.js"; import { Panel } from "../ui/panel/Panel.js"; import { SelectField } from "../ui/select-field/SelectField.js"; import { Table, type TableColumn } from "../ui/table/Table.js"; +import { ALL_REPOS, reportUrl, repoOptions } from "./issue-report-repo.js"; import "./IssueReportPage.css"; interface IssueReportRow { @@ -63,10 +64,6 @@ type SortKey = | "transitively_blocks_count"; type SortDir = "asc" | "desc"; -// Sentinel ` + {reposError ? ( + + ) : null} {error ? ( ({ value: r, label: r })), + ]; + if (selected !== ALL_REPOS && !(repos ?? []).includes(selected)) { + options.push({ + value: selected, + label: repos === null ? selected : `${selected} (no open issues)`, + }); + } + return options; +} diff --git a/frontend/packages/swarm-ui/test/issue-report-repo.test.mjs b/frontend/packages/swarm-ui/test/issue-report-repo.test.mjs new file mode 100644 index 000000000..25535a853 --- /dev/null +++ b/frontend/packages/swarm-ui/test/issue-report-repo.test.mjs @@ -0,0 +1,55 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { + ALL_REPOS, + reportUrl, + repoOptions, +} from "../src/pages/issue-report-repo.ts"; + +test("reportUrl: no repo means the combined report", () => { + assert.equal(reportUrl(ALL_REPOS), "/api/issue-report"); +}); + +test("reportUrl: a filter without a slash is not a repo", () => { + assert.equal(reportUrl("nope"), "/api/issue-report"); +}); + +test("reportUrl: org and name become two path segments", () => { + assert.equal( + reportUrl("hyperhive/hyperhive"), + "/api/repos/hyperhive/hyperhive/issue-report", + ); +}); + +test("reportUrl: reserved characters in a name are encoded", () => { + assert.equal( + reportUrl("org/a?b#c%d"), + "/api/repos/org/a%3Fb%23c%25d/issue-report", + ); +}); + +test("repoOptions: all repos comes first, then the list", () => { + assert.deepEqual(repoOptions(["a/x", "b/y"], ALL_REPOS), [ + { value: "", label: "all repos" }, + { value: "a/x", label: "a/x" }, + { value: "b/y", label: "b/y" }, + ]); +}); + +test("repoOptions: a listed selection adds nothing", () => { + assert.equal(repoOptions(["a/x"], "a/x").length, 2); +}); + +test("repoOptions: a remembered repo keeps an option before the list loads", () => { + assert.deepEqual(repoOptions(null, "a/x"), [ + { value: "", label: "all repos" }, + { value: "a/x", label: "a/x" }, + ]); +}); + +test("repoOptions: a remembered repo missing from the list says why", () => { + assert.deepEqual(repoOptions(["b/y"], "a/x").at(-1), { + value: "a/x", + label: "a/x (no open issues)", + }); +}); From bf9d07aedc70cde338684d937ad28aa495327867 Mon Sep 17 00:00:00 2001 From: iris Date: Wed, 21 Oct 2026 22:29:10 +0200 Subject: [PATCH 2/2] docs: describe the issue report page and how it handles failures --- docs/swarm/ui.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/swarm/ui.md b/docs/swarm/ui.md index 05fdf3e3f..568af3d71 100644 --- a/docs/swarm/ui.md +++ b/docs/swarm/ui.md @@ -309,6 +309,22 @@ live rows only. +### Issue report + +The **issues** page lists the open issues of every repo that has one, from +`GET /api/issue-report`, or of one repo from +`GET /api/repos/{org}/{repo}/issue-report`. Each row shows whether an open +dependency blocks the issue and how many other issues depend on it. The +list sorts by that count by default, and **hide blocked** drops the blocked +rows. + +Picking a repo fetches its report again. The page remembers the pick, so a +repo that no longer has an open issue stays in the **repo** select with the label +**no open issues**, and the table stays filtered to it. The repo list and the report +fail on their own: a repo list that fails to load shows its error beside the +report, and a report that fails to load clears the table instead of leaving the +previous repo's issues under the error. + ### Builds The **builds** page lists the agent config PR heads the swarm builder built,