Skip to content

PR_26177_DELTA_055-random-seed-enhancements#207

Merged
ToolboxAid merged 1 commit into
mainfrom
PR_26177_DELTA_055-random-seed-enhancements
Jun 26, 2026
Merged

PR_26177_DELTA_055-random-seed-enhancements#207
ToolboxAid merged 1 commit into
mainfrom
PR_26177_DELTA_055-random-seed-enhancements

Conversation

@ToolboxAid

Copy link
Copy Markdown
Owner

PR_26177_DELTA_055-random-seed-enhancements

Date: 2026-06-26
Team: Delta
Scope: RandomSeed procedural enhancements and targeted unit tests
Status: PASS

Summary

  • Updated RandomSeed to use shared helper logic for nextInt, nextFloat, and pick.
  • Added seeded procedural methods: shuffle, chance, and weightedPick.
  • Added saveState() and restoreState(state) for deterministic sequence checkpointing.
  • Preserved the existing RandomSeed.next() algorithm.
  • Added a hardcoded compatibility check for the existing RandomSeed(42) sequence.
  • Verified same-seed and reseeding reproducibility still pass.
  • Added targeted tests for the new methods and state restore behavior.
  • No existing game logic adoption changes or UI changes were made.

Branch Validation

PASS. Branch PR_26177_DELTA_055-random-seed-enhancements was created from PR_26177_DELTA_054-random-utility.

Changed Files

  • docs_build/dev/PLAN_PR.md
  • docs_build/dev/BUILD_PR.md
  • docs_build/dev/ProjectInstructions/team_assignments/TEAM_ASSIGNMENTS.md
  • docs_build/dev/ProjectInstructions/team_assignments/ACTIVE_TEAM_REGISTRY.md
  • src/shared/math/RandomSeed.js
  • tests/shared/RandomSeed.test.mjs
  • docs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements.md
  • docs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_branch-validation.md
  • docs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_requirement-checklist.md
  • docs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_validation-lane.md
  • docs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_manual-validation-notes.md
  • docs_build/dev/reports/PR_26177_DELTA_055-random-seed-enhancements_instruction-compliance-checklist.md
  • docs_build/dev/reports/codex_changed_files.txt
  • docs_build/dev/reports/codex_review.diff

Validation

  • PASS: node ./scripts/run-node-test-files.mjs tests/shared/RandomSeed.test.mjs tests/shared/RandomHelpers.test.mjs
  • PASS: node --check src/shared/math/RandomSeed.js
  • PASS: node --check tests/shared/RandomSeed.test.mjs
  • PASS: git diff --check
  • SKIP: Playwright was not run because this PR does not change UI or browser runtime flows.

Artifact

  • tmp/PR_26177_DELTA_055-random-seed-enhancements_delta.zip

@ToolboxAid ToolboxAid marked this pull request as ready for review June 26, 2026 03:43
@ToolboxAid ToolboxAid changed the base branch from PR_26177_DELTA_054-random-utility to main June 26, 2026 03:44
@ToolboxAid ToolboxAid merged commit 988b835 into main Jun 26, 2026
1 check passed

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

Copy link
Copy Markdown

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: 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".

Comment on lines +146 to +149
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.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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.

2 participants