Health: count only flows the engine acts on, format durations with their unit

The "running" tile counted paused and invalid flows as running, so it read
"5/5" beside "1 flow(s) cannot run". Its note is now additive rather than a
precedence chain, so a quarantine no longer hides the invalid count.

Adds dur() beside si(): a ms reading picks its own unit, so a slow run reads
"1.24 s" instead of "1.2k ms".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HTsT1isxUjw5gtkJk8WhuA
This commit is contained in:
2026-08-20 08:24:57 +02:00
co-authored by Claude Opus 5
parent 9a44b89b9f
commit c005ea48e1
6 changed files with 93 additions and 20 deletions
@@ -8,7 +8,7 @@ import { UplotChart } from "@/components/Common/UplotChart"
import { useEngineEvents } from "@/components/Flow/liveStore"
import { PANEL_SECTION } from "@/components/Flow/SidePanel"
import { Button } from "@/components/ui/button"
import { cn, si } from "@/lib/utils"
import { cn, dur } from "@/lib/utils"
import {
ago,
auditQueryOptions,
@@ -319,8 +319,8 @@ export function HealthActivity({ range }: { range: Range }) {
>
{run.status}
</span>
<span className="w-16 shrink-0 text-right text-muted-foreground">
{si(run.duration_ms)} ms
<span className="w-20 shrink-0 whitespace-nowrap text-right text-muted-foreground">
{dur(run.duration_ms)}
</span>
<span className="w-16 shrink-0 text-right text-xs text-muted-foreground">
{ago(run.started_at)}
@@ -6,7 +6,7 @@ import { type Range, RangePicker } from "@/components/Common/RangePicker"
import { Sparkline } from "@/components/Common/Sparkline"
import { PANEL_SECTION } from "@/components/Flow/SidePanel"
import { Badge } from "@/components/ui/badge"
import { si } from "@/lib/utils"
import { dur, si } from "@/lib/utils"
import {
ago,
CARD,
@@ -117,16 +117,18 @@ export function HealthOverview({
<Tile
label="Flows running"
value={`${summary?.flows.running ?? 0}/${summary?.flows.total ?? 0}`}
// Worst first: the engine gave up on a quarantined flow, a flow
// validation blocks never started, and a paused one is deliberate.
// Worst first, but all of them: a quarantine used to hide the
// flows validation blocks, so the tile disagreed with the count
// beside it. Zero and undefined both drop out of the filter.
note={
summary?.flows.quarantined
? `${summary.flows.quarantined} quarantined`
: summary?.flows.invalid
? `${summary.flows.invalid} cannot run`
: summary?.flows.paused
? `${summary.flows.paused} paused`
: "none paused"
[
summary?.flows.quarantined &&
`${summary.flows.quarantined} quarantined`,
summary?.flows.invalid && `${summary.flows.invalid} cannot run`,
summary?.flows.paused && `${summary.flows.paused} paused`,
]
.filter(Boolean)
.join(" · ") || "none paused"
}
/>
<Tile
@@ -149,8 +151,8 @@ export function HealthOverview({
/>
<Tile
label="Loop lag"
value={`${si(summary?.loop_lag.ewma ?? 0)} ms`}
note={`peak ${si(summary?.loop_lag.max_60s ?? 0)} ms in the last minute`}
value={dur(summary?.loop_lag.ewma ?? 0)}
note={`peak ${dur(summary?.loop_lag.max_60s ?? 0)} in the last minute`}
/>
</div>
</section>
@@ -208,10 +210,10 @@ export function HealthOverview({
)}
</td>
<td className="whitespace-nowrap px-3 py-2 text-center">
{si(row.avg_ms)} ms
{dur(row.avg_ms)}
</td>
<td className="whitespace-nowrap px-3 py-2 text-center">
{si(row.avg_lag_ms)} ms
{dur(row.avg_lag_ms)}
</td>
{/* The dot straddles the curve's right edge, so the cell
keeps a little room for the half that hangs out. */}