From 08044c81e714823fb3164d893c7503cdcfc7ac93 Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Fri, 4 Sep 2026 12:56:25 +0300 Subject: [PATCH] fix(webui): don't show PSU load % until the observed peak clears idle draw The passive collector records PSU draw at idle too, so right after boot the "observed peak" is just idle wattage and a load % off it is meaningless. Require the observed peak to sit >=25% above current draw before using it as a load scale; until a real full-load run bumps it, show plain watts. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_019VHG21rgTUiR1G3qFHTVmN --- audit/internal/webui/page_topo_diagram.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/audit/internal/webui/page_topo_diagram.go b/audit/internal/webui/page_topo_diagram.go index 3cd956b..8d7b6fb 100644 --- a/audit/internal/webui/page_topo_diagram.go +++ b/audit/internal/webui/page_topo_diagram.go @@ -643,11 +643,14 @@ func renderTopoPSURow(psus []schema.HardwarePowerSupply, observedMaxW map[string if p.WattageW != nil && *p.WattageW > 0 { rating = *p.WattageW } - // Load scale: true rating if known, else the observed peak draw. + // Load scale: true rating if known, else the observed peak draw — but + // only once that peak sits meaningfully above the current draw. Until + // a real full-load run has bumped it, the "peak" is just idle draw and + // a load % off it would be nonsense, so fall back to plain watts. scaleMax := float64(rating) scaleEstimate := false if scaleMax <= 0 { - if m := observedMaxW[strconv.Itoa(i)]; m > 0 { + if m := observedMaxW[strconv.Itoa(i)]; m > 0 && (!haveDraw || m >= draw*1.25) { scaleMax = m scaleEstimate = true }