fix(platform): hide zero-sample origins from repo stabilization-by-origin - #163
Merged
Merged
Conversation
…igin 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 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a repo's detail page, the "Distribuição de origem" card's "Estabilização
por origem" list showed percentages for every origin (HUMAN, AI_ASSISTED,
BOT) unconditionally — even origins with zero commits in the window.
Root cause: the engine defaults
stabilization_ratioto1.0whenfiles_touchedis0(iris/metrics/stabilization.py— a "nothing todestabilize" sentinel for what would otherwise be a 0/0 division). The
report writer already knows to guard against this and skips any origin
with a zero commit count (
iris/reports/writer.py), but the platform'srepo chart rendered every key in
stabilization_by_originwithout thatguard. Result: an origin distribution showing 100% AI-assisted commits
would still render "Bot 100%" and "Humano 100%" right next to the real
"Assistido por IA 23%" — the 100%s are a division-by-zero default, not
signal.
Fix
Filter
stabilizationByOriginentries tofiles_touched > 0beforerendering, matching the report writer's existing convention, and hide
the whole "Estabilização por origem" block if nothing survives the
filter.
Test plan
npx tsc --noEmit— cleannpm run lint— cleannpm run test— 267/267 passingwindow and confirm the stabilization-by-origin list only shows that
origin (this sandbox has no Supabase/NextAuth credentials configured,
so I couldn't drive this through an authenticated browser session)
🤖 Generated with Claude Code