Skip to content

Commit 94d671f

Browse files
committed
Merge branch 'feat/dashboard-agent-ui' into feat/dashboard-agent-flows-watch
2 parents fcd2107 + c40b25d commit 94d671f

4 files changed

Lines changed: 68 additions & 3 deletions

File tree

apps/webapp/app/components/dashboard-agent/report-sparkline.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ export function ReportHeadline({
140140
}) {
141141
return (
142142
<p className="flex items-start gap-2 text-sm">
143-
<ReportSeverityIcon severity={severity} tone={tone} className="mt-1.5 shrink-0" />
143+
<ReportSeverityIcon
144+
severity={severity}
145+
tone={tone}
146+
className={cn("shrink-0", (tone ?? severity) === "warn" ? "mt-1" : "mt-0.5")}
147+
/>
144148
<span>
145149
<span className={cn("font-medium", SEVERITY_TEXT[tone ?? severity])}>{phrase}</span>
146150
{continuation ? <span className="text-text-bright">{continuation}</span> : null}
@@ -170,7 +174,7 @@ export function ReportFindingLine({
170174
<p className="grid grid-cols-[1rem_4.5rem_minmax(0,1fr)] items-start gap-x-2">
171175
<ReportSeverityIcon severity={severity} tone={tone} className="mt-0.5" />
172176
<span className="mt-px text-xs uppercase tracking-wide text-text-dimmed">{type}</span>
173-
<span className={cn("-mt-1 text-sm", bright ? "text-text-bright" : "text-text-dimmed")}>
177+
<span className={cn("-mt-0.5 text-sm", bright ? "text-text-bright" : "text-text-dimmed")}>
174178
{text}
175179
</span>
176180
</p>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { describe, expect, it } from "vitest";
2+
import { buildReportLayout, type LayoutViewModel } from "./report-layout";
3+
import { reportMessages } from "./report-messages";
4+
5+
const livenessMetric = {
6+
id: "liveness",
7+
value: 21 * 60 * 1000,
8+
unit: "ms" as const,
9+
severity: "crit" as const,
10+
};
11+
12+
function vmWith(findings: LayoutViewModel["findings"]): LayoutViewModel {
13+
return {
14+
title: "health",
15+
scope: "prod",
16+
period: "last 60 min",
17+
windowMinutes: 60,
18+
summary: { severity: "crit", statements: [] },
19+
findings,
20+
metrics: [livenessMetric],
21+
footer: [],
22+
};
23+
}
24+
25+
const livenessFinding = {
26+
type: "liveness",
27+
severity: "crit" as const,
28+
reason: "stale",
29+
metricIds: ["liveness"],
30+
};
31+
32+
describe("buildReportLayout self-evident findings", () => {
33+
it("drops the metric row of a non-hero finding whose only metric is its own line", () => {
34+
const layout = buildReportLayout(
35+
vmWith([
36+
{ type: "execution", severity: "crit", reason: "failures_up", metricIds: [] },
37+
livenessFinding,
38+
]),
39+
reportMessages("health")
40+
);
41+
42+
const liveness = layout.findings.find((f) => f.type === "liveness");
43+
expect(liveness?.text).toContain("no telemetry in 21m");
44+
expect(liveness?.expanded).toBe(false);
45+
expect(liveness?.metrics).toEqual([]);
46+
});
47+
48+
it("keeps the metric row when that finding is the hero", () => {
49+
const layout = buildReportLayout(vmWith([livenessFinding]), reportMessages("health"));
50+
51+
expect(layout.hero?.type).toBe("liveness");
52+
expect(layout.hero?.expanded).toBe(true);
53+
expect(layout.hero?.metrics.map((m) => m.id)).toEqual(["liveness"]);
54+
});
55+
});

apps/webapp/app/presenters/v3/reports/report-layout.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,12 @@ function findingLayout(
445445
): LayoutFinding {
446446
// A finding whose reason says "we can't say" shows no evidence: the numbers behind it are
447447
// placeholders. Otherwise the hero is always expanded, and the rest only when degraded.
448-
const expanded = !UNASSESSABLE_REASONS.has(finding.reason) && (hero || finding.severity !== "ok");
448+
// A self-evident finding's one metric only repeats its own line ("stale — no telemetry in 21m"
449+
// over "liveness 21m"); as the hero that line is the headline, so the row is its only evidence.
450+
const selfEvident = finding.metricIds.length === 1 && finding.metricIds[0] === finding.type;
451+
const expanded =
452+
!UNASSESSABLE_REASONS.has(finding.reason) &&
453+
(hero || (finding.severity !== "ok" && !selfEvident));
449454

450455
const metrics = expanded
451456
? finding.metricIds

apps/webapp/vitest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default defineConfig({
2020
"app/utils/**/*.test.ts",
2121
"app/components/dashboard-agent/**/*.test.ts",
2222
"app/components/queues/**/*.test.ts",
23+
"app/presenters/v3/reports/**/*.test.ts",
2324
],
2425
// *.e2e.test.ts: smoke matrix, run via vitest.e2e.config.ts.
2526
// *.e2e.full.test.ts: full auth suite, runs via vitest.e2e.full.config.ts

0 commit comments

Comments
 (0)