Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions packages/delivery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,16 @@ fresh or stale state. The runtime panel is the live read.
A notice is amber when it asks for a decision or flags a risk, red for a
failure, neutral for plain information and green for a positive outcome.

The client shares the ops console look (`@shepherdjerred/console-ui`): a sticky
sidebar (`DeliverySidebar` with `AppSwitcher` over `CONSOLE_LINKS`, grouped
`Main` navigation, live feed status, viewer identity, and `ThemeRow` persisted
under `delivery-theme`) beside an inset content panel whose document scrolls.
Below `900px` the sidebar gives way to a sticky top bar and modal navigation
drawer (`Topbar`). Page stylesheets under `src/client/styles/` build on
The client shares the ops console look (`@shepherdjerred/console-ui`): a `ConsoleShell`
(`DeliveryShell`): a sticky sidebar with `AppSwitcher` over `CONSOLE_LINKS`,
grouped `Main` navigation, live feed status, viewer identity, and `ThemeRow`
(preference under the shared `ops-theme` key; a choice stored under the old
`delivery-theme` key moves over once) beside an inset content panel whose
document scrolls. Below `900px` the sidebar gives way to a sticky top bar,
with the waiting-approvals link, and a modal navigation drawer. Every page
opens with `PageHeader`, a thin adapter over console-ui's `HeaderBar`: the
`h1` (`#main-heading`, focused after navigation), a back link or breadcrumb as
its lead, route tabs (`NavTabs`) and actions, then a muted line below. Page stylesheets under `src/client/styles/` build on
`console-ui`'s `--ui-*` colour and font tokens; `tokens.css` holds only layout,
type-scale and density variables (28px controls, raised to 44px under a coarse
pointer). List tables stack below `720px`, and the overview tightens further at
Expand Down Expand Up @@ -366,7 +370,7 @@ ordered. A relative time keeps that exact moment in its title. Wherever a
person reads a release, it is its set revision number (`r274`); a set revision
the page has not loaded shows the short form of its id. A service or
environment is named as the overview names it, with its id as the title; the
environment page keeps the id as its heading and names it in the eyebrow.
environment page keeps the id as its heading and names it in the header lead.

## Public contracts

Expand Down
28 changes: 16 additions & 12 deletions packages/delivery/e2e/accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ test("console shell renders sidebar or mobile drawer, app switcher, and theme pe
// Closed, the drawer is not mounted so there is no hidden Main nav landmark.
await expect(page.getByRole("navigation", { name: "Main" })).toHaveCount(0);

const themeBtn = topbar.getByRole("button", { name: /^Theme: /u });
await expect(themeBtn).toHaveAccessibleName(
"Theme: system. Switch to light.",
);
await themeBtn.click();
await expect(themeBtn).toHaveAccessibleName(
"Theme: light. Switch to dark.",
);
await themeBtn.click();
await expect(themeBtn).toHaveAccessibleName(
"Theme: dark. Switch to system.",
);
expect(
await page.evaluate(() => globalThis.localStorage.getItem("ops-theme")),
).toBe("dark");

const open = topbar.getByRole("button", { name: "Open navigation" });
await open.click();
const drawer = page.getByRole("dialog", { name: "Navigation" });
Expand All @@ -102,18 +118,6 @@ test("console shell renders sidebar or mobile drawer, app switcher, and theme pe
.toBe(0);
await expectNoViolations(page, "mobile navigation drawer");

const themeBtn = drawer.getByRole("button", { name: /^Theme: /u });
await expect(themeBtn).toHaveAccessibleName("Theme: system");
await themeBtn.click();
await expect(themeBtn).toHaveAccessibleName("Theme: light");
await themeBtn.click();
await expect(themeBtn).toHaveAccessibleName("Theme: dark");
expect(
await page.evaluate(() =>
globalThis.localStorage.getItem("delivery-theme"),
),
).toBe("dark");

await drawer.getByRole("link", { name: "Pipelines" }).click();
await expect(drawer).toBeHidden();
await expect(page).toHaveURL(/\/pipelines$/u);
Expand Down
26 changes: 15 additions & 11 deletions packages/delivery/e2e/commits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ test("a commit says deploying only once a deployment that carries it is claimed,
// Birmel prod has the next release queued: that commit is on its way, but
// no executor has claimed the deployment, as the Overview also says.
const queued = await openCommit(page, QUEUED_POSITION);
await expect(queued.locator(".page-header")).toContainText("Queued");
await expect(queued.locator(".page-header")).not.toContainText("Deploying");
await expect(queued.locator("[data-page-header]")).toContainText("Queued");
await expect(queued.locator("[data-page-header]")).not.toContainText(
"Deploying",
);
const service = page.getByRole("region", { name: /^By service/u });
await expect(
service.getByRole("link", { name: "queued prod" }),
Expand All @@ -44,7 +46,7 @@ test("a commit says deploying only once a deployment that carries it is claimed,
// the pill and the page name that instead of saying "deploying" or "not
// released", since a release of it exists.
const unreleased = await openCommit(page, UNRELEASED_POSITION);
const header = unreleased.locator(".page-header");
const header = unreleased.locator("[data-page-header]");
await expect(header.locator(".status").first()).toHaveText(
/Needs manual release/u,
);
Expand Down Expand Up @@ -74,7 +76,7 @@ test("a commit says deploying only once a deployment that carries it is claimed,

// The accepted one is live.
const accepted = await openCommit(page, ACCEPTED_POSITION);
await expect(accepted.locator(".page-header")).toContainText(
await expect(accepted.locator("[data-page-header]")).toContainText(
"The changed service is live.",
);
await expectNoHorizontalOverflow(page);
Expand Down Expand Up @@ -103,7 +105,7 @@ test("a commit Delivery never captured a title for says so and offers Woodpecker
page,
}) => {
const main = await openCommit(page, UNCAPTURED_POSITION);
const header = main.locator(".page-header");
const header = main.locator("[data-page-header]");
await expect(header).toContainText(
"Title and author were not captured for this commit.",
);
Expand All @@ -112,10 +114,12 @@ test("a commit Delivery never captured a title for says so and offers Woodpecker
);
// A recorded commit shows its own title and author and no such note.
const recorded = await openCommit(page, ACCEPTED_POSITION);
await expect(recorded.locator(".page-header")).not.toContainText(
await expect(recorded.locator("[data-page-header]")).not.toContainText(
"not captured",
);
await expect(recorded.locator(".page-header .commit-title")).toBeVisible();
await expect(
recorded.locator("[data-page-header] .commit-title"),
).toBeVisible();
await page.goto(`/commits/${historySha(UNCAPTURED_POSITION)}`);
await expectNoHorizontalOverflow(page);
});
Expand All @@ -140,7 +144,7 @@ test("a commit whose whole pipeline failed stands where the next passing commit'
}) => {
const carrier = historySha(PIPELINE_CARRIER_POSITION).slice(0, 7);
const main = await openCommit(page, PIPELINE_FAILURE_POSITION);
const header = main.locator(".page-header");
const header = main.locator("[data-page-header]");
// Its change ships in the carrier's Birmel release, which waits on a
// manual release: never "not released" while that release carries it.
await expect(header.locator(".status").first()).toHaveText(
Expand Down Expand Up @@ -213,7 +217,7 @@ test("a commit whose CI failed for one service says its other change is live thr
page,
}) => {
const main = await openCommit(page, PARTIAL_FAILURE_POSITION);
const header = main.locator(".page-header");
const header = main.locator("[data-page-header]");
await expect(header).toContainText("CI failed");
await expect(header).toContainText(
"CI failed for Arcade, so Delivery published nothing for it. The changed service is live because newer commits include it.",
Expand Down Expand Up @@ -269,7 +273,7 @@ test("a commit whose failed CI a newer passing commit includes says where its ch
await expect(row).not.toContainText("CI failed");

const main = await openCommit(page, FAILED_POSITION);
const header = main.locator(".page-header");
const header = main.locator("[data-page-header]");
await expect(header).toContainText(
`Not built on its own; included in ${carrier} (whose build of Birmel passed).`,
);
Expand Down Expand Up @@ -300,7 +304,7 @@ test("a carried CI failure does not outrank what actually blocks the commit", as
}) => {
const carrier = historySha(CARRIER_POSITION).slice(0, 7);
const main = await openCommit(page, CARRIED_FAILURE_POSITION);
const header = main.locator(".page-header");
const header = main.locator("[data-page-header]");
await expect(header.locator(".status").first()).toHaveText(
/Needs manual release/u,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/delivery/e2e/delivery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test("select an immutable release, inspect queued execution, and cancel safely",
await expect(main).toContainText("No runtime observation");
await expect(main).toContainText("Unknown");
// Nothing is released here yet: the state leads the page, then the release action.
await expect(main.locator(".page-header")).toContainText(
await expect(main.locator("[data-page-header]")).toContainText(
"Nothing accepted yet · Deploys automatically · generation 0 · Nothing in flight",
);
await expect(main.locator(".environment-notice")).toHaveCount(0);
Expand Down
2 changes: 1 addition & 1 deletion packages/delivery/e2e/deployment-outcome.model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test("a failed deployment says why at the top and what the operator can do", asy
await page.goto(`/deployments/${await quarantined(page)}`);
const main = page.getByRole("main");
// Only the status is live; the relative time beside it is not.
const headerStatus = main.locator(".page-header").getByRole("status");
const headerStatus = main.locator("[data-page-header]").getByRole("status");
await expect(headerStatus).toHaveText("failed");
await expect(headerStatus.locator("svg.status-glyph")).toBeVisible();
const why = main.getByRole("region", { name: "Why it failed" });
Expand Down
4 changes: 2 additions & 2 deletions packages/delivery/e2e/environment-actions.model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test("a locked environment says recovery is required and refuses every request",
(item) => item.recoveryRequired,
);
const main = await open(page, BETA);
const header = main.locator(".page-header");
const header = main.locator("[data-page-header]");
await expect(header).toContainText("Recovery required");
await expect(header).not.toContainText("In flight");
const notice = main.locator(".environment-notice");
Expand Down Expand Up @@ -170,7 +170,7 @@ test("a saved plan waiting for its decision reads as awaiting plan approval", as
page,
}) => {
const main = await open(page, "tofu-cloudflare/prod");
const header = main.locator(".page-header");
const header = main.locator("[data-page-header]");
await expect(header).toContainText(/In flight: \S.* awaiting plan approval/u);
await expect(header).not.toContainText("running");
await expect(main.locator(".environment-notice")).toContainText(
Expand Down
5 changes: 3 additions & 2 deletions packages/delivery/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ export function usesNavDrawer(page: Page) {
*/
export async function mainNav(page: Page) {
if (usesNavDrawer(page)) {
await expect(page.locator(".topbar")).toBeVisible();
const openDrawer = page.locator(".nav-drawer[data-open]");
await expect(page.getByRole("banner")).toBeVisible();
const drawer = page.getByRole("dialog", { name: "Navigation" });
// A drawer that is closing is still visible but no longer `data-open`.
const openDrawer = drawer.and(page.locator("[data-open]"));
if (!(await openDrawer.isVisible())) {
await expect(drawer).toBeHidden();
const trigger = page.getByRole("button", { name: "Open navigation" });
Expand Down
9 changes: 5 additions & 4 deletions packages/delivery/e2e/lists.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ for (const path of [
await expectNoHorizontalOverflow(page);
});

test("every list page shares the section eyebrow and a filter panel", async ({
test("every list page has a plain header without an eyebrow and a filter panel", async ({
page,
}) => {
for (const [path, title] of [
Expand All @@ -315,8 +315,8 @@ test("every list page shares the section eyebrow and a filter panel", async ({
["/activity", "Activity"],
] as const) {
await page.goto(path);
const header = page.locator(".page-header");
await expect(header.locator(".eyebrow")).toHaveText("Homelab CI/CD");
const header = page.locator("[data-page-header]");
await expect(header).not.toContainText("Homelab CI/CD");
await expect(header.getByRole("heading", { level: 1 })).toHaveText(title);
if (path !== "/approvals")
await expect(page.locator(".panel").getByRole("search")).toBeVisible();
Expand Down Expand Up @@ -418,7 +418,8 @@ test("activity counts the rows it renders, names its time zone and says why a de
),
);
const zone = /Times are (UTC(?:[+-]\d{1,2}(?::\d{2})?)?)\./u.exec(
(await page.locator(".page-header .subtitle").textContent()) ?? "",
(await page.locator("[data-page-header] [data-page-lede]").textContent()) ??
"",
)?.[1];
if (zone === undefined) throw new Error("the header names the time zone");
await expect(entries.first().locator("time").first()).toHaveAttribute(
Expand Down
4 changes: 2 additions & 2 deletions packages/delivery/e2e/model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ test("the page leads with what runs here and what is in flight, then the release
await openEnvironment(page);
const main = page.getByRole("main");
// The summary ends with the deployment in flight, named with its state.
await expect(main.locator(".page-header")).toContainText(
await expect(main.locator("[data-page-header]")).toContainText(
/Accepted r3 · Approval required · generation 6 · In flight: deploy r4 awaiting approval/u,
);
await expect(
main.locator(".page-header .environment-in-flight svg.status-glyph"),
main.locator("[data-page-header] .environment-in-flight svg.status-glyph"),
).toBeVisible();
await expect(main.locator(".environment-notice")).toContainText(
/^In flight: deployment \S+ is awaiting approval\. Requests, rebinds and rollbacks are refused until it finishes or is canceled\.$/u,
Expand Down
9 changes: 7 additions & 2 deletions packages/delivery/e2e/navigation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ test("keyboard users reach content first and dialogs return focus", async ({
const skip = page.getByRole("link", { name: "Skip to content" });
await expect(skip).toBeFocused();
await page.keyboard.press("Enter");
await expect(page).toHaveURL(/#main$/u);
// console-ui's skip link focuses the landmark without adding a fragment.
await expect(page.locator("#main")).toBeFocused();
const trigger = page
.getByRole("region", { name: "Retained workers" })
.getByRole("button", { name: "Request retirement" });
Expand Down Expand Up @@ -279,6 +280,10 @@ for (const activation of ["keyboard", "click"] as const)
if (activation === "keyboard") {
await link.focus();
await page.keyboard.press("Enter");
} else if (usesNavDrawer(page)) {
// The drawer's slide-in waits for an animation frame, which this tab
// never runs, so the link stays off screen; click it where it is.
await link.dispatchEvent("click");
} else await link.click();
await expect(page).toHaveURL(/\/activity$/u);
await expect(page.locator("#main-heading")).toBeFocused();
Expand Down Expand Up @@ -308,7 +313,7 @@ test("the skip link moves focus into the main landmark", async ({ page }) => {
const skip = page.getByRole("link", { name: "Skip to content" });
await expect(skip).toBeFocused();
await page.keyboard.press("Enter");
await expect(page).toHaveURL(/#main$/u);
await expect(page).not.toHaveURL(/#main$/u);
// Focus is on the landmark, not left on the body, so the next Tab reaches
// the first control of the page rather than the masthead again.
await expect(page.locator("#main")).toBeFocused();
Expand Down
14 changes: 7 additions & 7 deletions packages/delivery/e2e/recovery.model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ test("a release recovery read back as applied says so, and that Delivery never a
}) => {
await page.goto(`/deployments/${await deploymentId(page, APPLIED_REQUEST)}`);
const main = page.getByRole("main");
await expect(main.locator(".page-header").getByRole("status")).toHaveText(
/failed · applied, not accepted$/u,
);
await expect(
main.locator("[data-page-header]").getByRole("status"),
).toHaveText(/failed · applied, not accepted$/u);
const why = main.getByRole("region", { name: "Why it failed" });
// The step it ended on leads; what recovery found is folded into its sentence.
await expect(why.locator("p").first()).toContainText(
Expand All @@ -109,7 +109,7 @@ test("the environment names the desired image recovery applied, and its newest f
}) => {
await page.goto(`/environments/${RECOVERY_PROD}`);
const main = page.getByRole("main");
const header = main.locator(".page-header");
const header = main.locator("[data-page-header]");
await expect(header).toContainText("Nothing in flight · ");
await expect(
header.getByRole("link", { name: "newest release r4 failed" }),
Expand All @@ -130,9 +130,9 @@ test("a failure a newer acceptance superseded offers no retry, and says why", as
`/deployments/${await deploymentId(page, SUPERSEDED_REQUEST)}`,
);
const main = page.getByRole("main");
await expect(main.locator(".page-header").getByRole("status")).toHaveText(
/failed · superseded by r3$/u,
);
await expect(
main.locator("[data-page-header]").getByRole("status"),
).toHaveText(/failed · superseded by r3$/u);
const why = main.getByRole("region", { name: "Why it failed" });
await expect(why).toContainText("Superseded by r3");
await expect(why).toContainText("Retry is off");
Expand Down
4 changes: 2 additions & 2 deletions packages/delivery/e2e/vocabulary.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ test("deployments and the environment page name an environment as the overview d
.locator(`span[title="scout-for-lol/prod"]`);
await expect(name).toHaveText(`${scout.title} prod`);
await page.goto("/environments/scout-for-lol/prod");
// The heading keeps the slug; the eyebrow says what the overview calls it.
// The heading keeps the slug; the header's lead says what the overview calls it.
await expect(
page.getByRole("heading", { level: 1, name: "scout-for-lol/prod" }),
).toBeVisible();
await expect(page.locator(".page-header .eyebrow")).toContainText(
await expect(page.locator("[data-page-header]")).toContainText(
`${scout.title} · prod`,
);
// Argo's own revision is labelled as Argo's, apart from Delivery's r-numbers.
Expand Down
4 changes: 3 additions & 1 deletion packages/delivery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
/>
<script>
try {
const t = localStorage.getItem("delivery-theme");
const t =
localStorage.getItem("ops-theme") ??
localStorage.getItem("delivery-theme");
if (t === "light" || t === "dark")
document.documentElement.dataset.theme = t;
} catch {}
Expand Down
1 change: 0 additions & 1 deletion packages/delivery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
},
"devDependencies": {
"@axe-core/playwright": "catalog:",
"@base-ui/react": "catalog:",
"@playwright/test": "1.64.0",
"@shepherdjerred/console-ui": "workspace:*",
"@shepherdjerred/eslint-config": "workspace:*",
Expand Down
Loading