Skip to content

fix(platform): hide zero-sample origins from repo stabilization-by-origin - #163

Merged
clickmatos merged 1 commit into
mainfrom
fix/repo-stab-by-origin-zero-sample
Aug 13, 2026
Merged

fix(platform): hide zero-sample origins from repo stabilization-by-origin#163
clickmatos merged 1 commit into
mainfrom
fix/repo-stab-by-origin-zero-sample

Conversation

@clickmatos

Copy link
Copy Markdown
Contributor

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_ratio to 1.0 when
files_touched is 0 (iris/metrics/stabilization.py — a "nothing to
destabilize" 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's
repo chart rendered every key in stabilization_by_origin without that
guard. 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 stabilizationByOrigin entries to files_touched > 0 before
rendering, 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 — clean
  • npm run lint — clean
  • npm run test — 267/267 passing
  • Manual check: open a repo where only one origin has commits in the
    window 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

…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>
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clickbus-iris Ready Ready Preview Aug 13, 2026 9:33pm

Request Review

@clickmatos
clickmatos merged commit ecb58fe into main Aug 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant