Skip to content

fix: upgrade pace-adjustment formula to stay green when clearly under pace#372

Merged
rygel merged 1 commit intodevelopfrom
fix/pace-cubic-formula
Mar 20, 2026
Merged

fix: upgrade pace-adjustment formula to stay green when clearly under pace#372
rygel merged 1 commit intodevelopfrom
fix/pace-cubic-formula

Conversation

@rygel
Copy link
Copy Markdown
Owner

@rygel rygel commented Mar 20, 2026

Summary

  • The quadratic formula (usedPercent²/expectedPercent) gave ~60.2% for Sonnet at 73% used / 88.5% elapsed — one tenth of a percent above the 60% yellow threshold despite being clearly under pace
  • Replaced with cubic formula (usedPercent³/expectedPercent²): same scenario now gives ~49.7% → green
  • Added a regression test pinned to the exact real-world values (73% used, 2026-03-21T09:00:01Z reset, evaluated at 2026-03-20T13:41Z)

Before / After for the Sonnet real-world case:

Formula Result Color
73² / 88.5 (old) 60.2% 🟡 Yellow
73³ / 88.5² (new) 49.7% 🟢 Green

Over-pace behavior is unchanged — raw usedPercent is still returned when usage exceeds expected pace.

Test plan

  • CalculatePaceAdjustedColorPercent_BorderlineUnderPace_StaysGreen passes
  • Existing pace-adjustment tests still pass (assertions are < 60, not exact values)
  • Sonnet and All Models bars show green when clearly under pace

🤖 Generated with Claude Code

The quadratic formula (usedPercent²/expectedPercent) gave ~60.2% for
Sonnet at 73% used with 88.5% of the 7-day window elapsed — one tenth
of a percent above the 60% yellow threshold despite being clearly under
pace. Replaced with the cubic formula (usedPercent³/expectedPercent²)
which gives ~49.7% in the same scenario, keeping the bar green.

Added a regression test pinned to the exact real-world values that
triggered the issue.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Build Performance Report

⏱️ Build Time: 12 minutes

📊 Comparison with main branch:

  • Baseline (avg): 10 minutes
  • Current: 12 minutes
  • Change: 📈 20%

✅ Within acceptable range


This is an automated performance check

@rygel rygel merged commit df7246c into develop Mar 20, 2026
18 checks passed
@rygel rygel deleted the fix/pace-cubic-formula branch March 20, 2026 13:55
@rygel rygel mentioned this pull request Mar 20, 2026
2 tasks
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.

2 participants