|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_41_AS_STRING_ARRAY_PRESET_BATCH |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Centralize duplicated `asStringArray(value)` implementations across the exact preset/group-registry batch identified in the duplicate report. |
| 5 | + |
| 6 | +## Single PR Purpose |
| 7 | +Normalize ONLY this helper: |
| 8 | + |
| 9 | +- `asStringArray(value)` |
| 10 | + |
| 11 | +## Exact Files Allowed |
| 12 | + |
| 13 | +### Shared source |
| 14 | +1. `src/shared/utils/arrayUtils.js` |
| 15 | + |
| 16 | +### Consumer files |
| 17 | +2. `tools/dev/advanced/debugPanelGroupRegistry.js` |
| 18 | +3. `tools/dev/presets/debugPresetRegistry.js` |
| 19 | + |
| 20 | +Do not edit any other file. |
| 21 | + |
| 22 | +## Source of Truth |
| 23 | +This exact scope comes from the provided duplicate report entry for: |
| 24 | + |
| 25 | +`function asStringArray(value)` |
| 26 | + |
| 27 | +Only the 2 listed consumer files are in scope. |
| 28 | + |
| 29 | +## Shared Helper Assumption |
| 30 | +Use the existing shared utility: |
| 31 | + |
| 32 | +`src/shared/utils/arrayUtils.js` |
| 33 | + |
| 34 | +Fail fast unless that file exists and exports: |
| 35 | + |
| 36 | +- `asStringArray` |
| 37 | + |
| 38 | +If the file exists and contains `asStringArray` but does not export it correctly, the only allowed shared-file change is the minimum export-only fix. |
| 39 | + |
| 40 | +If the helper does not exist in the shared file, add ONLY this helper to `src/shared/utils/arrayUtils.js` by copying one existing local implementation exactly, with no behavior change and no unrelated edits. |
| 41 | + |
| 42 | +## Exact Consumer Changes |
| 43 | +For each of the 2 listed consumer files: |
| 44 | + |
| 45 | +If the file contains a local function definition matching: |
| 46 | +```js |
| 47 | +function asStringArray(value) |
| 48 | +``` |
| 49 | +then: |
| 50 | +- remove the local `asStringArray(value)` function definition |
| 51 | +- import `asStringArray` from the correct relative path to: |
| 52 | + - `src/shared/utils/arrayUtils.js` |
| 53 | +- if the file already imports from that module, add `asStringArray` with the minimum safe edit |
| 54 | +- do not duplicate imports |
| 55 | +- do not touch unrelated helpers |
| 56 | +- do not change logic |
| 57 | + |
| 58 | +If a listed file already imports and uses shared `asStringArray`, leave it unchanged. |
| 59 | + |
| 60 | +## Relative Import Rule |
| 61 | +Use the correct relative path from each consumer file to: |
| 62 | + |
| 63 | +`src/shared/utils/arrayUtils.js` |
| 64 | + |
| 65 | +Do not use aliases. |
| 66 | +Do not change `.js` extension usage. |
| 67 | + |
| 68 | +## Hard Constraints |
| 69 | +- no engine changes outside `src/shared/utils/arrayUtils.js` |
| 70 | +- no files outside the 2 listed consumers |
| 71 | +- no repo-wide array helper cleanup |
| 72 | +- no behavior changes |
| 73 | +- keep one PR purpose only |
| 74 | + |
| 75 | +## Validation Checklist |
| 76 | +1. Confirm no more than the 3 listed files changed |
| 77 | +2. Confirm `src/shared/utils/arrayUtils.js` exports `asStringArray` |
| 78 | +3. Confirm local `function asStringArray(value)` definitions no longer exist in changed listed consumer files |
| 79 | +4. Confirm changed consumer files import `asStringArray` from the correct relative path to `src/shared/utils/arrayUtils.js` |
| 80 | +5. Confirm no unrelated files changed |
| 81 | +6. Confirm no behavior changes were made |
| 82 | + |
| 83 | +## Non-Goals |
| 84 | +- no cleanup of `ensureArray` |
| 85 | +- no cleanup of `asArray` |
| 86 | +- no cleanup outside the 2 listed consumer files |
| 87 | +- no refactor beyond this exact duplicate-removal batch |
0 commit comments