Skip to content

Reject non-finite randomized interval ranges - #161

Open
OskarEichler wants to merge 5 commits into
kamui:mainfrom
OskarEichler:codex/validate-randomized-range
Open

Reject non-finite randomized interval ranges#161
OskarEichler wants to merge 5 commits into
kamui:mainfrom
OskarEichler:codex/validate-randomized-range

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Reject configuration whose individually finite max_interval and rand_factor multiply to a non-finite randomized upper bound. Otherwise rand receives an infinite range only when retry execution reaches backoff generation.

Validation is shared by Config and ExponentialBackoff and leaves ordinary finite ranges unchanged.

Verification: current suite 210 examples, dual-Ruby completion model 426 checks, six-file syntax, RBS and full lint pass. Two of 104 focused randomized-range cases fail before; all pass after.

@kamui
kamui self-requested a review August 30, 2026 21:13
@kamui kamui self-assigned this Sep 1, 2026

@kamui kamui left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks!

  1. Please add a regression spec here too!
  2. I think floating point rounding could make these not equivalent. With max_interval = Float("0x1.0d79435e50d79p+1023") and rand_factor = 0.9, validation returns finite, but runtime max_interval + rand_factor * max_interval produces Infinity; rand then raises Errno::EDOM.
  3. A finite runtime range can be rejected. The spec says the change “leaves ordinary finite ranges unchanged.” With max_interval = Float("0x1.89d89d89d89d8p+1023") and rand_factor = 0.3, validation produces Infinity, while the runtime expression produces finite.

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