From 407f09cb152ed8237a62cdc8ef9bccf6f8fdf29e Mon Sep 17 00:00:00 2001 From: Nam Rodriguez Date: Tue, 3 Nov 2026 02:07:45 -0500 Subject: [PATCH] Logs: say when a quiet finding resolves on its own An open or acknowledged finding now reads "Quiet for N days. Resolves on its own unless seen again", and one the analyzer closed reads "Resolved on its own ". Resolved and ignored findings show a dimmed severity and sort after open ones. Mark as new stays. --- dashboard/e2e/logs.spec.ts | 36 +++++++++++++++++++++++++++++++++ dashboard/src/app/logs/page.tsx | 34 ++++++++++++++++++++++++++++--- dashboard/src/lib/api.ts | 7 +++++++ 3 files changed, 74 insertions(+), 3 deletions(-) diff --git a/dashboard/e2e/logs.spec.ts b/dashboard/e2e/logs.spec.ts index a1c77f04..90aaaaaf 100644 --- a/dashboard/e2e/logs.spec.ts +++ b/dashboard/e2e/logs.spec.ts @@ -164,6 +164,42 @@ async function shot(page: Page, name: string) { await page.screenshot({ path: path.join(SHOTS_DIR, `${name}.png`), fullPage: true }); } +test("a quiet finding says when it resolves on its own, and a resolved one says it did", async ({ page }) => { + const day = 24 * HOUR; + const quiet = finding({ + rec_id: "rec_quiet", + status: "acknowledged", + title: "Prerender cache writes fail with no space left", + last_seen: ago(3 * day), + quiet_days: 8, + resolves_at: new Date(Date.now() + 5 * day).toISOString(), + }); + const resolved = finding({ + rec_id: "rec_resolved", + status: "fixed", + title: "Image resize worker ran out of memory", + last_seen: ago(5 * day), + resolved_at: ago(2 * day), + resolved_reason: "Resolved: no new lines for 3 days", + }); + await mockApi(page, { findings: [quiet, resolved] }); + await page.goto("/logs/"); + + const q = page.getByTestId("finding-rec_quiet"); + await expect(q).toContainText("Quiet for 3 days. Resolves on its own"); + await expect(q).toContainText("unless seen again"); + const r = page.getByTestId("finding-rec_resolved"); + await expect(r).toContainText("Resolved on its own"); + await expect(r).toContainText("(no new lines for 3 days)"); + // Open findings first, resolved after. + const ids = await page.locator('[data-testid^="finding-rec_"]').evaluateAll((els) => els.map((e) => e.getAttribute("data-testid"))); + expect(ids.indexOf("finding-rec_quiet")).toBeLessThan(ids.indexOf("finding-rec_resolved")); + // Mark as new stays on the open one. + await q.getByRole("button", { name: "Show details of Prerender cache writes fail with no space left" }).click(); + await expect(page.getByTestId("finding-quiet")).toContainText("Resolves on its own"); + await expect(page.getByRole("button", { name: "Mark as new" })).toBeVisible(); +}); + test("Logs is its own menu item, with Logs and Alerts as its tabs", async ({ page }) => { await mockApi(page); await page.goto("/logs/"); diff --git a/dashboard/src/app/logs/page.tsx b/dashboard/src/app/logs/page.tsx index 9ec5db33..cee0b29c 100644 --- a/dashboard/src/app/logs/page.tsx +++ b/dashboard/src/app/logs/page.tsx @@ -28,6 +28,7 @@ import { Code } from "@/components/settings/code"; import { Page, PageHeader } from "@/components/page"; import { buttonClass, focusRing, inputClass, linkButton, primaryButton, secondaryButton } from "@/components/ui"; import { Select } from "@/components/select"; +import { formatDate } from "@/components/list/time"; import { Chip, DetailBlock, @@ -82,6 +83,27 @@ function plural(n: number, one: string, many = `${one}s`): string { return `${n.toLocaleString()} ${n === 1 ? one : many}`; } +const DAY_MS = 86_400_000; + +/** + * Whether a finding is quiet, in words: "Quiet for 3 days. Resolves on its own + * Nov 5 unless seen again." for an open one with no line for a day or more, + * "Resolved on its own Nov 5 (no new lines for 3 days)." once the analyzer + * resolved it; null otherwise. + */ +function quietWords(f: LogFinding, now = Date.now()): string | null { + if (f.status === "fixed" && f.resolved_at && f.fix?.state !== "merged") { + const why = f.resolved_reason?.replace(/^Resolved:\s*/, ""); + return `Resolved on its own ${formatDate(f.resolved_at)}${why ? ` (${why})` : ""}.`; + } + if ((f.status === "new" || f.status === "acknowledged") && f.resolves_at && f.last_seen) { + const quiet = Math.floor((now - Date.parse(f.last_seen)) / DAY_MS); + if (!(quiet >= 1)) return null; + return `Quiet for ${plural(quiet, "day")}. Resolves on its own ${formatDate(f.resolves_at)} unless seen again.`; + } + return null; +} + function errorText(e: unknown, fallback: string): string { return e instanceof Error && e.message && !/^API \d+/.test(e.message) ? e.message : fallback; } @@ -467,7 +489,7 @@ function FindingRow({ status={look} title={f.title} titleText={f.title} - quiet={f.status === "ignored"} + quiet={f.status === "ignored" || (f.status === "fixed" && !!f.resolved_at)} meta={[ {serviceName(f.log_group)} @@ -478,11 +500,12 @@ function FindingRow({ f.reopened_at ? `seen again ${timeAgo(f.reopened_at)} after it was resolved` : null, f.repo ? {f.repo} : null, ]} - summary={fixWords(f) ?? autoNote ?? undefined} + summary={fixWords(f) ?? autoNote ?? quietWords(f) ?? undefined} summaryTone={f.fix ? (f.fix.state === "merged" ? "success" : f.fix.state === "failed" || f.fix.state === "pr_closed" ? "attention" : "live") : "muted"} chips={ <> - {sev.label} + {/* A resolved finding's severity is history: shown, not alarming. */} + {sev.label} {f.fix?.auto && Auto} {link} @@ -571,6 +594,11 @@ function FindingDetail({ )} + {quietWords(f) && ( + +

{quietWords(f)}

+
+ )} {f.suggested_action && (

{f.suggested_action}

diff --git a/dashboard/src/lib/api.ts b/dashboard/src/lib/api.ts index 021ef2ce..39edc209 100644 --- a/dashboard/src/lib/api.ts +++ b/dashboard/src/lib/api.ts @@ -2722,6 +2722,13 @@ export interface LogFinding { reopened_at?: string | null; /** How many times it came back after it was resolved. */ reopen_count?: number; + /** Days without a matching line before it resolves on its own. */ + quiet_days?: number; + /** Open: when it resolves on its own unless seen again. */ + resolves_at?: string | null; + /** When the analyzer resolved it, and why. */ + resolved_at?: string | null; + resolved_reason?: string | null; } /** Which repo a log group's (or alarm's) code lives in, how sure, and why. */