dice-core 2026-02-27
Massive code quality overhaul with 27 rounds of review fixes, extraction, and deduplication
80 files · 8,729+ · 3,931-

Code quality infrastructure

5 files changed
  • eslint.config.js ESLint configuration with project-specific rules
  • .prettierrc Prettier formatting configuration
  • .prettierignore Prettier ignore patterns
  • pre-commit Pre-commit hook running lint checks
  • HANDOFF.md Handoff document tracking review rounds and remaining work
  • Established code quality tooling with ESLint, Prettier, and Husky pre-commit hooks baseline architectural
    3 files
    • eslint.config.js
    • .prettierrc
    • pre-commit

Logger replacement

1 file changed
  • logger.ts Replaced custom logger with pino browser mode
  • Replaced the custom logging implementation with pino browser mode for standardized structured logging streamline architectural
    1 file
    • logger.ts

Simulation and physics overhaul

6 files changed
  • pre-simulate.ts Major refactoring of pre-simulation with spawn config extraction, cancellation, and math fixes
  • pre-simulate-async.ts New async pre-simulation wrapper with cancellation support
  • pre-simulate-worker.ts Web worker for background pre-simulation
  • spawn-configs.ts Extracted spawn configuration logic into dedicated module
  • playback.ts Fixed playback snap, rotation correction, and settle guards
  • seeded-rng.ts Added instance RNG and dual RNG streams for simulation vs presentation
  • Extracted spawn configuration into a dedicated module, added async simulation with cancellation, and implemented dual RNG streams separating simulation from presentation randomness decouple architectural
    3 files
    • spawn-configs.ts
    • pre-simulate-async.ts
    • seeded-rng.ts
  • Removed legacy pre-simulate-exact implementation that was no longer needed deprecate internal
    1 file
    • pre-simulate-legacy-exact.ts

Component fixes across 23 review rounds

7 files changed
  • DiceArena.tsx Fixed multi-fire guard, ref cleanup, rapierReady guard, SSR guards
  • DiceScene.tsx Fixed stale closures, effect dependencies, abort handling
  • DiceRoller.tsx Fixed prop forwarding and unmount guards
  • Die.tsx Fixed material leaks, prop forwarding, spawn ceiling
  • PlaybackDie.tsx Fixed overlay double-rotation, stale texture refs, settle guards, ref truncation
  • ErrorBoundary.tsx Improved error boundary with better recovery
  • die-visuals.ts Extracted standalone die visuals module with material identity optimization
  • Fixed dozens of component-level bugs including stale closures, material leaks, texture churn, spawn ceiling issues, SSR guards, and overlay rotation errors across 23 review rounds harden behavioral
    4 files
    • DiceArena.tsx
    • DiceScene.tsx
    • PlaybackDie.tsx
    • Die.tsx

Dice engine fixes

6 files changed
  • face-reader.ts Fixed face reading with improved normal alignment and D4 special handling
  • geometry-data.ts Geometry data fixes and deduplication
  • notation-parser.ts Parser fixes for edge cases and notation regex improvements
  • textures.ts Fixed texture lookup and rendering issues
  • defaults.ts Centralized physics constants and shared default values
  • dice-configs.ts Refined per-die-type configurations
  • Fixed face reader alignment for D4/D10/D100, improved notation parser regex for edge cases, resolved texture lookup issues, and centralized physics constants remediate behavioral
    3 files
    • face-reader.ts
    • notation-parser.ts
    • textures.ts

Physics layer replacement

1 file changed
  • rapier-init.ts New shared Rapier initialization with retry logic
  • Replaced the custom physics world and die-bodies modules with shared Rapier initialization, removing 800+ lines of custom physics code decouple architectural
    1 file
    • rapier-init.ts

Test coverage expansion

6 files changed
  • pre-simulate-async.test.ts Async pre-simulation tests including cancellation
  • spawn-configs.test.ts Spawn configuration tests
  • face-reader.test.ts Expanded face reader tests with D4/D10/D100 coverage
  • notation-parser.test.ts New notation parser test suite
  • textures.test.ts Texture generation tests
  • logger.test.ts Logger utility tests
  • Significantly expanded test coverage with new suites for async simulation, spawn configs, face reader, notation parser, textures, and logger utilities qualify behavioral
    2 files
    • pre-simulate-async.test.ts
    • notation-parser.test.ts

Type system cleanup

4 files changed
  • dice.ts Expanded dice type definitions
  • index.ts Consolidated type exports
  • config.ts Refined configuration types
  • index.ts Cleaned up public API exports
  • Cleaned up the type system by removing globals.d.ts, consolidating exports, and expanding dice type definitions streamline internal
    3 files
    • dice.ts
    • index.ts
    • index.ts