chore: update rand to 0.10.0 and add version-bump agent instructions#1269
chore: update rand to 0.10.0 and add version-bump agent instructions#1269
Conversation
Co-authored-by: jsuereth <29006+jsuereth@users.noreply.github.com>
Co-authored-by: jsuereth <29006+jsuereth@users.noreply.github.com>
Co-authored-by: jsuereth <29006+jsuereth@users.noreply.github.com>
|
@copilot can you change this PR to be against the |
I'm not able to change the base branch of an existing PR or create a new one with the tools available to me. The only meaningful change in this branch beyond the renovate branch is the The quickest fix is to manually change this PR's base branch in the GitHub UI from If you'd prefer a brand-new PR, you can create a branch off |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1269 +/- ##
=======================================
- Coverage 80.8% 80.8% -0.1%
=======================================
Files 111 111
Lines 9308 9308
=======================================
- Hits 7523 7521 -2
- Misses 1785 1787 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adopts
rand 0.10.0from the Renovate branch and adds agent instructions for handling future breaking dependency bumps. The existing rand usage (rand::rng()andSliceRandom::shuffle) is already compatible with 0.10.0 — no source changes were required.Changes
Cargo.lock— Updated to reflectrand 0.10.0and transitively updated dependencies (rand_core 0.10.0,chacha20 0.10.0, etc.).github/agents/version-bump-help.agent.md— New agent instructions file documenting the workflow for fixing dependency version bump PRs, including:maindirectly — not the Renovate/Dependabot branch — to avoid interfering with automated toolingOriginal prompt
Problem
PR #1195 updates the
randcrate from0.9.2to0.10.0in the workspaceCargo.toml, but the build fails becauserand0.10.0 has several breaking API changes.Fixes #1195
Breaking Changes in rand 0.10.0
Based on the rand 0.10.0 changelog:
Rngtrait renamed toRngExt— TheRngextension trait has been renamed toRngExtbecause upstreamrand_corerenamedRngCore→Rng. Anyuse rand::Rng;import needs to becomeuse rand::RngExt;, and any trait boundsR: Rngneed updating.choose_multiple→sample—IndexedRandom::choose_multiplewas renamed tosample, andSliceChooseIterrenamed toIndexedSamples.OsRng→SysRng,OsError→SysError,os_rng→sys_rng— system RNG was renamed.SeedableRng::from_os_rng,try_from_os_rngCloneforStdRngReseedingRngsmall_rngrand::rng()function — This still exists and returns a thread-local RNG. It was introduced in 0.9.What the Code Currently Uses
The only file that directly uses
randiscrates/weaver_resolver/src/registry.rsin the#[cfg(test)] mod testsblock:And later:
The
SliceRandomtrait providesshuffle, which still exists in 0.10.0. Therand::rng()function still exists. However, the underlying trait changes may cause compilation issues.What Needs to Be Done
renovate/rand-0.xbranch (which already has theCargo.tomlchange torand = "0.10.0").cargo buildandcargo testto see the actual compilation errors.crates/weaver_resolver/src/registry.rsare:Rngtrait not found, changeuse rand::Rngtouse rand::RngExtshufflemethod onSliceRandomrequires the RNG argument to implementrand_core::Rng(which wasRngCorein 0.9). In 0.10, the return type ofrand::rng()should implement the newrand_core::Rngtrait, soshuffle(&mut rng)should work.SliceRandomnot being in scope, check if it moved or was renamed.cargo test -p weaver_resolverto ensure tests pass.cargo build --workspaceto make sure the whole workspace compiles.cargo clippy --workspaceto ensure no clippy warnings.Also: Create Agent Instructions File
Create a file
.github/agents/version-bump-help.agent.mdwith instructions for future dependency bump tasks. The file should describe the general workflow for handling dependency update PRs: