PR_26177_DELTA_055-random-seed-enhancements#207
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d7843e0af
ℹ️ 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".
| const stateValue = Number(state?.state); | ||
|
|
||
| if (!Number.isInteger(stateValue) || stateValue < 0 || stateValue > 0xffffffff) { | ||
| throw new RangeError("state.state must be an unsigned 32-bit integer."); |
There was a problem hiding this comment.
Reject coerced saved-state values
When restoreState receives malformed checkpoint data such as { state: null }, { state: false }, { state: "" }, or { state: "5" }, Number(...) coerces those values into valid integers and the generator silently jumps to state 0 or 5 instead of rejecting data that saveState() never produces. Since this API is meant to preserve deterministic replay/checkpoints, require an actual numeric unsigned 32-bit state before assigning _state.
Useful? React with 👍 / 👎.
PR_26177_DELTA_055-random-seed-enhancements
Date: 2026-06-26
Team: Delta
Scope: RandomSeed procedural enhancements and targeted unit tests
Status: PASS
Summary
RandomSeedto use shared helper logic fornextInt,nextFloat, andpick.shuffle,chance, andweightedPick.saveState()andrestoreState(state)for deterministic sequence checkpointing.RandomSeed.next()algorithm.RandomSeed(42)sequence.Branch Validation
PASS. Branch
PR_26177_DELTA_055-random-seed-enhancementswas created fromPR_26177_DELTA_054-random-utility.Changed Files
docs_build/dev/PLAN_PR.mddocs_build/dev/BUILD_PR.mddocs_build/dev/ProjectInstructions/team_assignments/TEAM_ASSIGNMENTS.mddocs_build/dev/ProjectInstructions/team_assignments/ACTIVE_TEAM_REGISTRY.mdsrc/shared/math/RandomSeed.jstests/shared/RandomSeed.test.mjsdocs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements.mddocs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_branch-validation.mddocs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_requirement-checklist.mddocs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_validation-lane.mddocs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_manual-validation-notes.mddocs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_instruction-compliance-checklist.mddocs_build/dev/reports/codex_changed_files.txtdocs_build/dev/reports/codex_review.diffValidation
node ./scripts/run-node-test-files.mjs tests/shared/RandomSeed.test.mjs tests/shared/RandomHelpers.test.mjsnode --check src/shared/math/RandomSeed.jsnode --check tests/shared/RandomSeed.test.mjsgit diff --checkArtifact
tmp/PR_26177_DELTA_055-random-seed-enhancements_delta.zip