|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_07_AS_POSITIVE_INTEGER_ADVANCED_ONLY |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Remove the remaining duplicated local `asPositiveInteger` helpers from the two advanced promotion/state modules and switch them to the existing shared number helper. |
| 5 | + |
| 6 | +## Single PR Purpose |
| 7 | +Centralize `asPositiveInteger` usage in: |
| 8 | + |
| 9 | +- `src/advanced/promotion/createPromotionGate.js` |
| 10 | +- `src/advanced/state/createWorldGameStateSystem.js` |
| 11 | + |
| 12 | +This BUILD does **not** change any other helper or file. |
| 13 | + |
| 14 | +## Exact Files Allowed |
| 15 | +Edit only these 2 files: |
| 16 | + |
| 17 | +1. `src/advanced/promotion/createPromotionGate.js` |
| 18 | +2. `src/advanced/state/createWorldGameStateSystem.js` |
| 19 | + |
| 20 | +Do not edit any other file. |
| 21 | + |
| 22 | +## Shared Dependency Assumption |
| 23 | +Use the existing shared helper already established earlier in this workflow: |
| 24 | + |
| 25 | +- `src/shared/utils/numberUtils.js` |
| 26 | + |
| 27 | +This BUILD assumes `numberUtils.js` already exports `asPositiveInteger`. |
| 28 | + |
| 29 | +Do **not** modify `src/shared/utils/numberUtils.js` in this PR. |
| 30 | + |
| 31 | +## Exact Source Changes |
| 32 | + |
| 33 | +### 1) `src/advanced/promotion/createPromotionGate.js` |
| 34 | +- remove the local `asPositiveInteger` function definition |
| 35 | +- keep all other local helpers exactly as they are |
| 36 | +- add exactly one import for `asPositiveInteger` from: |
| 37 | + |
| 38 | +```js |
| 39 | +import { asPositiveInteger } from '../../shared/utils/numberUtils.js'; |
| 40 | +``` |
| 41 | + |
| 42 | +If an import for `asPositiveInteger` already exists, do not duplicate it. |
| 43 | + |
| 44 | +### 2) `src/advanced/state/createWorldGameStateSystem.js` |
| 45 | +- remove the local `asPositiveInteger` function definition |
| 46 | +- keep all other local helpers exactly as they are |
| 47 | +- add exactly one import for `asPositiveInteger` from: |
| 48 | + |
| 49 | +```js |
| 50 | +import { asPositiveInteger } from '../../shared/utils/numberUtils.js'; |
| 51 | +``` |
| 52 | + |
| 53 | +If an import for `asPositiveInteger` already exists, do not duplicate it. |
| 54 | + |
| 55 | +## Hard Constraints |
| 56 | +- do not edit any file other than the 2 listed above |
| 57 | +- do not change `asFiniteNumber` |
| 58 | +- do not change `isPlainObject` |
| 59 | +- do not change `getState` |
| 60 | +- do not change promotion snapshot imports |
| 61 | +- do not modify logic or behavior |
| 62 | +- do not perform repo-wide helper cleanup |
| 63 | +- do not create any new file |
| 64 | +- do not modify `src/shared/utils/numberUtils.js` |
| 65 | + |
| 66 | +## Validation Checklist |
| 67 | +1. Confirm only the 2 listed files changed |
| 68 | +2. Confirm local `asPositiveInteger` function definitions no longer exist in: |
| 69 | + - `src/advanced/promotion/createPromotionGate.js` |
| 70 | + - `src/advanced/state/createWorldGameStateSystem.js` |
| 71 | +3. Confirm both files import `asPositiveInteger` from exactly: |
| 72 | + - `../../shared/utils/numberUtils.js` |
| 73 | +4. Confirm there is only one `asPositiveInteger` import per file |
| 74 | +5. Confirm no other helper definitions or logic changed |
| 75 | + |
| 76 | +## Non-Goals |
| 77 | +- no changes to any debug inspector files |
| 78 | +- no changes to `src/shared/utils/numberUtils.js` |
| 79 | +- no broader number helper normalization |
| 80 | +- no repo-wide import cleanup |
| 81 | +- no refactor beyond this exact duplicate-removal step |
0 commit comments