Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
862a5ae
test: clicking a row opens /fleet/<id> with the worker's name as the …
V3RON Oct 20, 2026
aa9d0c8
feat(console): Fleet is a table, and a worker has its own page with t…
V3RON Oct 20, 2026
9a9adf1
test: the Fleet table lists every worker with its name, system, state…
V3RON Oct 20, 2026
dc5854c
feat(console): the Fleet table shows state, slots, use and load per w…
V3RON Oct 20, 2026
801d69f
test: the Issues chip shows only workers with a health or load findin…
V3RON Oct 20, 2026
6f8afe5
feat(console): the Issues filter asks one rule, hasIssue (#766)
V3RON Oct 20, 2026
a456fbd
test: the search box filters by any part of the worker's name, id or …
V3RON Oct 20, 2026
05b0aee
feat(console): Fleet has a search box, kept in the address as ?q= (#766)
V3RON Oct 20, 2026
69aa3a7
test: the worker page shows today's load meters, capacity cards with …
V3RON Oct 20, 2026
86a5d03
test: each tab shows its content, sets ?tab=, and survives a reload (…
V3RON Oct 20, 2026
4dcf261
test: ?tab= with an unknown value shows Devices (#766)
V3RON Oct 20, 2026
a81be86
test: ?tab=warm-pool on a starting worker shows Devices (#766)
V3RON Oct 20, 2026
6c2a389
test: a disconnected worker's page shows the banner Disconnected · la…
V3RON Oct 20, 2026
de4b39c
feat(console): a worker's page says when it is disconnected or draine…
V3RON Oct 20, 2026
f48f0b3
test: an incompatible worker's Devices tab says No devices: the gatew…
V3RON Oct 20, 2026
e2a8cbd
feat(console): an incompatible worker's page shows no load and says i…
V3RON Oct 20, 2026
fc7a200
test: data/mode.ts keeps gateway or worker after a good read, keeps n…
V3RON Oct 20, 2026
94884c0
feat(console): the console reads the daemon's mode after sign-in and …
V3RON Oct 20, 2026
22ce9bd
test: a Devices row opens the drawer at /fleet/<id>/<deviceId> with t…
V3RON Oct 20, 2026
941e00f
feat(console): a device on a worker's page opens in a drawer at /flee…
V3RON Oct 20, 2026
9ad401a
test: closing the device drawer returns to /fleet/<id>?tab=devices wi…
V3RON Oct 20, 2026
92efdf2
test: on a gateway the Events tab lists only that worker's events, on…
V3RON Oct 20, 2026
e558cdb
test: a worker's events are the gateway's relayed ones named by paylo…
V3RON Oct 20, 2026
e2f71ff
feat(console): a worker's Events tab lists the events the console hol…
V3RON Oct 20, 2026
69dcac0
test: an unknown worker id shows This worker is not in the fleet. and…
V3RON Oct 20, 2026
dc32dc9
feat(console): a worker the fleet does not list says so, with a link …
V3RON Oct 20, 2026
7be6fe3
test: on a single host Fleet shows one row, the host, and its page wo…
V3RON Oct 20, 2026
9f737f2
feat(console): the worker page's Host tab shows the worker's version …
V3RON Oct 20, 2026
a119ac7
test: axe passes on Fleet, a worker page and a device drawer, in ligh…
V3RON Oct 20, 2026
cefccfd
test: the console specs follow Fleet's table and the worker page, and…
V3RON Oct 20, 2026
f79bbc0
docs(console): Fleet is a table, a worker has a page with tabs, and a…
V3RON Oct 20, 2026
32a010a
test: a worker's page and device drawer name their ids by their own e…
V3RON Oct 20, 2026
ae02cd3
refactor(console): the worker-list answers share one route, and the t…
V3RON Oct 20, 2026
d43d8bc
test: the real-proxy lane counts the Fleet table's rows (#766)
V3RON Oct 20, 2026
2a86350
test: the mode read counts its reads, a worker's events order by time…
V3RON Oct 20, 2026
e3939dd
test: a row click opens the page, the Events tab shows, the lease cou…
V3RON Oct 20, 2026
6926f74
fix(console): the Fleet filter lives in the address; drop repeated an…
V3RON Oct 20, 2026
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
20 changes: 12 additions & 8 deletions docs/internal/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,25 @@ put together from them and draws nothing of its own that one of them already dra
opens the links and the bottom block under it.
- **Page.** A page that is not a list, as the overview: its title (`h1`) and its actions on the
right, then its content. No subtitle: the title and what is under it say what the page is.
- **List and inspector.** Fleet, Queue, Attention and Activity (workers, waiting requests,
attention items, events) are each a list on the left, 260–360px wide (wider for events), and the chosen thing in
- **List and inspector.** Queue, Attention and Activity (waiting requests, attention items,
events) are each a list on the left, 260–360px wide (wider for events), and the chosen thing in
an inspector filling the rest. The list has a header (the page's title as `h1`, a short count
in mono beside it, then its filters), its rows, and the pager under them. A row is one or two
short lines: a status square, a title, one figure on the right, and at most one muted line or
bar under them; the chosen row is `--surface` with a 2px `--accent` bar on its left and
`aria-current="page"`. The address names the chosen thing (`/fleet/<id>`). The inspector
`aria-current="page"`. The address names the chosen thing (`/queue/<id>`). The inspector
has a breadcrumb, the thing's title (`h2`), one muted line under it, actions on the right, and
then cards, facts, tabs and panels.
- **Table and drawer.** Leases is a toolbar (the filter chips on the left, a search box on the
right, at the page title's padding) over a table. Choosing a row opens a **drawer**: a 480px
- **Table and drawer.** Leases and Fleet are each a toolbar (the filter chips on the left, a search box on the
right, at the page title's padding) over a table. Leases' filters are its own; Fleet's are
All, Issues and Busy over workers, and a row opens the worker's own page (a title, a state
line, a banner when the worker is disconnected or drained, cards, then tabs), on which a
device row opens the drawer. Choosing a lease or a device opens a **drawer**: a 480px
panel (full width under 768px) at the right edge over the page, with a dim layer over everything
else, the sidebar included. It has a title (the holder), a 40px square close button (`IconButton`)
and tabs. Escape, the close button and the dim layer close it. It slides in once, when it opens,
and switching its tabs does not replay that. It uses no status colour of its own.
else, the sidebar included. It has a title (a lease's holder, a device's model and runtime), a 40px square close button
(`IconButton`) and, for a lease, tabs. Escape, the close button and the dim layer close it. It slides in once, when it opens,
and switching its tabs does not replay that. A lease's drawer uses no status colour of its own;
a device's shows the device's state as a status, word and square.
- **Stat tiles.** A row of tiles: a label, a big number (`--text-xl`), and a short unit in mono
beside it ("of 48", "last hour"). A tile that leads somewhere is a link as a whole. A tile
shows only numbers its page already has; it never makes a request of its own.
Expand Down
19 changes: 9 additions & 10 deletions e2e/console/long-lists.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ function pad(n: number): string {
return String(n).padStart(4, "0");
}

function pane(page: Page, title: string): Locator {
return page.getByRole("region", { name: title, exact: true });
}

function rowIds(list: Locator, section: string): Promise<string[]> {
return list.getByRole("link").evaluateAll(
(links, prefix) =>
Expand Down Expand Up @@ -366,7 +362,7 @@ test.describe("long lists page", () => {
await expect(pager(page, "Leases").locator(".pager-range")).toHaveText("1–25 of 26");
});

test("the worker list and the devices table in its inspector keep their own page in the URL", async ({
test("the Fleet table and the devices table on a worker's page keep their own page in the URL", async ({
daemon,
page,
}) => {
Expand All @@ -385,7 +381,7 @@ test.describe("long lists page", () => {
label: `worker-${pad(index + 1)}`,
}));
await answer(page, "/v1/workers", () => ({ workers }));
await open(page, daemon, "/fleet/wrk_0001");
await open(page, daemon, "/fleet");
const devicesTable = page.getByRole("region", { name: "Devices" }).locator("table");
const deviceIds = async () =>
(await devicesTable.locator("tbody tr td:first-child").allTextContents()).map(
Expand All @@ -394,21 +390,23 @@ test.describe("long lists page", () => {

await pager(page, "Workers").getByRole("button", { name: "Next" }).click();
await expect(pager(page, "Workers").locator(".pager-range")).toHaveText("26–30 of 30");
await expect(page.locator("main tbody").getByRole("link").first()).toHaveText("worker-0026");
expect(await rowIds(page.locator("main tbody"), "/fleet")).toEqual(ids(26, 30, "wrk"));
await page.getByRole("link", { exact: true, name: "worker-0026" }).click();
await pager(page, "Devices").getByRole("button", { name: "Next" }).click();
await pager(page, "Devices").getByRole("button", { name: "Next" }).click();
await expect(pager(page, "Devices").locator(".pager-range")).toHaveText("51–60 of 60");

expect(await deviceIds()).toEqual(ids(51, 60, "dev"));
expect(await rowIds(pane(page, "Fleet"), "/fleet")).toEqual(ids(26, 30, "wrk"));
expect(Object.fromEntries(new URL(page.url()).searchParams)).toEqual({
"devices-page": "3",
page: "2",
});

// A reload opens both where they were.
await page.reload();
await expect(pager(page, "Workers").locator(".pager-range")).toHaveText("26–30 of 30");
await expect(pager(page, "Devices").locator(".pager-range")).toHaveText("51–60 of 60");
await page.getByRole("navigation", { name: "Breadcrumb" }).getByRole("link").click();
await expect(pager(page, "Workers").locator(".pager-range")).toHaveText("26–30 of 30");
});

test("the worker list pages at 25 like the others and keeps a new size in the URL", async ({
Expand All @@ -424,13 +422,14 @@ test.describe("long lists page", () => {
}));
await answer(page, "/v1/workers", () => ({ workers }));
await open(page, daemon, "/fleet");
const rows = pane(page, "Fleet").getByRole("list", { name: "Workers" });
const rows = page.locator("main tbody");
const range = pager(page, "Workers").locator(".pager-range");

expect(await rowIds(rows, "/fleet")).toEqual(ids(1, 25, "wrk"));
await expect(range).toHaveText("1–25 of 30");
await pager(page, "Workers").getByRole("button", { name: "Next" }).click();
await expect(range).toHaveText("26–30 of 30");
await expect(rows.getByRole("link").first()).toHaveText("worker-0026");
expect(await rowIds(rows, "/fleet")).toEqual(ids(26, 30, "wrk"));
await expect(pager(page, "Workers").getByLabel("Per page").locator("option")).toHaveText([
"25",
Expand Down
54 changes: 47 additions & 7 deletions e2e/console/views.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AxeBuilder } from "@axe-core/playwright";
import type { Page } from "@playwright/test";

import {
Expand All @@ -18,6 +19,7 @@ const LEASE = ["lease", "--platform", "ios", "--device", "iPhone 16", "--os", "1
interface Pages {
readonly views: readonly { readonly label: string; readonly path: string }[];
readonly worker: string;
readonly device: string;
readonly lease: string;
}

Expand All @@ -31,19 +33,22 @@ async function hostWithLease(): Promise<{ readonly host: RunningDaemon; readonly
const host = await startDaemon("worker", { driverScript: { ios: IOS } });
const lease = await takeLease(host, "console-views");
const listed = await host.cli(["worker", "list", "--json"]);
const [worker] = (listed.json as { workers: { id: string }[] }).workers;
const [worker] = (listed.json as { workers: { id: string; leases: { deviceId: string }[] }[] })
.workers;
const workerPath = `/fleet/${encodeURIComponent(worker?.id ?? "")}`;
return {
host,
pages: {
device: `${workerPath}/${encodeURIComponent(worker?.leases[0]?.deviceId ?? "")}?tab=devices`,
lease: `/leases/${encodeURIComponent(lease)}/`,
views: NAV.map((entry) => ({ label: entry.label, path: entry.path })),
worker: `/fleet/${encodeURIComponent(worker?.id ?? "")}`,
worker: workerPath,
},
};
}

function every(pages: Pages): readonly string[] {
return [...pages.views.map((view) => view.path), pages.worker, pages.lease];
return [...pages.views.map((view) => view.path), pages.worker, pages.device, pages.lease];
}

async function openSignedIn(page: Page, host: RunningDaemon): Promise<void> {
Expand All @@ -52,13 +57,18 @@ async function openSignedIn(page: Page, host: RunningDaemon): Promise<void> {
await expect(page.getByRole("heading", { level: 1, name: "Overview" })).toBeVisible();
}

// why: an open drawer hides the page behind it from assistive technology.
function opensDrawer(path: string): boolean {
return /^\/leases\/./.test(path) || /^\/fleet\/[^/?]+\/./.test(path);
}

async function visit(page: Page, host: RunningDaemon, path: string): Promise<void> {
await page.goto(new URL(path, host.url).toString());
// why: an open drawer hides the page behind it from assistive technology, so there the heading is found by hidden role too.
await expect(
page
.locator("#main")
.getByRole("heading", { includeHidden: /^\/leases\/./.test(path) })
.getByRole("heading", { includeHidden: opensDrawer(path) })
.first(),
).toBeVisible();
await expect(page.locator("#main")).not.toContainText("Loading…");
Expand Down Expand Up @@ -96,8 +106,9 @@ test.describe("every view", () => {
const { host, pages } = await hostWithLease();
try {
await openSignedIn(page, host);
// why: a drawer traps the keyboard inside itself, so the lease page is left out of this order.
for (const path of every(pages).filter((candidate) => candidate !== pages.lease)) {
// why: a drawer traps the keyboard inside itself, so the lease and device pages are left out
// of this order.
for (const path of every(pages).filter((candidate) => !opensDrawer(candidate))) {
await visit(page, host, path);
// why: a radio group is one stop, at its checked radio, and nothing inside a closed
// disclosure is a stop, so those are left out of the order Tab should follow; neither is
Expand Down Expand Up @@ -243,7 +254,7 @@ test.describe("every view", () => {

for (const path of every(pages)) {
await visit(page, host, path);
if (path === pages.lease) await expect(page.getByRole("dialog")).toBeVisible();
if (opensDrawer(path)) await expect(page.getByRole("dialog")).toBeVisible();
const chart = page.locator(".chart svg").first();
if ((await chart.count()) > 0) {
await chart.hover();
Expand All @@ -262,6 +273,35 @@ test.describe("every view", () => {
}
});

for (const colorScheme of ["light", "dark"] as const) {
test(`Fleet, a worker page and a device drawer pass an automated WCAG AA check (${colorScheme})`, async ({
page,
}) => {
const { host, pages } = await hostWithLease();
try {
await page.emulateMedia({ colorScheme });
await openSignedIn(page, host);
for (const path of ["/fleet", pages.worker, pages.device]) {
await visit(page, host, path);
if (opensDrawer(path)) await expect(page.getByRole("dialog")).toBeVisible();
const results = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
.analyze();
expect(results.passes.map((rule) => rule.id)).toContain("color-contrast");
expect(
results.violations.map((violation) => ({
id: violation.id,
targets: violation.nodes.map((node) => node.target.join(" ")),
})),
path,
).toEqual([]);
}
} finally {
await host.dispose();
}
});
}

test("the overview's tiles show the numbers the daemon gives", async ({ page }) => {
const { host } = await hostWithLease();
try {
Expand Down
87 changes: 56 additions & 31 deletions e2e/console/workers-answers.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { Page, Route } from "@playwright/test";

interface WorkerPayload {
load?:
| {
memory?: { availableBytes?: number; pressure?: string; totalBytes?: number } | undefined;
}
| undefined;
connection?: string;
load?: unknown;
}

interface LoadPayload {
memory?: { availableBytes?: number; pressure?: string; totalBytes?: number } | undefined;
}

// why: the page re-reads the list every second, so a re-read can be intercepted just as the test's
Expand All @@ -31,47 +32,71 @@ export interface MemoryClaim {
readonly usedPercent: number;
}

/**
* why: only macOS reports a memory pressure, and how full a CI machine's memory happens to be is
* nobody's to predict — so the colour test states the memory reading it wants and this writes just
* those fields into the daemon's own answer, leaving every other field, its headers and its `Date`
* real. The route is asked again per request, so the reading stays as fresh as the daemon's own.
*/
export async function answerMemory(page: Page, claim: () => MemoryClaim): Promise<void> {
// why: the three answers below differ only in what they do to each worker of the daemon's own
// answer, so the route, the connect-error rule and the real headers are written once.
async function editWorkers(page: Page, edit: (worker: WorkerPayload) => void): Promise<void> {
await page.route(
(url) => url.pathname === "/v1/workers",
async (route: Route) => {
const response = await fetchOrDrop(route);
if (response === undefined) return;
const listed = (await response.json()) as { workers: WorkerPayload[] };
for (const worker of listed.workers) {
const memory = worker.load?.memory;
const total = memory?.totalBytes;
if (memory === undefined || typeof total !== "number" || total <= 0) continue;
const wanted = claim();
memory.availableBytes = Math.round((total * (100 - wanted.usedPercent)) / 100);
if (wanted.pressure === undefined) delete memory.pressure;
else memory.pressure = wanted.pressure;
}
for (const worker of listed.workers) edit(worker);
await route.fulfill({ json: listed, response });
},
);
}

/**
* why: only macOS reports a memory pressure, and how full a CI machine's memory happens to be is
* nobody's to predict — so the colour test states the memory reading it wants and this writes just
* those fields into the daemon's own answer, leaving every other field, its headers and its `Date`
* real. The route is asked again per request, so the reading stays as fresh as the daemon's own.
*/
export async function answerMemory(page: Page, claim: () => MemoryClaim): Promise<void> {
await editWorkers(page, (worker) => {
const memory = (worker.load as LoadPayload | undefined)?.memory;
const total = memory?.totalBytes;
if (memory === undefined || typeof total !== "number" || total <= 0) return;
const wanted = claim();
memory.availableBytes = Math.round((total * (100 - wanted.usedPercent)) / 100);
if (wanted.pressure === undefined) delete memory.pressure;
else memory.pressure = wanted.pressure;
});
}

/**
* why: a machine's own disk or CPU may already be over a threshold, which would turn every square
* the page draws and hide the state a test is about (a drain, a lost link). A test about squares
* answers the page's read of the worker list without the load reading, so only the states are left.
*/
export async function answerWithoutLoad(page: Page): Promise<void> {
await page.route(
(url) => url.pathname === "/v1/workers",
async (route: Route) => {
const response = await fetchOrDrop(route);
if (response === undefined) return;
const listed = (await response.json()) as { workers: WorkerPayload[] };
for (const worker of listed.workers) delete worker.load;
await route.fulfill({ json: listed, response });
},
);
await editWorkers(page, (worker) => {
delete worker.load;
});
}

/**
* why: a table test that states exact CPU, memory and disk figures cannot use the machine's own
* reading, so every connected worker is answered with this one, in the shape the daemon sends it.
*/
export async function answerWithLoad(
page: Page,
load: { readonly cpu: number; readonly memory: number; readonly disk: number },
): Promise<void> {
const GIB = 1024 ** 3;
await editWorkers(page, (worker) => {
if (worker.connection !== "connected") return;
worker.load = {
cpu: { busyPercent: load.cpu, cores: 8, limited: false },
disk: { freeBytes: ((100 - load.disk) / 100) * 500 * GIB, totalBytes: 500 * GIB },
memory: {
availableBytes: ((100 - load.memory) / 100) * 32 * GIB,
limited: false,
swapUsedBytes: 0,
totalBytes: 32 * GIB,
},
readAt: Date.now(),
};
});
}
5 changes: 4 additions & 1 deletion e2e/console/workers-gateway-stops-mid-fetch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ async function openConsole(page: Page, daemon: RunningDaemon): Promise<void> {
}

function workerRows(page: Page): Locator {
return page.getByRole("list", { name: "Workers", exact: true }).getByRole("listitem");
return page
.getByRole("table")
.getByRole("row")
.filter({ has: page.getByRole("cell") });
}

async function askForWorkerList(page: Page, daemon: RunningDaemon): Promise<number> {
Expand Down
Loading
Loading