|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_04_AS_FINITE_NUMBER_ONLY |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Extract and normalize `asFiniteNumber` only. |
| 5 | + |
| 6 | +This BUILD intentionally narrows scope to one executable helper move so the bundle can execute code directly without guessing. |
| 7 | + |
| 8 | +## Single PR Purpose |
| 9 | +- move duplicate `asFiniteNumber` implementations into the existing shared number helper module |
| 10 | +- update only the exact imports/call sites affected by that move |
| 11 | + |
| 12 | +## Exact Source Files |
| 13 | +1. `src/advanced/promotion/createPromotionGate.js` |
| 14 | +2. `src/advanced/state/createWorldGameStateSystem.js` |
| 15 | +3. `games/network_sample_c/game/ReconciliationLayerAdapter.js` |
| 16 | + |
| 17 | +## Exact Destination File |
| 18 | +- `src/shared/utils/numberUtils.js` |
| 19 | + |
| 20 | +## Exact Move Rules |
| 21 | +### Destination ownership |
| 22 | +`src/shared/utils/numberUtils.js` must export: |
| 23 | +- `asFiniteNumber` |
| 24 | +- preserve existing exports already in that file |
| 25 | +- do not rename `asFiniteNumber` |
| 26 | + |
| 27 | +### Source edits |
| 28 | +#### 1) `src/advanced/promotion/createPromotionGate.js` |
| 29 | +- remove the local `asFiniteNumber` function definition |
| 30 | +- keep the local `asPositiveInteger` function as-is |
| 31 | +- add an import for `asFiniteNumber` from: |
| 32 | + - `../../shared/utils/numberUtils.js` |
| 33 | + |
| 34 | +#### 2) `src/advanced/state/createWorldGameStateSystem.js` |
| 35 | +- remove the local `asFiniteNumber` function definition |
| 36 | +- keep the local `asPositiveInteger` function as-is |
| 37 | +- add an import for `asFiniteNumber` from: |
| 38 | + - `../../shared/utils/numberUtils.js` |
| 39 | + |
| 40 | +#### 3) `games/network_sample_c/game/ReconciliationLayerAdapter.js` |
| 41 | +- remove the local `asFiniteNumber` function definition |
| 42 | +- add an import for `asFiniteNumber` from: |
| 43 | + - `../../../src/shared/utils/numberUtils.js` |
| 44 | + |
| 45 | +## Hard Constraints |
| 46 | +- edit only the 4 files listed in this BUILD: |
| 47 | + - `src/shared/utils/numberUtils.js` |
| 48 | + - `src/advanced/promotion/createPromotionGate.js` |
| 49 | + - `src/advanced/state/createWorldGameStateSystem.js` |
| 50 | + - `games/network_sample_c/game/ReconciliationLayerAdapter.js` |
| 51 | +- do not change logic |
| 52 | +- do not move any other helper |
| 53 | +- do not modify engine APIs |
| 54 | +- do not normalize `getState` in this PR |
| 55 | +- do not touch `asPositiveInteger` in this PR except preserving existing local usage in the two advanced files |
| 56 | +- do not perform repo-wide cleanup |
| 57 | + |
| 58 | +## Validation Checklist |
| 59 | +1. Confirm only the 4 listed files changed |
| 60 | +2. Confirm `asFiniteNumber` is exported from `src/shared/utils/numberUtils.js` |
| 61 | +3. Confirm `asFiniteNumber` local definitions no longer exist in: |
| 62 | + - `src/advanced/promotion/createPromotionGate.js` |
| 63 | + - `src/advanced/state/createWorldGameStateSystem.js` |
| 64 | + - `games/network_sample_c/game/ReconciliationLayerAdapter.js` |
| 65 | +4. Confirm imports now point to: |
| 66 | + - `../../shared/utils/numberUtils.js` |
| 67 | + - `../../../src/shared/utils/numberUtils.js` |
| 68 | +5. Confirm no logic/runtime behavior changes were introduced |
| 69 | +6. Confirm no `getState` work was performed |
| 70 | + |
| 71 | +## Non-Goals |
| 72 | +- no `getState` extraction |
| 73 | +- no import normalization beyond `asFiniteNumber` |
| 74 | +- no alias path migration |
| 75 | +- no refactor |
| 76 | +- no file creation beyond using the existing `src/shared/utils/numberUtils.js` |
0 commit comments