import type { Status, TileView } from "./types.ts"; import { ciDurationSub, SPARKLINE_HEIGHT } from "./tile-render-values.ts"; import { detailList } from "./detail-list.ts"; import { CI_RUNS_MAX, DUR_MAX_AGE_HOURS, DUR_MIN_RUNS, } from "./ci-run-limits.ts"; export interface TileLayoutFixture { label: string; view: TileView; wide?: boolean; subSelector?: string; } const DAY = 86_400_000; const history = () => ``; const twoLines = () => `
`; const trustStrip = (prefix: string, badEvery: number) => ``; const jobList = (rows: readonly (readonly [Status, string, string])[]) => detailList( rows.map(([status, name, detail]) => ({ status, name, detail, })), { subject: "Failing job details", focusKey: "jobs" }, ); const spendSub = (text: string) => `${text}
`; // These are maximum-content loaded states expressed through the renderer's // public TileView contract. The registry test keeps the list complete and in // dashboard order. The browser test supplies these views to renderTile(). const TILE_LAYOUT_FIXTURE_INPUTS: readonly TileLayoutFixture[] = [ { label: "ci", view: { status: "bad", value: "3 failing", valueLabel: "3 failing", aside: `42 jobs · 33 repos`, hint: "every job ↗", href: "/ci", extra: jobList([ ["bad", "loom · Benchmarks", "failure · 3h ago"], ["bad", "labs · CFC properties audit", "failure · 6h ago"], ["bad", "infra · Terraform plan", "timed_out · 1d ago"], ["warn", "gvisor · workflows", "unreadable"], ]), }, }, { label: "labs ci trust", view: { status: "good", value: "90.4%", sub: "first-try green · 156 of last 160 runs", extra: trustStrip("runs", 10), duration: 30 * DAY, alignChartBottom: true, href: "/repos?name=labs", hint: "repository ↗", }, }, { label: "loom ci trust", view: { status: "warn", value: "73.8%", sub: "first-try green · last 160 runs", extra: trustStrip("loom-runs", 4), duration: 30 * DAY, alignChartBottom: true, href: "/repos?name=loom", hint: "repository ↗", }, }, { label: "weaver ci trust", view: { status: "good", value: "95.0%", sub: "first-try green · last 160 runs", extra: trustStrip("weaver-runs", 20), duration: 30 * DAY, alignChartBottom: true, href: "/repos?name=commonfabric-weaver", hint: "repository ↗", }, }, { label: "flaky tests", view: { status: "warn", value: "25 flaky tests", valueLabel: "25 flaky tests", sub: "60 days of runs · 3h old", extra: history(), duration: 18 * DAY, aside: `running`, hint: "flakes ↗", href: "/test-selection#flaky", }, }, { label: "labs ci duration", view: { status: "good", value: "17m", sub: ciDurationSub(CI_RUNS_MAX, DUR_MAX_AGE_HOURS), extra: history(), duration: 30 * DAY, hint: "jobs ↗", href: "/bench?repo=labs", }, }, { label: "loom ci duration", view: { status: "good", value: "6m", sub: ciDurationSub(DUR_MIN_RUNS), extra: history(), duration: 30 * DAY, hint: "jobs ↗", href: "/bench?repo=loom", }, }, { label: "weaver ci duration", view: { status: "good", value: "4m", sub: ciDurationSub(DUR_MIN_RUNS), extra: history(), duration: 3 * DAY, }, }, { label: "test selection", view: { status: "good", value: "2.9%", sub: "16m 48s of 9h 29m test time", extra: history(), duration: 18 * DAY, aside: `running12h old`, hint: "lanes ↗", href: "/test-selection", }, }, { label: "labs coverage debt", view: { status: "warn", value: "78,101 lines", valueLabel: "78,101 lines", sub: "+214 per day (median) · last 21 days", extra: history(), duration: 56 * DAY, }, }, { label: "all benchmarks", subSelector: ".benchmark-count", view: { status: "warn", value: "▲6%", extra: `