Skip to content

fix: update BattleGrid rand migration#34

Merged
saagpatel merged 1 commit into
mainfrom
codex/fix/battlegrid-rand-09
May 18, 2026
Merged

fix: update BattleGrid rand migration#34
saagpatel merged 1 commit into
mainfrom
codex/fix/battlegrid-rand-09

Conversation

@saagpatel
Copy link
Copy Markdown
Owner

What

  • Updates the workspace rand dependency from 0.8.5 to 0.9.2.
  • Replaces deprecated rand 0.8 APIs with rand 0.9 names across map generation, simulation tests, room codes, and map seed generation.
  • Refreshes Cargo.lock to remove the old rand 0.8 line.

Why

  • Clears the stale/conflicted Dependabot rand migration path with a current-main branch.
  • Keeps the Rust dependency queue moving after the cargo minor-and-patch and tokio-tungstenite updates landed.

How

  • Uses random, random_range, and rng in place of the deprecated gen, gen_range, and thread_rng APIs.
  • Lockfile rationale: Cargo.lock changed only because the workspace rand pin moved to 0.9.2 and the old rand 0.8 transitive entries were removed.

Testing

  • CARGO_TARGET_DIR=/tmp/battlegrid-rand-target ./scripts/cargo-safe.sh fmt --check
  • CARGO_TARGET_DIR=/tmp/battlegrid-rand-target ./scripts/cargo-safe.sh clippy --workspace -- -D warnings
  • CARGO_TARGET_DIR=/tmp/battlegrid-rand-target ./scripts/cargo-safe.sh test --workspace
  • ./scripts/client-safe.sh tsc -b
  • ./scripts/client-safe.sh eslint .
  • ./scripts/client-safe.sh vitest run
  • ./scripts/client-safe.sh vite build
  • ./scripts/client-safe.sh playwright test --config=playwright.config.ts did not run locally because this Homebrew Rust install is missing the wasm32-unknown-unknown target required by the Playwright web server build.

Performance Impact

  • None expected; this is an API-compatible RNG dependency update with the same call sites.

Risk / Notes

@saagpatel saagpatel force-pushed the codex/fix/battlegrid-rand-09 branch from 28f3ade to 527e98d Compare May 18, 2026 05:24
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28f3adea01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Cargo.toml
thiserror = "=2.0.18"
anyhow = "=1.0.102"
rand = "=0.8.5"
rand = "=0.9.2"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enable wasm RNG support for rand 0.9

When building the browser/WASM package, this version bump makes battleground-core pull rand_core 0.9 and getrandom 0.3, but crates/battleground-wasm only enables the old getrandom 0.2 js feature. The Docker build runs wasm-pack build crates/battleground-wasm --target web, and getrandom 0.3 does not support wasm32-unknown-unknown by default without its wasm_js backend/feature, so the WASM/client build regresses even though native Rust checks can still pass.

Useful? React with 👍 / 👎.

@saagpatel saagpatel force-pushed the codex/fix/battlegrid-rand-09 branch from 527e98d to 7653fa9 Compare May 18, 2026 05:31
- Move workspace rand to 0.9.2 and update renamed API calls.
- Enable getrandom 0.3 support for the WebAssembly build.
- Add seeded map-generation coverage and dependency notes.

Tests: ./scripts/cargo-safe.sh fmt --check
Tests: ./scripts/cargo-safe.sh clippy --workspace -- -D warnings
Tests: ./scripts/cargo-safe.sh test --workspace
Tests: wasm-pack build crates/battleground-wasm --target web
Tests: node scripts/ci/require-tests-and-docs.mjs
@saagpatel saagpatel force-pushed the codex/fix/battlegrid-rand-09 branch from 786c284 to 7c936ae Compare May 18, 2026 05:34
@saagpatel saagpatel merged commit 076b4e5 into main May 18, 2026
27 checks passed
@saagpatel saagpatel deleted the codex/fix/battlegrid-rand-09 branch May 18, 2026 05:42
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.

1 participant