|
| 1 | +# BUILD_PR_LEVEL_18_1_ENGINE_USAGE_ENFORCEMENT_COMPLETION Report |
| 2 | + |
| 3 | +Date: 2026-04-17 |
| 4 | +Scope: `games/` engine-usage enforcement completion (scan -> migrate duplicated local logic -> re-validate). |
| 5 | + |
| 6 | +## Scan Method |
| 7 | +1. Scanned `games/` for local helper/function duplication and non-engine reimplementation patterns. |
| 8 | +2. Compared duplicates against stable reusable surfaces in `src/shared`/`src/engine`. |
| 9 | +3. Migrated only clearly duplicated local logic to shared utilities. |
| 10 | + |
| 11 | +## Violations Detected (Pre-Migration) |
| 12 | +Two concrete duplicate clusters in `games/`: |
| 13 | + |
| 14 | +1. Repeated cardinal-direction reverse logic (`opposite`) in: |
| 15 | +- `games/PacmanLite/game/PacmanLiteNavigator.js` |
| 16 | +- `games/PacmanFullAI/game/PacmanFullAINavigator.js` |
| 17 | +- `games/PacmanFullAI/game/PacmanFullAIWorld.js` |
| 18 | + |
| 19 | +2. Repeated character-count overlay text wrapping logic across scenes: |
| 20 | +- `games/breakout/game/BreakoutScene.js` |
| 21 | +- `games/bouncing-ball/game/BouncingBallScene.js` |
| 22 | +- `games/MultiBallChaos/game/MultiBallChaosScene.js` |
| 23 | +- `games/Gravity/game/GravityScene.js` |
| 24 | +- `games/Thruster/game/ThrusterScene.js` |
| 25 | +- `games/PaddleIntercept/game/PaddleInterceptScene.js` |
| 26 | +- `games/pong/game/PongScene.js` |
| 27 | + |
| 28 | +## Migration Applied |
| 29 | +### New shared utilities |
| 30 | +- Added `src/shared/utils/directionUtils.js` |
| 31 | + - `oppositeCardinalDirection(direction)` |
| 32 | +- Added `src/shared/utils/textWrapUtils.js` |
| 33 | + - `wrapTextByCharacterCount(text, maxCharacters, { preserveParagraphs })` |
| 34 | +- Exported both from `src/shared/utils/index.js` |
| 35 | + |
| 36 | +### Game rewiring |
| 37 | +- Pacman navigators/world now use `oppositeCardinalDirection` from shared utils. |
| 38 | +- Scene overlay wrappers now use `wrapTextByCharacterCount` from shared utils. |
| 39 | + |
| 40 | +## Re-Validation |
| 41 | +### Duplicate re-scan |
| 42 | +- Command: duplicate-function scan script over `games/`. |
| 43 | +- Result: `DUPLICATE_FUNCTION_CLUSTERS = 0` |
| 44 | + |
| 45 | +### Targeted runtime tests |
| 46 | +Executed and passed: |
| 47 | +- `BreakoutValidation` |
| 48 | +- `BouncingBallValidation` |
| 49 | +- `MultiBallChaosValidation` |
| 50 | +- `PongValidation` |
| 51 | +- `ThrusterValidation` |
| 52 | +- `PaddleInterceptValidation` |
| 53 | +- `GravityValidation` |
| 54 | +- `PacmanLiteValidation` |
| 55 | +- `PacmanLiteWorld` |
| 56 | +- `PacmanFullAIValidation` |
| 57 | +- `PacmanFullAIWorld` |
| 58 | + |
| 59 | +Result: `11/11 targeted tests passed` |
| 60 | + |
| 61 | +## Roadmap Status Update |
| 62 | +Execution-backed status update applied: |
| 63 | +- `docs/dev/roadmaps/MASTER_ROADMAP_HIGH_LEVEL.md` |
| 64 | + - Level 18 Track A: `verify all games use engine systems` changed `[.] -> [x]` |
| 65 | + |
| 66 | +No other roadmap text was modified. |
0 commit comments