From 4d41d36232637af1e24bae6272e647342c022901 Mon Sep 17 00:00:00 2001 From: Rodrigo Alves da Silva Matos Date: Thu, 13 Aug 2026 18:32:29 -0300 Subject: [PATCH] fix(platform): hide zero-sample origins from repo stabilization-by-origin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The engine defaults stabilization_ratio to 1.0 when files_touched is 0 (iris/metrics/stabilization.py: "nothing to destabilize" sentinel for a 0/0 division). The report writer already guards against this — it skips any origin with a zero commit count (iris/reports/writer.py) — but the platform's repo detail chart rendered every origin unconditionally, so an origin with zero real commits in the window showed a misleading "100%" right next to another origin's real percentage (e.g. Bot 100% / Humano 100% / Assistido por IA 23%, when only AI-assisted had any commits at all). Filter to origins with files_touched > 0 before rendering, matching the writer's own convention, and hide the whole "Estabilização por origem" block when nothing survives the filter. Co-Authored-By: Claude Sonnet 5 --- .../app/[tenant]/repos/[repoName]/charts.tsx | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/platform/src/app/[tenant]/repos/[repoName]/charts.tsx b/platform/src/app/[tenant]/repos/[repoName]/charts.tsx index 03f4600..bf24b46 100644 --- a/platform/src/app/[tenant]/repos/[repoName]/charts.tsx +++ b/platform/src/app/[tenant]/repos/[repoName]/charts.tsx @@ -881,14 +881,26 @@ export function RepoCharts({ BOT: "bg-signal-gray", }} /> - {insights.stabilizationByOrigin && ( -
-

- {t("repoCharts.origin.stabByOrigin")} -

-
- {Object.entries(insights.stabilizationByOrigin).map( - ([origin, data]) => ( + {(() => { + // The engine defaults stabilization_ratio to 1.0 when + // files_touched is 0 (nothing to destabilize — see + // iris/metrics/stabilization.py), the same 0/0 sentinel the + // report writer already guards against (writer.py skips any + // origin with a zero commit count). Showing that default + // here reads as "Bot 100%" / "Humano 100%" for origins that + // made zero commits in the window, right next to a real 23% + // for the origin that actually has data. + const stabEntries = Object.entries( + insights.stabilizationByOrigin ?? {}, + ).filter(([, data]) => data.files_touched > 0); + if (stabEntries.length === 0) return null; + return ( +
+

+ {t("repoCharts.origin.stabByOrigin")} +

+
+ {stabEntries.map(([origin, data]) => (
- ), - )} + ))} +
-
- )} + ); + })()} )}