Skip to content
Open
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
38 changes: 20 additions & 18 deletions packages/delivery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,14 @@ beside a "Clear filters" link. Every list page keeps one live result line, and
"Older" and "Newest" move focus to the top of the list. A route that fails to
load, or names nothing, renders inside the app's layout and takes focus; a
request the server refused offers a way out instead of "Try again".
Every confirmation asks through one native `<dialog>` that the root layout
mounts (`ConfirmDialogProvider`): a `ConfirmButton` renders its own question
into that dialog while it is open, so a page with forty confirm buttons has one
dialog element. The dialog returns focus to its button. While the confirmed
Every confirmation asks in console-ui's modal `Dialog`: a `ConfirmButton` owns
its question and renders it only while it is open, so a page with forty confirm
buttons holds no dialog until one asks. "Keep as is" takes focus first, Escape
cancels, and the dialog returns focus to its button. While the confirmed
action is in flight the button is `aria-disabled` rather than disabled, because
a disabled element cannot hold focus; a focused button that leaves the page
hands its focus to the page heading. The server returns `index.html` for every
non-API path.
hands its focus to the page heading, and an open question leaves with it. The
server returns `index.html` for every non-API path.

The environment page leads with its state, then the actions: a summary line
(the accepted revision, the approval policy and the deployment in flight),
Expand Down Expand Up @@ -297,14 +297,16 @@ pointer). List tables stack below `720px`, and the overview tightens further at

Pages share these components from `src/client/components/`:

| Component | Renders |
| ------------ | ----------------------------------------------------------------------- |
| `Status` | A state as glyph, words and color; `label` gives a page its own words |
| `Facts` | A definition list of labelled values, one `Fact` each |
| `Disclosure` | A native `<details>` with an optional count |
| `Identifier` | A UUID or digest in a short form, its full value in `title` and text |
| `Revision` | A set revision as its r-number (`r274`); `revisionLabel` gives the text |
| `Receipt` | An evidence summary or step message: prose, or a JSON receipt as facts |
| Component | Renders |
| ---------------------------------- | ---------------------------------------------------------------------------------- |
| `Status` | A Delivery state as console-ui's `StatusGlyph`; `label` gives a page its own words |
| `Facts` | Labelled values as console-ui's `DescriptionList`, one `Fact` each |
| `Disclosure` | console-ui's `Disclosure`, run across a panel's padding where it sits in one |
| `Notice` | Page news as console-ui's `Banner`, with a tone, an id and a `bleed` |
| `Elapsed`, `Deadline`, `ClockTime` | Delivery's wording over console-ui's `Duration`, `ExactTime` and `RelativeTime` |
| `Identifier` | A UUID or digest in a short form, its full value in `title` and text |
| `Revision` | A set revision as its r-number (`r274`); `revisionLabel` gives the text |
| `Receipt` | An evidence summary or step message: prose, or a JSON receipt as facts |

`GET /api/v1/deployments` returns each deployment with `versionSetRevision`,
the number of the set revision it deploys, read for the whole page in one
Expand Down Expand Up @@ -363,10 +365,10 @@ actor folds into one counted entry. Folding is presentational and per fetched
page: the route still pages by audit row, so a run that crosses a page
boundary reads as one entry on each page.

Every moment the app states in absolute terms uses one format
(`exactTime` in `src/client/components/time.tsx`): the reader's local date and
a 24-hour clock, to the minute, or to the second where nearby moments are
ordered. A relative time keeps that exact moment in its title. Wherever a
Every moment the app states uses console-ui's one format: a relative time
("3m ago") keeps its exact moment in its title, and an absolute time reads in
Pacific time on a 24-hour clock ("Nov 26, 14:02 PT"), to the minute or to the
second where nearby moments are ordered. 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
Expand Down
12 changes: 7 additions & 5 deletions packages/delivery/e2e/activity-environment.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from "@playwright/test";
import { expectNoHorizontalOverflow } from "./helpers.ts";
import { activityRows, expectNoHorizontalOverflow } from "./helpers.ts";

