Skip to content

Apply minimum-sample floor to weekly AI-adoption % (fixes #189) - #201

Merged
clickmatos merged 1 commit into
mainfrom
org-timeline-ai-pct-min-sample
Aug 27, 2026
Merged

Apply minimum-sample floor to weekly AI-adoption % (fixes #189)#201
clickmatos merged 1 commit into
mainfrom
org-timeline-ai-pct-min-sample

Conversation

@clickmatos

Copy link
Copy Markdown
Contributor

Summary

Closes #189. Reported as "the lines look messy/zigzag" on the org timeline chart after #190 (connectNulls fix) and #200 (full-history fix) made the chart's real underlying data fully visible for the first time.

Root cause: origin_distribution (which drives weekly AI-adoption %) had no minimum commit count, unlike stabilization_ratio (gated behind MIN_COMMITS_FOR_RATIO = 3). A single AI-tagged commit in an otherwise quiet week could swing that week's AI-adoption all the way to 100%, and a single human commit could swing it to 0% — statistically meaningless spikes that showed up as real-looking zigzag on the chart.

Fix

iris/analysis/activity_timeline.py: origin_distribution is now gated behind the same MIN_COMMITS_FOR_RATIO floor stabilization_ratio already uses. Weeks below it get an empty {} instead of a distribution computed from 1-2 data points.

No platform-side change needed — this composes cleanly with two fixes already merged:

intent_distribution (feature/fix %) has the identical statistical shape but is out of scope here — noted in #189 as a secondary item, not the reported complaint.

Test plan

  • New tests/test_activity_timeline.py: a below-floor week (1 commit) gets origin_distribution == {}; an at-floor week (3 commits) gets a correctly populated distribution
  • pytest tests/ -q — 468 passed (466 existing + 2 new)

🤖 Generated with Claude Code

…#189)

origin_distribution (which drives weekly AI-adoption %) had no minimum
commit count, unlike stabilization_ratio — a single AI-tagged commit
in an otherwise quiet week could swing that week to 100% AI adoption.
This leaked into the org timeline chart as visible zigzag noise,
reported while reviewing #183/#190's connectNulls fix.

Now gated behind the same MIN_COMMITS_FOR_RATIO=3 floor stabilization
already uses: weeks below it get an empty origin_distribution instead
of a distribution computed from too few data points. Downstream,
computeOrgTimeline (platform) already treats a week with no origin
data as aiWeight=0 -> aiPct=null, and the connectNulls fix already
renders null as a gap instead of a fake trend — so this composes with
both existing fixes without any platform-side change needed.

intent_distribution (feature/fix %) has the same statistical shape but
is out of scope here — flagged in #189 as a secondary "worth
evaluating" item, not this specific complaint.

Co-Authored-By: claude-code_2-1-238_agent <claude-code_2-1-238_agent@iris.invalid>
@vercel

vercel Bot commented Aug 26, 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 26, 2026 9:42pm

Request Review

@clickmatos
clickmatos merged commit 07255e7 into main Aug 27, 2026
6 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.

[METRIC] aiPct semanal na org-timeline sem tamanho mínimo de amostra (salto artificial 0%→100%)

1 participant