|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_08_IS_PLAIN_OBJECT_ADVANCED_ONLY |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Remove any remaining advanced-local `isPlainObject` duplication from the two advanced promotion/state modules and switch them to the shared object helper. |
| 5 | + |
| 6 | +## Single PR Purpose |
| 7 | +Normalize `isPlainObject` 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 3 files: |
| 16 | + |
| 17 | +1. `src/advanced/promotion/createPromotionGate.js` |
| 18 | +2. `src/advanced/state/createWorldGameStateSystem.js` |
| 19 | +3. `src/shared/utils/objectUtils.js` **only if needed to confirm/export existing shared `isPlainObject`** |
| 20 | + |
| 21 | +Do not edit any other file. |
| 22 | + |
| 23 | +## Shared Dependency Assumption |
| 24 | +Use the shared helper path: |
| 25 | + |
| 26 | +- `src/shared/utils/objectUtils.js` |
| 27 | + |
| 28 | +## Fail-Fast Gate |
| 29 | +Before making source edits, confirm `src/shared/utils/objectUtils.js` already exists and exports `isPlainObject`. |
| 30 | + |
| 31 | +If either condition is false: |
| 32 | +- stop |
| 33 | +- report blocker |
| 34 | +- make no changes |
| 35 | +- do not create a delta ZIP |
| 36 | + |
| 37 | +Do **not** create a new shared object helper in this PR. |
| 38 | + |
| 39 | +## Exact Source Changes |
| 40 | + |
| 41 | +### 1) `src/advanced/promotion/createPromotionGate.js` |
| 42 | +If a local `isPlainObject` function definition exists: |
| 43 | +- remove the local `isPlainObject` function definition |
| 44 | +- add exactly one import for `isPlainObject` from: |
| 45 | + |
| 46 | +```js |
| 47 | +import { isPlainObject } from '../../shared/utils/objectUtils.js'; |
| 48 | +``` |
| 49 | + |
| 50 | +If an import for `isPlainObject` already exists, do not duplicate it. |
| 51 | + |
| 52 | +If no local `isPlainObject` function definition exists: |
| 53 | +- leave this file unchanged |
| 54 | + |
| 55 | +### 2) `src/advanced/state/createWorldGameStateSystem.js` |
| 56 | +If a local `isPlainObject` function definition exists: |
| 57 | +- remove the local `isPlainObject` function definition |
| 58 | +- add exactly one import for `isPlainObject` from: |
| 59 | + |
| 60 | +```js |
| 61 | +import { isPlainObject } from '../../shared/utils/objectUtils.js'; |
| 62 | +``` |
| 63 | + |
| 64 | +If an import for `isPlainObject` already exists, do not duplicate it. |
| 65 | + |
| 66 | +If no local `isPlainObject` function definition exists: |
| 67 | +- leave this file unchanged |
| 68 | + |
| 69 | +### 3) `src/shared/utils/objectUtils.js` |
| 70 | +Do not modify implementation logic. |
| 71 | + |
| 72 | +Allowed edit only: |
| 73 | +- if `isPlainObject` already exists in this file but is not exported, make the minimum export change required |
| 74 | + |
| 75 | +If `isPlainObject` is already exported, leave this file unchanged. |
| 76 | + |
| 77 | +## Hard Constraints |
| 78 | +- do not edit any file other than the 3 listed above |
| 79 | +- do not change `asFiniteNumber` |
| 80 | +- do not change `asPositiveInteger` |
| 81 | +- do not change `getState` |
| 82 | +- do not create new shared helper files |
| 83 | +- do not perform repo-wide helper cleanup |
| 84 | +- do not modify logic or behavior |
| 85 | +- do not normalize any other imports |
| 86 | + |
| 87 | +## Validation Checklist |
| 88 | +1. Confirm no more than the 3 listed files changed |
| 89 | +2. Confirm `src/shared/utils/objectUtils.js` exists |
| 90 | +3. Confirm `src/shared/utils/objectUtils.js` exports `isPlainObject` |
| 91 | +4. Confirm local `isPlainObject` function definitions no longer exist in: |
| 92 | + - `src/advanced/promotion/createPromotionGate.js` (if one existed before) |
| 93 | + - `src/advanced/state/createWorldGameStateSystem.js` (if one existed before) |
| 94 | +5. Confirm any updated advanced file imports `isPlainObject` from exactly: |
| 95 | + - `../../shared/utils/objectUtils.js` |
| 96 | +6. Confirm no other helper definitions or logic changed |
| 97 | + |
| 98 | +## Non-Goals |
| 99 | +- no changes to `src/advanced/state/events.js` |
| 100 | +- no changes to `src/advanced/state/initialState.js` |
| 101 | +- no changes to `src/advanced/state/transitions.js` |
| 102 | +- no broader object helper normalization |
| 103 | +- no new helper creation |
| 104 | +- no refactor beyond this exact duplicate-removal step |
0 commit comments