/** The instant `minutes` before nine o'clock on the fixture day. */
const at = (minutes: number) =>
Expand Down Expand Up @@ -53,9 +53,9 @@ test("one deployment's steps read as one activity row, each step once, however o
route.fulfill({ json: { items, nextCursor: null } }),
);
await page.goto("/activity");
const rows = page.locator("ol.activity > li");
const rows = activityRows(page);
await expect(rows).toHaveCount(2);
const steps = rows.first().locator("ol.activity-stages > li");
const steps = rows.first().locator('[data-part="stages"] > li');
await expect(steps).toHaveCount(1);
await expect(steps.first()).toContainText("worker-image-provenance");
await expect(steps.first()).toContainText("succeeded");
Expand Down Expand Up @@ -130,7 +130,7 @@ test("repeated check-ins and worker retirements fold into counted rows that name
route.fulfill({ json: { items, nextCursor: null } }),
);
await page.goto("/activity");
const rows = page.locator("ol.activity > li");
const rows = activityRows(page);
await expect(rows).toHaveCount(5);

// The proof recorded for one retirement deployment is one row too.
Expand All @@ -156,7 +156,9 @@ test("repeated check-ins and worker retirements fold into counted rows that name
await expect(retirements).toContainText("r338");
await expect(retirements).toContainText("from ");
await retirements.getByText("3 requests").click();
await expect(retirements.locator(".activity-repeated > li")).toHaveCount(3);
await expect(retirements.locator('[data-part="repeated"] > li')).toHaveCount(
3,
);

const failed = rows.filter({ hasText: "Worker recovery failed" });
await expect(failed.first()).toContainText(
Expand Down
19 changes: 8 additions & 11 deletions packages/delivery/e2e/attention.model.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { expect, test, type Page } from "@playwright/test";
import { expectNoHorizontalOverflow, openOverview } from "./helpers.ts";
import { expect, test } from "@playwright/test";
import {
expectNoHorizontalOverflow,
openOverview,
overviewRow as serviceRow,
} from "./helpers.ts";

// Served by e2e/model-server.ts: Arcade prod's accepted release has a firing
// critical alarm under a hold policy, and Cloudflare's tofu stack has a saved
// plan waiting for a decision.

function tile(page: Page, title: string) {
return page
.getByRole("main")
.getByRole("listitem")
.filter({ has: page.getByRole("link", { name: title, exact: true }) });
}

test("an alarm on an accepted release needs attention and marks its chip", async ({
page,
}) => {
Expand All @@ -26,7 +23,7 @@ test("an alarm on an accepted release needs attention and marks its chip", async
await expect(
alarm.getByRole("link", { name: "Arcade prod monitor alarm" }),
).toHaveAttribute("href", "/environments/arcade/prod");
const prod = tile(page, "Arcade").getByRole("link", { name: /^prod / });
const prod = serviceRow(page, "Arcade").getByRole("link", { name: /^prod / });
await expect(prod).toContainText("alarm firing");
await expectNoHorizontalOverflow(page);
});
Expand All @@ -40,7 +37,7 @@ test("a saved plan waiting for a decision is awaiting approval, not running", as
name: "OpenTofu cloudflare stack prod awaits plan approval",
}),
).toBeVisible();
const chip = tile(page, "OpenTofu cloudflare stack").getByRole("link", {
const chip = serviceRow(page, "OpenTofu cloudflare stack").getByRole("link", {
name: /^prod /u,
});
await expect(chip).toContainText("awaiting approval");
Expand Down
47 changes: 16 additions & 31 deletions packages/delivery/e2e/commits.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test, type Page } from "@playwright/test";
import { expectNoHorizontalOverflow } from "./helpers.ts";
import { expectNoHorizontalOverflow, statusIn } from "./helpers.ts";
import {
ACCEPTED_POSITION,
CARRIED_FAILURE_POSITION,
Expand Down Expand Up @@ -47,9 +47,7 @@ test("a commit says deploying only once a deployment that carries it is claimed,
// released", since a release of it exists.
const unreleased = await openCommit(page, UNRELEASED_POSITION);
const header = unreleased.locator("[data-page-header]");
await expect(header.locator(".status").first()).toHaveText(
/Needs manual release/u,
);
await expect(statusIn(header).first()).toHaveText(/Needs manual release/u);
await expect(header).not.toContainText("Not released");
await expect(header).not.toContainText("Deploying");
await expect(header).toContainText(
Expand Down Expand Up @@ -86,7 +84,7 @@ test("the list row names the environment that is blocking it", async ({
page,
}) => {
const unreleased = await findRow(page, UNRELEASED_POSITION);
await expect(unreleased.locator(".status").first()).toHaveText(
await expect(statusIn(unreleased).first()).toHaveText(
/Needs manual release/u,
);
await expect(unreleased).toContainText("Birmel / prod: needs manual release");
Expand Down Expand Up @@ -147,9 +145,7 @@ test("a commit whose whole pipeline failed stands where the next passing commit'
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(
/Needs manual release/u,
);
await expect(statusIn(header).first()).toHaveText(/Needs manual release/u);
await expect(header).toContainText(
`The changed service needs a manual release: Birmel prod. Not built on its own; included in ${carrier} (whose build of CI (Woodpecker) passed).`,
);
Expand All @@ -176,9 +172,7 @@ test("a commit whose whole pipeline failed stands where the next passing commit'

// The list row says the same thing in the same words.
const row = await findRow(page, PIPELINE_FAILURE_POSITION);
await expect(row.locator(".status").first()).toHaveText(
/Needs manual release/u,
);
await expect(statusIn(row).first()).toHaveText(/Needs manual release/u);
await expect(row).toContainText(
`Not built on its own; included in ${carrier} (whose build of CI (Woodpecker) passed)`,
);
Expand All @@ -190,16 +184,16 @@ test("a commit whose whole pipeline failed stands where the next passing commit'
async function findRow(page: Page, position: number) {
await page.goto("/commits");
const recent = page.getByRole("region", { name: "Recent commits" });
await expect(recent.getByRole("listitem").first()).toBeVisible();
const row = recent.getByRole("listitem").filter({
await expect(recent.locator("tbody tr").first()).toBeVisible();
const row = recent.locator("tbody tr").filter({
has: page.getByRole("link", {
name: new RegExp(`^${historySha(position).slice(0, 7)}`, "u"),
}),
});
const older = recent
.getByRole("navigation", { name: "Pages" })
.getByRole("link", { name: "Older" });
const first = recent.getByRole("listitem").first();
const first = recent.locator("tbody tr").first();
while ((await row.count()) === 0 && (await older.count()) > 0) {
const url = page.url();
const shown = await first.textContent();
Expand Down Expand Up @@ -266,7 +260,7 @@ test("a commit whose failed CI a newer passing commit includes says where its ch
// later release, the accepted one, is what carries the change to prod.
const release = historySha(ACCEPTED_POSITION).slice(0, 7);
const row = await findRow(page, FAILED_POSITION);
await expect(row.locator(".status").first()).toHaveText(/Deployed/u);
await expect(statusIn(row).first()).toHaveText(/Deployed/u);
await expect(row).toContainText(
`Not built on its own; included in ${carrier} (whose build of Birmel passed)`,
);
Expand Down Expand Up @@ -305,9 +299,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("[data-page-header]");
await expect(header.locator(".status").first()).toHaveText(
/Needs manual release/u,
);
await expect(statusIn(header).first()).toHaveText(/Needs manual release/u);
// The real blocker leads; the carried failure follows.
await expect(header).toContainText(
`The changed service needs a manual release: Birmel prod. Built on its own for 2 services (1 changed); 1 service (Golink) was built by a later commit: included in ${carrier} (whose build of Golink passed).`,
Expand All @@ -325,9 +317,7 @@ test("a carried CI failure does not outrank what actually blocks the commit", as
const service = page.getByRole("region", { name: /^By service/u });
await expect(service).not.toContainText("Golink");
const row = await findRow(page, CARRIED_FAILURE_POSITION);
await expect(row.locator(".status").first()).toHaveText(
/Needs manual release/u,
);
await expect(statusIn(row).first()).toHaveText(/Needs manual release/u);
await expect(row).toContainText("Birmel / prod: needs manual release");
// Only Golink went through the carrier; the row says what the commit built itself.
await expect(row).toContainText(
Expand All @@ -341,24 +331,19 @@ test("the commit list lines its columns up and explains each environment tally",
}) => {
await page.goto("/commits");
const recent = page.getByRole("region", { name: "Recent commits" });
await expect(recent.getByRole("listitem").first()).toBeVisible();
const lefts = (selector: string) =>
await expect(recent.locator("tbody tr").first()).toBeVisible();
const lefts = (column: number) =>
recent
.locator(`.commit-row > ${selector}`)
.locator(`tbody tr > :nth-child(${String(column)})`)
.evaluateAll((nodes) =>
nodes.map((node) => Math.round(node.getBoundingClientRect().left)),
);
const rights = await recent
.locator(".commit-row > .commit-meta")
.locator("tbody tr > :nth-child(4)")
.evaluateAll((nodes) =>
nodes.map((node) => Math.round(node.getBoundingClientRect().right)),
);
for (const column of [
await lefts(".status"),
await lefts(".commit-subject"),
await lefts(".commit-detail"),
rights,
])
for (const column of [await lefts(1), await lefts(2), await lefts(3), rights])
expect(new Set(column).size).toBe(1);

const accepted = await findRow(page, ACCEPTED_POSITION);
Expand Down
6 changes: 5 additions & 1 deletion packages/delivery/e2e/delivery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ test("select an immutable release, inspect queued execution, and cancel safely",
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);
await expect(main.locator('[data-notice="environment"]')).toHaveCount(0);
await expect(main.getByRole("region").first()).toHaveAccessibleName(
"Release state",
);
Expand All @@ -96,6 +96,10 @@ test("select an immutable release, inspect queued execution, and cancel safely",
.click();
await expect(main.getByText("queued", { exact: true })).toBeVisible();
await expect(main).toContainText("No verification evidence recorded");
// The summary line keeps a space between its status, kind, release and requester.
await expect(main.locator("[data-page-header]")).toContainText(
/queued deploy .+ requested by \S+/u,
);
await main.getByRole("button", { name: "Request cancellation" }).click();
await confirm(page, "Request cancellation");
await expect(main.getByText("canceled", { exact: true })).toBeVisible();
Expand Down
8 changes: 4 additions & 4 deletions packages/delivery/e2e/deployment-outcome.model.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test, type Page } from "@playwright/test";
import { DeploymentPageSchema } from "#shared/hub/hub-contract.ts";
import { api, expectNoHorizontalOverflow } from "./helpers.ts";
import { api, expectNoHorizontalOverflow, statusIn } from "./helpers.ts";

// Served by e2e/model-server.ts: Arcade beta's deploy ended recovery-required
// while its sync step was still running, and the Cloudflare stack's saved
Expand Down Expand Up @@ -30,7 +30,7 @@ test("a failed deployment says why at the top and what the operator can do", asy
// Only the status is live; the relative time beside it is not.
const headerStatus = main.locator("[data-page-header]").getByRole("status");
await expect(headerStatus).toHaveText("failed");
await expect(headerStatus.locator("svg.status-glyph")).toBeVisible();
await expect(headerStatus.locator("[data-sev] > svg")).toBeVisible();
const why = main.getByRole("region", { name: "Why it failed" });
await expect(why).toContainText(
"The sync outlived the executor; its result is unknown",
Expand Down Expand Up @@ -92,7 +92,7 @@ test("a step its deployment outlived reads as interrupted, on the page and on th
.filter({ hasText: "step-sync" })
.first();
await expect(sync).toContainText("interrupted · outcome unknown");
await expect(steps.locator(".status-running")).toHaveCount(0);
await expect(statusIn(steps).filter({ hasText: "running" })).toHaveCount(0);
// Its clock stopped when the deployment ended, so it reads the same later.
const head = sync.locator(".step-head");
const before = await head.textContent();
Expand All @@ -105,7 +105,7 @@ test("a step its deployment outlived reads as interrupted, on the page and on th
.getByRole("region", { name: "beta" });
const action = beta.getByRole("listitem").filter({ hasText: "step-sync" });
await expect(action).toContainText("interrupted · outcome unknown");
await expect(action.locator(".status-running")).toHaveCount(0);
await expect(statusIn(action).filter({ hasText: "running" })).toHaveCount(0);
});

test("a plan rejection checks its reason before asking, and keeps it after a refusal", async ({
Expand Down
Loading