|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_46_STRINGIFY_VALUE_INSPECTOR_BATCH |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Centralize duplicated `stringifyValue(value)` implementations across the exact inspector/command-pack batch identified in the duplicate report. |
| 5 | + |
| 6 | +## Single PR Purpose |
| 7 | +Normalize ONLY this helper: |
| 8 | + |
| 9 | +- `stringifyValue(value)` |
| 10 | + |
| 11 | +## Exact Files Allowed |
| 12 | + |
| 13 | +### New shared file |
| 14 | +1. `tools/dev/shared/stringifyValueUtils.js` |
| 15 | + |
| 16 | +### Consumer files |
| 17 | +2. `src/engine/debug/inspectors/viewModels/stateDiffInspectorViewModel.js` |
| 18 | +3. `tools/dev/commandPacks/inspectorCommandPack.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 stringifyValue(value)` |
| 26 | + |
| 27 | +Only the 2 listed consumer files are in scope. |
| 28 | + |
| 29 | +## Exact Shared Helper Creation |
| 30 | +Create: |
| 31 | + |
| 32 | +`tools/dev/shared/stringifyValueUtils.js` |
| 33 | + |
| 34 | +Export exactly: |
| 35 | + |
| 36 | +```js |
| 37 | +export function stringifyValue(value) { |
| 38 | + // copy one existing implementation exactly |
| 39 | +} |
| 40 | +``` |
| 41 | + |
| 42 | +Implementation rules: |
| 43 | +- use ONE existing local implementation as source-of-truth |
| 44 | +- do NOT merge logic |
| 45 | +- do NOT generalize behavior |
| 46 | +- preserve the function signature exactly: |
| 47 | + - `stringifyValue(value)` |
| 48 | + |
| 49 | +## Exact Consumer Changes |
| 50 | +For each of the 2 listed consumer files: |
| 51 | + |
| 52 | +If the file contains a local function definition matching: |
| 53 | +```js |
| 54 | +function stringifyValue(value) |
| 55 | +``` |
| 56 | +then: |
| 57 | +- remove the local `stringifyValue(value)` function definition |
| 58 | +- import `stringifyValue` from the correct relative path to: |
| 59 | + - `tools/dev/shared/stringifyValueUtils.js` |
| 60 | +- if the file already imports from that module, add `stringifyValue` 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 `stringifyValue`, leave it unchanged. |
| 66 | + |
| 67 | +## Relative Import Rule |
| 68 | +Use the correct relative path from each consumer file to: |
| 69 | + |
| 70 | +`tools/dev/shared/stringifyValueUtils.js` |
| 71 | + |
| 72 | +Do not use aliases. |
| 73 | +Do not change `.js` extension usage. |
| 74 | + |
| 75 | +## Hard Constraints |
| 76 | +- no files outside the 2 listed consumers plus the one new shared file |
| 77 | +- no repo-wide stringify helper cleanup |
| 78 | +- no behavior changes |
| 79 | +- keep one PR purpose only |
| 80 | + |
| 81 | +## Validation Checklist |
| 82 | +1. Confirm no more than the 3 listed files changed |
| 83 | +2. Confirm `tools/dev/shared/stringifyValueUtils.js` exists and exports `stringifyValue` |
| 84 | +3. Confirm local `function stringifyValue(value)` definitions no longer exist in changed listed consumer files |
| 85 | +4. Confirm changed consumer files import `stringifyValue` from the correct relative path to `tools/dev/shared/stringifyValueUtils.js` |
| 86 | +5. Confirm no unrelated files changed |
| 87 | +6. Confirm no behavior changes were made |
| 88 | + |
| 89 | +## Non-Goals |
| 90 | +- no cleanup outside the 2 listed consumer files |
| 91 | +- no refactor beyond this exact duplicate-removal batch |
0 commit comments