Title: fix(utils): prevent randomInt power-of-two hangs by BillLeoutsakosvl346 · Pull Request #6955 · simstudioai/sim · GitHub
Open Graph Title: fix(utils): prevent randomInt power-of-two hangs by BillLeoutsakosvl346 · Pull Request #6955 · simstudioai/sim
X Title: fix(utils): prevent randomInt power-of-two hangs by BillLeoutsakosvl346 · Pull Request #6955 · simstudioai/sim
Description: Summary Fixes randomInt hanging whenever the requested range divides 2^32, including power-of-two ranges. The rejection threshold was correct at 2^32 and then wrapped to zero through a 32-bit coercion, so every draw was rejected forever. The fix preserves the full 2^32 sample-space threshold, rejects unsupported ranges larger than one Uint32 draw, and adds four deterministic regression cases. Only the shared helper and its focused test file change. Slack report: https://sim-ai.slack.com/archives/C093DF8MA21/p1787258406733849 Type of Change Bug fix New feature Breaking change Documentation Other Testing bun run test in packages/utils: 164 tests passed bun run type-check in packages/utils scoped Biome check for both changed files bun run check:utils git diff --check Chrome smoke against the locally running app through its configured development tunnel: automatic workflow naming completed immediately, password generation remained responsive and returned the expected 24-character value, and the disposable deployment/workflow was removed afterward. The literal localhost origin could not reuse the authenticated tunnel session because the local .env is configured for the tunnel URL. The deterministic utility test is the authoritative regression proof; the current UI paths do not request a power-of-two range. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced by this patch I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA) Screenshots/Videos Not applicable; there are no UI changes.
Open Graph Description: Summary Fixes randomInt hanging whenever the requested range divides 2^32, including power-of-two ranges. The rejection threshold was correct at 2^32 and then wrapped to zero through a 32-bit coerc...
X Description: Summary Fixes randomInt hanging whenever the requested range divides 2^32, including power-of-two ranges. The rejection threshold was correct at 2^32 and then wrapped to zero through a 32-bit coerc...
Opengraph URL: https://github.com/simstudioai/sim/pull/6955
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:5c04bed6-0ec0-5af9-797b-22b4941ddee1 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A17E:11DC7C:B218B4:F3898E:6AFB50D8 |
| html-safe-nonce | 403244ec5ffa1630245249b3e3da4543dff2e085c3f0c92b9bab1bd5c4d59354 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTdFOjExREM3QzpCMjE4QjQ6RjM4OThFOjZBRkI1MEQ4IiwidmlzaXRvcl9pZCI6IjkwNjc1OTg4ODIzNzcxMTU3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1d3e51589202acfc70506eee96379306468005c25b77d15eeaa1c0f0be42245b |
| hovercard-subject-tag | pull_request:4335968721 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6955/files |
| twitter:image | https://avatars.githubusercontent.com/u/157128530?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/157128530?s=400&v=4 |
| og:image:alt | Summary Fixes randomInt hanging whenever the requested range divides 2^32, including power-of-two ranges. The rejection threshold was correct at 2^32 and then wrapped to zero through a 32-bit coerc... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cbf66c024bb6d10e6955baa7413c54cf13a201bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width