|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_47_PROJECT_SYSTEM_VALUE_HELPERS_BATCH |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Centralize duplicated project-system value helpers across the exact tools/shared batch identified in the duplicate report. |
| 5 | + |
| 6 | +## Single PR Purpose |
| 7 | +Normalize ONLY these helpers: |
| 8 | + |
| 9 | +- `cloneValue(value)` |
| 10 | +- `safeString(value, fallback = "")` |
| 11 | + |
| 12 | +## Exact Files Allowed |
| 13 | + |
| 14 | +### New shared file |
| 15 | +1. `tools/shared/projectSystemValueUtils.js` |
| 16 | + |
| 17 | +### Consumer files |
| 18 | +2. `tools/shared/projectManifestContract.js` |
| 19 | +3. `tools/shared/projectSystem.js` |
| 20 | +4. `tools/shared/projectSystemAdapters.js` |
| 21 | + |
| 22 | +Do not edit any other file. |
| 23 | + |
| 24 | +## Source of Truth |
| 25 | +This exact scope comes from the provided duplicate report entries for: |
| 26 | +- `function cloneValue(value)` |
| 27 | +- `function safeString(value, fallback = "")` |
| 28 | + |
| 29 | +Only the 3 listed consumer files are in scope. |
| 30 | + |
| 31 | +## Exact Shared Helper Creation |
| 32 | +Create: |
| 33 | + |
| 34 | +`tools/shared/projectSystemValueUtils.js` |
| 35 | + |
| 36 | +Export exactly: |
| 37 | +- `cloneValue` |
| 38 | +- `safeString` |
| 39 | + |
| 40 | +Implementation rules: |
| 41 | +- use ONE existing local implementation as source-of-truth for each helper |
| 42 | +- do NOT merge logic |
| 43 | +- do NOT generalize behavior |
| 44 | +- preserve signatures exactly: |
| 45 | + - `cloneValue(value)` |
| 46 | + - `safeString(value, fallback = "")` |
| 47 | + |
| 48 | +## Exact Consumer Changes |
| 49 | +For each of the 3 listed consumer files: |
| 50 | + |
| 51 | +If the file contains local function definitions matching: |
| 52 | +```js |
| 53 | +function cloneValue(value) |
| 54 | +function safeString(value, fallback = "") |
| 55 | +``` |
| 56 | +then: |
| 57 | +- remove the local function definition(s) |
| 58 | +- import the helper(s) from the correct relative path to: |
| 59 | + - `./projectSystemValueUtils.js` |
| 60 | +- if the file already imports from that module, add the needed helper(s) with the minimum safe edit |
| 61 | +- do not duplicate imports |
| 62 | +- do not touch unrelated helpers |
| 63 | +- do not change logic |
| 64 | + |
| 65 | +If a listed file already imports and uses shared versions, leave it unchanged. |
| 66 | + |
| 67 | +## Relative Import Rule |
| 68 | +Use exactly: |
| 69 | + |
| 70 | +`./projectSystemValueUtils.js` |
| 71 | + |
| 72 | +Do not use aliases. |
| 73 | +Do not change `.js` extension usage. |
| 74 | + |
| 75 | +## Hard Constraints |
| 76 | +- no files outside the 3 listed consumers plus the one new shared file |
| 77 | +- no repo-wide project-system cleanup |
| 78 | +- no behavior changes |
| 79 | +- keep one PR purpose only |
| 80 | + |
| 81 | +## Validation Checklist |
| 82 | +1. Confirm no more than the 4 listed files changed |
| 83 | +2. Confirm `tools/shared/projectSystemValueUtils.js` exists and exports: |
| 84 | + - `cloneValue` |
| 85 | + - `safeString` |
| 86 | +3. Confirm local function definitions no longer exist in changed listed consumer files |
| 87 | +4. Confirm changed consumer files import the helpers from `./projectSystemValueUtils.js` |
| 88 | +5. Confirm no unrelated files changed |
| 89 | +6. Confirm no behavior changes were made |
| 90 | + |
| 91 | +## Non-Goals |
| 92 | +- no cleanup outside the 3 listed consumer files |
| 93 | +- no refactor beyond this exact duplicate-removal batch |
0 commit comments