diff --git a/e2e/console/render-fixtures.ts b/e2e/console/render-fixtures.ts index 0353bfce1..f26209c3f 100644 --- a/e2e/console/render-fixtures.ts +++ b/e2e/console/render-fixtures.ts @@ -53,7 +53,12 @@ const holders = [ "claude-code:3f2a9c1e-7b44-4d0e-a2f1-0c9d8e7f91c4", ]; -function lease(index: number, requesterId = holders[index]) { +function lease( + index: number, + requesterId = holders[index], +): Record & { + readonly ttlDeadline: number; +} { return { id: `lse_${index + 1}`, deviceId: `dev_${index + 1}`, @@ -168,6 +173,9 @@ function leasesBody(scenario: Scenario, onOverview: boolean): unknown { if (record !== undefined) records[index] = { ...record, ttlDeadline: NOW + left }; } } + const [oldest, third] = [13, 11].map((index) => records[index]); + if (oldest !== undefined) records[13] = { ...oldest, label: "feature-checkout-flow" }; + if (third !== undefined) records[11] = { ...third, label: "fix-push-retries" }; return { leases: scenario === "long" ? [lease(0, "x".repeat(256))] : records }; } diff --git a/ui/src/model/leases.ts b/ui/src/model/leases.ts index 79d52480c..87b69d992 100644 --- a/ui/src/model/leases.ts +++ b/ui/src/model/leases.ts @@ -125,6 +125,9 @@ export interface LeaseRowView { readonly model: string; readonly worker?: string; readonly sub: string; + // why: the side list's second line leads with the label, the table's device title does not. + readonly listSub: string; + readonly label?: string; // why: the OS the device runs, as the table's second line names it ("iOS 18.4"). readonly runtime?: string; readonly platform?: string; @@ -164,8 +167,10 @@ export function leaseRows(input: { remaining: formatCountdown(lease.ttlDeadline - now), remainingMs: lease.ttlDeadline - now, renewedAgo: `${formatAgo(now - lease.lastRenewedAt)}`, + listSub: [lease.label, sub].filter((part) => part !== undefined).join(" · "), sub, to: leasePath(lease.id), + ...(lease.label === undefined ? {} : { label: lease.label }), ...(worker === undefined ? {} : { worker }), ...(device === undefined ? {} : { platform: device.spec.platform }), ...runtimeOf(device), @@ -199,7 +204,7 @@ export function searchLeaseRows( const wanted = query.toLowerCase(); if (wanted === "") return rows; return rows.filter((row) => - [row.holder, row.model, row.worker, row.id].some((field) => + [row.holder, row.label, row.model, row.worker, row.id].some((field) => field?.toLowerCase().includes(wanted), ), ); @@ -232,6 +237,7 @@ export interface LeaseInspection { readonly udid: string; }; readonly holder?: Holder; + readonly label?: string; readonly ownerId?: string; readonly requestId?: string; } @@ -303,13 +309,14 @@ function recordFacts( id: string, ): Pick< LeaseInspection, - "renewed" | "title" | "kind" | "percent" | "holder" | "ownerId" | "ttl" | "token" + "renewed" | "title" | "kind" | "percent" | "holder" | "label" | "ownerId" | "ttl" | "token" > { if (record === undefined) return { kind: "unknown", renewed: "—", title: id }; const holder = holderOf(record.requesterId, tokens); return { holder, kind: agentKind(record.requesterId), + ...(record.label === undefined ? {} : { label: record.label }), percent: percentLeft(deadline, now, record.ttlMs), token: record.ownerId, ttl: formatDuration(record.ttlMs), diff --git a/ui/src/model/search.test.ts b/ui/src/model/search.test.ts index e187df401..d9c80fc85 100644 --- a/ui/src/model/search.test.ts +++ b/ui/src/model/search.test.ts @@ -107,6 +107,26 @@ describe("the search results", () => { }); }); +describe("a labelled lease in the search", () => { + it("reads `