|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_26_SANITIZE_TEXT_TOOLS_DEBUG_BATCH |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Eliminate duplicated `sanitizeText(value)` implementations across the tools/dev/shared debug slice by centralizing them to one shared utility and updating only the listed consumers. |
| 5 | + |
| 6 | +## Single PR Purpose |
| 7 | +Normalize `sanitizeText(value)` ONLY for this exact tools/debug batch: |
| 8 | + |
| 9 | +1. `tools/dev/canvasDebugHudRenderer.js` |
| 10 | +2. `tools/dev/devConsoleCommandRegistry.js` |
| 11 | +3. `tools/dev/devConsoleIntegration.js` |
| 12 | +4. `tools/dev/interactiveDevConsoleRenderer.js` |
| 13 | +5. `tools/dev/advanced/debugMacroExecutor.js` |
| 14 | +6. `tools/dev/advanced/debugMacroRegistry.js` |
| 15 | +7. `tools/dev/advanced/debugPanelGroupRegistry.js` |
| 16 | +8. `tools/dev/commandPacks/groupCommandPack.js` |
| 17 | +9. `tools/dev/commandPacks/inspectorCommandPack.js` |
| 18 | +10. `tools/dev/commandPacks/macroCommandPack.js` |
| 19 | +11. `tools/dev/commandPacks/overlayCommandPack.js` |
| 20 | +12. `tools/dev/commandPacks/packUtils.js` |
| 21 | +13. `tools/dev/inspectors/inspectorStore.js` |
| 22 | +14. `tools/dev/plugins/debugPluginSystem.js` |
| 23 | +15. `tools/dev/presets/debugPresetApplier.js` |
| 24 | +16. `tools/dev/presets/debugPresetRegistry.js` |
| 25 | +17. `tools/dev/presets/registerPresetCommands.js` |
| 26 | +18. `tools/shared/devConsoleDebugOverlay.js` |
| 27 | + |
| 28 | +This BUILD does not change game files, sample files, or engine files. |
| 29 | + |
| 30 | +## Exact Files Allowed |
| 31 | +Edit only these 19 files: |
| 32 | + |
| 33 | +### Canonical shared source |
| 34 | +1. `src/engine/debug/inspectors/shared/inspectorUtils.js` |
| 35 | + |
| 36 | +### Consumer files |
| 37 | +2. `tools/dev/canvasDebugHudRenderer.js` |
| 38 | +3. `tools/dev/devConsoleCommandRegistry.js` |
| 39 | +4. `tools/dev/devConsoleIntegration.js` |
| 40 | +5. `tools/dev/interactiveDevConsoleRenderer.js` |
| 41 | +6. `tools/dev/advanced/debugMacroExecutor.js` |
| 42 | +7. `tools/dev/advanced/debugMacroRegistry.js` |
| 43 | +8. `tools/dev/advanced/debugPanelGroupRegistry.js` |
| 44 | +9. `tools/dev/commandPacks/groupCommandPack.js` |
| 45 | +10. `tools/dev/commandPacks/inspectorCommandPack.js` |
| 46 | +11. `tools/dev/commandPacks/macroCommandPack.js` |
| 47 | +12. `tools/dev/commandPacks/overlayCommandPack.js` |
| 48 | +13. `tools/dev/commandPacks/packUtils.js` |
| 49 | +14. `tools/dev/inspectors/inspectorStore.js` |
| 50 | +15. `tools/dev/plugins/debugPluginSystem.js` |
| 51 | +16. `tools/dev/presets/debugPresetApplier.js` |
| 52 | +17. `tools/dev/presets/debugPresetRegistry.js` |
| 53 | +18. `tools/dev/presets/registerPresetCommands.js` |
| 54 | +19. `tools/shared/devConsoleDebugOverlay.js` |
| 55 | + |
| 56 | +Do not edit any other file. |
| 57 | + |
| 58 | +## Source-of-Truth for duplication |
| 59 | +This BUILD is based on the duplicate report showing `sanitizeText(value)` duplicated across this tools/debug batch and in other slices. |
| 60 | +This PR intentionally handles ONLY the tools/debug batch, not the game/sample duplicates. |
| 61 | + |
| 62 | +## Shared Helper Assumption |
| 63 | +Use the existing canonical helper: |
| 64 | + |
| 65 | +- `src/engine/debug/inspectors/shared/inspectorUtils.js` |
| 66 | + |
| 67 | +Fail fast unless that file exists and exports: |
| 68 | + |
| 69 | +```js |
| 70 | +sanitizeText |
| 71 | +``` |
| 72 | + |
| 73 | +If the file exists and contains `sanitizeText` but does not export it correctly, the only allowed shared-file change is the minimum export fix. |
| 74 | + |
| 75 | +Do not create a new shared file in this PR. |
| 76 | + |
| 77 | +## Exact Change Rules |
| 78 | + |
| 79 | +### Shared source file |
| 80 | +#### `src/engine/debug/inspectors/shared/inspectorUtils.js` |
| 81 | +Allowed: |
| 82 | +- confirm `sanitizeText` exists |
| 83 | +- confirm `sanitizeText` is exported |
| 84 | +- if needed, make the minimum export-only fix |
| 85 | + |
| 86 | +Not allowed: |
| 87 | +- no behavior changes |
| 88 | +- no renaming |
| 89 | +- no adding unrelated helpers |
| 90 | +- no refactor |
| 91 | + |
| 92 | +### Consumer files |
| 93 | +For each of the 18 listed consumer files: |
| 94 | + |
| 95 | +If a local function definition exists matching: |
| 96 | +```js |
| 97 | +function sanitizeText(value) |
| 98 | +``` |
| 99 | +then: |
| 100 | +- remove the local `sanitizeText` function definition |
| 101 | +- add exactly one import for `sanitizeText` from the correct relative path to: |
| 102 | + - `src/engine/debug/inspectors/shared/inspectorUtils.js` |
| 103 | +- if the file already imports from that shared module, add `sanitizeText` to the existing import with the minimum safe edit |
| 104 | +- do not duplicate imports |
| 105 | +- do not touch unrelated helpers |
| 106 | +- do not change logic |
| 107 | + |
| 108 | +If a listed file does not currently contain a local `sanitizeText(value)` function: |
| 109 | +- leave that file unchanged |
| 110 | + |
| 111 | +## Relative Import Rule |
| 112 | +Use the correct relative path from each consumer file to: |
| 113 | + |
| 114 | +`src/engine/debug/inspectors/shared/inspectorUtils.js` |
| 115 | + |
| 116 | +Do not use aliases. |
| 117 | +Do not change `.js` extension usage. |
| 118 | + |
| 119 | +## Hard Constraints |
| 120 | +- no game files |
| 121 | +- no sample files |
| 122 | +- no engine files beyond `src/engine/debug/inspectors/shared/inspectorUtils.js` |
| 123 | +- no repo-wide sanitizeText cleanup |
| 124 | +- no helper behavior changes |
| 125 | +- no import path normalization beyond this exact helper move |
| 126 | +- keep one PR purpose only |
| 127 | + |
| 128 | +## Validation Checklist |
| 129 | +1. Confirm no more than the 19 listed files changed |
| 130 | +2. Confirm `src/engine/debug/inspectors/shared/inspectorUtils.js` exports `sanitizeText` |
| 131 | +3. Confirm local `function sanitizeText(value)` definitions no longer exist in the changed listed consumer files |
| 132 | +4. Confirm changed consumer files import `sanitizeText` from the correct relative path to `src/engine/debug/inspectors/shared/inspectorUtils.js` |
| 133 | +5. Confirm no game, sample, or unrelated engine file changed |
| 134 | +6. Confirm no behavior changes were made |
| 135 | + |
| 136 | +## Non-Goals |
| 137 | +- no sanitizeText cleanup in games |
| 138 | +- no sanitizeText cleanup in network sample mains |
| 139 | +- no sanitizeText cleanup in samples |
| 140 | +- no sanitizeText cleanup in other tools/shared files outside the 18 listed consumers |
| 141 | +- no refactor beyond this exact duplicate-removal batch |
0 commit comments