Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6060863
feat(console): watch running device screens side by side
arekkubaczkowski Nov 4, 2026
0e18fdf
fix(console): distinguish screen regions for assistive navigation
arekkubaczkowski Nov 4, 2026
3e86a3f
test(console): cover Screens updates when devices appear
arekkubaczkowski Nov 4, 2026
125bbcb
fix(console): honor the latest screen visibility observation
arekkubaczkowski Nov 4, 2026
03319c3
Merge origin/main into simlock/screens-wall
arekkubaczkowski Nov 4, 2026
b4db2be
docs(console): keep related links after the Screens guide
arekkubaczkowski Nov 4, 2026
0f7e136
fix(ui): distinguish Screens links and model tile notices
arekkubaczkowski Nov 4, 2026
0142ff9
fix(ui): use standard card padding for Screens headers
arekkubaczkowski Nov 4, 2026
c34a9db
fix(ui): bound Screens captures until stream cleanup completes
arekkubaczkowski Nov 4, 2026
54a1dc3
fix(ui): close Screens fixtures on failure and keep budget rules in m…
arekkubaczkowski Nov 4, 2026
5779325
Merge main into screens-wall
V3RON Nov 19, 2026
99c03cb
test(console): mark the Screens fake-daemon routers as known complexi…
V3RON Nov 19, 2026
5fa7f5e
docs(ui): keep the console manual under its size cap
V3RON Nov 19, 2026
d21fee4
feat(console): Screens lists running devices with their holders and s…
V3RON Nov 19, 2026
86d8290
fix(console): a stacked table row's tint and hover cover the whole row
V3RON Nov 19, 2026
26b0547
fix(console): Screens puts its filter chips above the table, as the o…
V3RON Nov 19, 2026
fe92551
fix(console): Screens keeps the watch list when its own sidebar link …
V3RON Nov 19, 2026
fb2731e
test(console): the browser lane's sidebar list includes Screens
V3RON Nov 19, 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
2 changes: 1 addition & 1 deletion docs/internal/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ own that one of them draws. Named sizes and colours are above.
then the links (icon 16px, label 500, muted; current one `--accent-text`
on `--nav-current`, `aria-current="page"`) in a fixed order: Overview,
Inbox, then **Operate**: Fleet, Leases, Queue, Baselines; then
**Observe**: Activity, Usage; then **Settings**: Settings (a gear icon), each
**Observe**: Screens, Activity, Usage; then **Settings**: Settings (a gear icon), each
group under a label. Inbox carries its
problem count in a red round badge, none at zero. At the bottom an account
box on `--bg`: a 26px avatar chip, the token label or id (mono, cut), the
Expand Down
2 changes: 1 addition & 1 deletion docs/internal/console-redesign/PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ One agent; everything else waits for it.
of DESIGN.md. Rename or add tokens; delete `--chip` and `--field` (an
input's fill is `--bg`). Foundation also owns mechanical substitutions in
`ui/src/screens/sign-in.css`, `inbox/inbox.css`,
`overview/overview.css` and `fleet/screen-panel.css`; no other changes to
`overview/overview.css` and `screen-view.css` (then `fleet/screen-panel.css`); no other changes to
those screens before their page stages. Verify no retired-token consumers
remain and existing pages render in both themes. (decided in delivery, pending the maintainer)
- Restyle the `ds` primitives every page shares, to the renders' sidebar,
Expand Down
1 change: 1 addition & 0 deletions e2e/console/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ export const NAV = [
{ label: "Leases", path: "/leases" },
{ label: "Queue", path: "/queue" },
{ label: "Baselines", path: "/baselines" },
{ label: "Screens", path: "/screens" },
{ label: "Activity", path: "/activity" },
{ label: "Usage", path: "/usage" },
{ label: "Settings", path: "/settings" },
Expand Down
252 changes: 252 additions & 0 deletions e2e/console/screens-http1.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
import { createServer, type ServerResponse } from "node:http";
import { readFile, writeFile } from "node:fs/promises";
import { extname, resolve } from "node:path";

import { expect, test } from "@playwright/test";

test("keeps HTTP/1 reads moving while four watched screens capture, and closes them on removal, hiding, navigation and sign-out", async ({
page,
}, testInfo) => {
const devices = new Map([
["a", ["one", "two", "three"]],
["b", ["one", "two", "three"]],
]);
const captures = new Map<string, ServerResponse>();
const held = new Set<ServerResponse>();
const history: { kind: string; key: string; active: number }[] = [];
let events: ServerResponse | undefined;
let workerReads = 0;
const versions = new Set<string>();
let duplicates = 0;
let unauthorized = false;
const packet = (tag: number, value: Buffer) => {
const out = Buffer.alloc(value.length + 5);
out.writeUInt32BE(value.length + 1);
out[4] = tag;
value.copy(out, 5);
return out;
};
const jpeg = Buffer.from(
await page.evaluate(() => {
const canvas = document.createElement("canvas");
canvas.width = 180;
canvas.height = 390;
const context = canvas.getContext("2d")!;
context.fillStyle = "#192c3b";
context.fillRect(0, 0, 180, 390);
context.fillStyle = "white";
context.fillText("Synthetic HTTP/1 fixture", 8, 100);
return canvas.toDataURL("image/jpeg").split(",")[1]!;
}),
"base64",
);
const emit = () =>
events!.write(
`event: device.ready\ndata: ${JSON.stringify({ id: "synthetic-change", seq: workerReads, timestamp: Date.now(), event: "device.ready", payload: { deviceId: "four" } })}\n\n`,
);
// fallow-ignore-next-line complexity -- the fake daemon's router: one branch per route it answers.
const server = createServer(async (req, res) => {
versions.add(req.httpVersion);
const path = req.url!;
const json = (value: unknown, status = 200) =>
res.writeHead(status, { "Content-Type": "application/json" }).end(JSON.stringify(value));
if (path.startsWith("/v1/") && unauthorized) {
json({ error: { code: "UNAUTHORIZED", message: "Synthetic signed out" } }, 401);
return;
}
if (path === "/v1/events/stream") {
res.writeHead(200, { "Content-Type": "text/event-stream" });
res.write(": connected\n\n");
events = res;
held.add(res);
res.on("close", () => held.delete(res));
return;
}
if (path.startsWith("/v1/stream/")) {
const [, worker, device] = /workers\/([^/]+)\/devices\/([^/]+)/.exec(path)!;
const key = `${worker}/${device}`;
if (captures.has(key)) duplicates++;
captures.set(key, res);
held.add(res);
history.push({ kind: "open", key, active: captures.size });
res.on("close", () => {
if (captures.get(key) === res) captures.delete(key);
held.delete(res);
history.push({ kind: "close", key, active: captures.size });
});
res.writeHead(200, { "Content-Type": "application/octet-stream" });
res.write(
packet(5, Buffer.from(JSON.stringify({ codec: "mjpeg", width: 180, height: 390, fps: 5 }))),
);
res.write(packet(3, jpeg));
return;
}
if (path === "/v1/workers") {
workerReads++;
json({
workers: [...devices].map(([id, ids]) => ({
id,
label: "Synthetic worker",
connection: "connected",
drained: false,
lastSeenAt: 0,
capabilities: [{ name: "stream", state: "available" }],
devices: ids.map((id) => ({
id,
state: "ready",
physical: false,
spec: { platform: "ios", model: "iPhone", osVersion: "18.4" },
})),
})),
});
return;
}
const answers: Record<string, unknown> = {
"/v1/identity": { name: "Synthetic operator", via: "token" },
"/v1/healthz": { ok: true },
"/v1/status": { daemon: { mode: "worker", version: "0.5.0" } },
"/v1/inbox": { items: [], now: Date.now() },
};
if (Object.hasOwn(answers, path)) {
json(answers[path]);
return;
}
if (path.startsWith("/v1/")) {
json({});
return;
}
try {
const file = resolve("dist/ui", "." + (path.startsWith("/assets/") ? path : "/index.html"));
const bytes = await readFile(file);
res.setHeader(
"Content-Type",
(
{ ".js": "text/javascript", ".css": "text/css", ".html": "text/html" } as Record<
string,
string
>
)[extname(file)] ?? "application/octet-stream",
);
res.end(bytes);
} catch {
res.writeHead(404).end();
}
});
await new Promise<void>((done) => server.listen(0, "127.0.0.1", done));
const origin = `http://127.0.0.1:${(server.address() as { port: number }).port}`;
try {
await page.addInitScript(() =>
sessionStorage.setItem("simlock.operatorToken", "synthetic-test-token"),
);
await page.setViewportSize({ width: 1900, height: 1900 });
await page.clock.install();
const watch = new URLSearchParams();
for (const key of [
["a", "one"],
["a", "two"],
["b", "one"],
["b", "two"],
])
watch.append("watch", JSON.stringify(key));
const screens = `${origin}/screens?${watch}`;
await page.goto(screens);
await expect(page.locator(".screens-slot")).toHaveCount(4);
await expect.poll(() => captures.size).toBe(4);
const beforePoll = workerReads;
await page.clock.runFor(15_001);
await expect.poll(() => workerReads).toBeGreaterThan(beforePoll);
expect([...versions]).toEqual(["1.1"]);
expect(await page.locator("canvas").count()).toBe(4);
await expect
.poll(() =>
page
.locator("canvas")
.evaluateAll((nodes) =>
nodes.every(
(node) =>
(node as HTMLCanvasElement).getContext("2d")!.getImageData(0, 0, 1, 1).data[3] ===
255,
),
),
)
.toBe(true);
devices.get("a")!.push("four");
emit();
await page.clock.runFor(350);
await page.getByRole("radio", { name: "All" }).check({ force: true });
await expect(page.getByRole("button", { name: /^Watch .*\(four\)$/ })).toBeDisabled();
expect(await page.evaluate(async () => (await fetch("/v1/healthz")).status)).toBe(200);
devices.set(
"a",
devices.get("a")!.filter((id) => id !== "one"),
);
emit();
await page.clock.runFor(350);
await expect(page.locator(".screens-slot")).toHaveCount(3);
await expect.poll(() => captures.has("a/one")).toBe(false);
await expect.poll(() => captures.size).toBe(3);
await page.getByRole("button", { name: /^Watch .*\(four\)$/ }).click();
await expect(page.locator(".screens-slot")).toHaveCount(4);
await expect.poll(() => captures.size).toBe(4);
const failed = captures.keys().next().value!;
captures.get(failed)!.write(Buffer.from([255, 255, 255, 255, 1]));
await expect(
page.getByText("The stream is not a frame envelope", { exact: true }),
).toBeVisible();
await expect.poll(() => captures.has(failed)).toBe(false);
await expect.poll(() => captures.size).toBe(3);
expect(await page.locator("canvas").count()).toBe(3);
await page.evaluate(() => {
Object.defineProperty(document, "visibilityState", { configurable: true, value: "hidden" });
document.dispatchEvent(new Event("visibilitychange"));
});
await expect.poll(() => captures.size).toBe(0);
await expect(page.locator("canvas")).toHaveCount(0);
await page.evaluate(() => {
Object.defineProperty(document, "visibilityState", { configurable: true, value: "visible" });
document.dispatchEvent(new Event("visibilitychange"));
});
await expect.poll(() => captures.size).toBe(4);
await page.getByRole("link", { name: "Fleet", exact: true }).click();
await expect.poll(() => captures.size).toBe(0);
await page.getByRole("link", { name: "Screens", exact: true }).click();
await expect.poll(() => captures.size).toBe(4);
await page.getByRole("button", { name: "Sign out", exact: true }).click();
await expect.poll(() => captures.size).toBe(0);
// why: the first address named a/one, which is gone, and not a/four.
await page.goto(screens);
await expect.poll(() => captures.size).toBe(3);
unauthorized = true;
emit();
await page.clock.runFor(350);
await expect(page.getByRole("button", { name: "Sign in", exact: true })).toBeVisible();
await expect.poll(() => captures.size).toBe(0);
expect(duplicates).toBe(0);
} finally {
try {
const record = testInfo.outputPath("http1-ownership-history.json");
await writeFile(
record,
JSON.stringify({ versions: [...versions], history, workerReads, duplicates }, null, 2),
);
await testInfo.attach("http1-ownership-history", {
path: record,
contentType: "application/json",
});
} finally {
try {
await page.close();
} finally {
try {
for (const response of held) response.destroy();
} finally {
try {
server.closeAllConnections();
} finally {
await new Promise<void>((done) => server.close(() => done()));
}
}
}
}
}
});
Loading
Loading