Skip to content

Fix deterministic reset on all reset paths and broken density FAB actions#1

Open
Sidem wants to merge 1 commit into
mainfrom
claude/distracted-tu-f5e04c
Open

Fix deterministic reset on all reset paths and broken density FAB actions#1
Sidem wants to merge 1 commit into
mainfrom
claude/distracted-tu-f5e04c

Conversation

@Sidem
Copy link
Copy Markdown
Owner

@Sidem Sidem commented May 19, 2026

Summary

  • Deterministic reset bug (reported): Clone & Mutate, plain Clone, and several other ruleset operations reseeded each world with Date.now() + idx, ignoring the deterministic flag - so the reset that follows those ops was never deterministic, even though plain world resets were. Added a _getResetSeed(baseSeed, worldIndex) helper on WorldManager (shared base seed in deterministic mode, baseSeed + idx otherwise) and routed all six reset paths through it.
  • Dead event constants: The "Default Densities" and "Apply Density" actions (mobile FABs + WorldsController) dispatched COMMAND_RESET_DENSITIES_TO_DEFAULT / COMMAND_APPLY_SELECTED_DENSITY_TO_ALL, which are not defined in EventBus.js - so the dispatches resolved to undefined and silently no-op'd. Repointed to the real constants COMMAND_RESET_INITIAL_STATES_TO_DEFAULT / COMMAND_APPLY_SELECTED_INITIAL_STATE_TO_ALL.
  • Console spam: Disabled EVENT_BUS_LOGGING in committed config.js so production builds don't log every UI event.

Why

The deterministic toggle is meant to make resets reproducible across worlds; clone/mutate skipped it entirely. The density actions were fully dead due to a constant-name mismatch - the kind of bug an untyped event bus hides.

Reviewer notes

  • LOAD_STATE and clear paths were intentionally left alone - they don't reseed from RNG, so determinism does not apply.
  • All six reset paths now go through _getResetSeed; verified via grep.

Test plan

  • npm run lint - 0 errors
  • npm run build - succeeds
  • Deterministic mode on: Clone & Mutate yields identical grids across worlds with the same density config
  • Mobile "Default Densities" / "Apply Density" FAB buttons now work

Clone & mutate (and other ruleset ops) reseeded each world with
Date.now()+idx, ignoring the deterministic flag, so the post-op reset
was never deterministic. Added a _getResetSeed helper and routed all
six reset paths through it.

Also fixed two FAB density actions that dispatched undefined event
constants (no-op), and disabled EVENT_BUS_LOGGING in committed config.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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