Skip to content

fix: correct linear rollout interpolation from non-zero percentages - #314

Merged
jonathannorris merged 2 commits into
mainfrom
fix/rollout-linear-interpolation
Oct 7, 2026
Merged

jonathannorris merged 2 commits into
mainfrom
fix/rollout-linear-interpolation

Conversation

@jonathannorris

@jonathannorris jonathannorris commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Fixes getCurrentRolloutPercentage to compute c + (n - c) * t for linear stages; a misplaced parenthesis meant it computed n * t, which drops the rollout below the current stage percentage whenever it's non-zero
  • Removes the zero-progress guard, which returned 0 instead of the current stage percentage in the first millisecond of a linear stage
  • Matches the pure JS @devcycle/bucketing implementation
  • Adds tests for a non-zero start gradual rollout, a gradual rollback, and a linear stage following a discrete stage

Related Issues

Fixes #312
Relates to: DevCycleHQ/test-harness#615

@jonathannorris
jonathannorris marked this pull request as ready for review October 6, 2026 19:14
@jonathannorris
jonathannorris requested a review from a team as a code owner October 6, 2026 19:14
Copilot AI balanced review requested due to automatic review settings October 6, 2026 19:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The zero-progress guard still briefly returns 0 after a non-zero stage.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Corrects linear rollout interpolation for non-zero percentages in local bucketing.

Changes:

  • Applies the correct interpolation formula.
  • Adds regression coverage for gradual rollout, rollback, and staged transitions.
File Description
bucketing/​bucketing.go Fixes rollout percentage calculation.
bucketing/​bucketing_test.go Adds interpolation regression tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread bucketing/bucketing.go Resolved
@jonathannorris
jonathannorris merged commit 21e3d1c into main Oct 7, 2026
14 checks passed
@jonathannorris
jonathannorris deleted the fix/rollout-linear-interpolation branch October 7, 2026 20:46
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.

Incorrect linear interpolation in getCurrentRolloutPercentage drops the rollout below the current stage

3 participants