Skip to content

fix: bump rand to 0.9.3 for default builds - #586

Merged
BusyJay merged 1 commit into
tikv:masterfrom
tillrohrmann:bump-rand-dependency
Apr 14, 2026
Merged

fix: bump rand to 0.9.3 for default builds#586
BusyJay merged 1 commit into
tikv:masterfrom
tillrohrmann:bump-rand-dependency

Conversation

@tillrohrmann

@tillrohrmann tillrohrmann commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores
    • Upgraded the project's random-number generation dependency to v0.9.3.
    • Internal selection method for randomized timeouts was adjusted to use the updated RNG, preserving existing ranges and behavior.
    • No user-visible functionality, behavior, or public API changes.

Closes #585

@ti-chi-bot

ti-chi-bot Bot commented Apr 13, 2026

Copy link
Copy Markdown

Welcome @tillrohrmann! It looks like this is your first PR to tikv/raft-rs 🎉

@coderabbitai

coderabbitai Bot commented Apr 13, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7404281-a418-463f-a13e-2e61e2a47e10

📥 Commits

Reviewing files that changed from the base of the PR and between 3e0ef6a and 9351f69.

📒 Files selected for processing (3)
  • Cargo.toml
  • harness/Cargo.toml
  • src/raft.rs
✅ Files skipped from review due to trivial changes (2)
  • harness/Cargo.toml
  • Cargo.toml

📝 Walkthrough

Walkthrough

The rand crate was upgraded from 0.8 to 0.9.3 in Cargo.toml and harness/Cargo.toml. src/raft.rs was updated to call rand::rng().random_range(self.min_election_timeout..self.max_election_timeout) instead of rand::thread_rng().gen_range(...).

Changes

Cohort / File(s) Summary
Dependency files
Cargo.toml, harness/Cargo.toml
Bumped rand dependency version from 0.8 to 0.9.3. No other dependency or feature changes.
RNG API usage
src/raft.rs
Replaced rand::thread_rng().gen_range(min..max) with rand::rng().random_range(min..max) in reset_randomized_election_timeout to match updated rand API.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through versions, light and spry,
Swapped a crate, gave RNG a try,
Timeouts now tumble in a fresher way,
Elections jitter with a brighter day,
🎲🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: bumping the rand dependency to version 0.9.3 for default builds, which is exactly what the PR implements.
Linked Issues check ✅ Passed The PR successfully addresses issue #585 by updating rand from 0.8.5 to 0.9.3 in both Cargo.toml files and updating the related API call in src/raft.rs to use the new rand API.
Out of Scope Changes check ✅ Passed All changes are directly related to bumping the rand dependency as required by issue #585; no unrelated modifications are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xtqqczze

Copy link
Copy Markdown

Please add "Closes #585" to the PR description.

@tillrohrmann
tillrohrmann force-pushed the bump-rand-dependency branch from b81b091 to 3e0ef6a Compare April 14, 2026 07:13
@tillrohrmann

Copy link
Copy Markdown
Contributor Author

Please add "Closes #585" to the PR description.

@xtqqczze done.

@xtqqczze

Copy link
Copy Markdown

Please add "Closes #585" to the PR description.

I meant add to this pull request, not to the commit itself. You'll also need to signoff your commit.

This closes tikv#585.

Signed-off-by: Till Rohrmann <till@restate.dev>
@tillrohrmann

Copy link
Copy Markdown
Contributor Author

@xtqqczze thanks for the clarification. Now it should hopefully all be correct :-)

@xtqqczze

Copy link
Copy Markdown

@BusyJay Please could you review

@BusyJay BusyJay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@BusyJay
BusyJay merged commit 53cf7a5 into tikv:master Apr 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rand v0.8.5 is affected by CVE RUSTSEC-2026-0097

3 participants