Skip to content

Commit dfd49e0

Browse files
author
DavidQ
committed
BUILD PR: centralize sanitizeText across tools/debug batch to inspectorUtils shared helper.
1 parent deae9f4 commit dfd49e0

24 files changed

+185
-63
lines changed

docs/dev/CODEX_COMMANDS.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
MODEL: GPT-5.3-codex
22
REASONING: high
33
COMMAND:
4-
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_25_GUARD_SELFTEST_RUNNER.md exactly.
4+
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_26_SANITIZE_TEXT_TOOLS_DEBUG_BATCH.md exactly.
55
Edit only these files:
6-
- tools/dev/checkSharedExtractionGuard.selftest.mjs (new file)
7-
- tools/dev/checkSharedExtractionGuard.mjs (only if a minimal export is strictly required)
8-
Fail fast if tools/dev/checkSharedExtractionGuard.mjs does not exist.
6+
- src/engine/debug/inspectors/shared/inspectorUtils.js (only if minimum export fix is needed)
7+
- tools/dev/canvasDebugHudRenderer.js
8+
- tools/dev/devConsoleCommandRegistry.js
9+
- tools/dev/devConsoleIntegration.js
10+
- tools/dev/interactiveDevConsoleRenderer.js
11+
- tools/dev/advanced/debugMacroExecutor.js
12+
- tools/dev/advanced/debugMacroRegistry.js
13+
- tools/dev/advanced/debugPanelGroupRegistry.js
14+
- tools/dev/commandPacks/groupCommandPack.js
15+
- tools/dev/commandPacks/inspectorCommandPack.js
16+
- tools/dev/commandPacks/macroCommandPack.js
17+
- tools/dev/commandPacks/overlayCommandPack.js
18+
- tools/dev/commandPacks/packUtils.js
19+
- tools/dev/inspectors/inspectorStore.js
20+
- tools/dev/plugins/debugPluginSystem.js
21+
- tools/dev/presets/debugPresetApplier.js
22+
- tools/dev/presets/debugPresetRegistry.js
23+
- tools/dev/presets/registerPresetCommands.js
24+
- tools/shared/devConsoleDebugOverlay.js
25+
Fail fast unless src/engine/debug/inspectors/shared/inspectorUtils.js exists and exposes sanitizeText, or can be fixed with a minimum export-only change.
926
Do not expand scope.
10-
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_25_GUARD_SELFTEST_RUNNER_delta.zip
27+
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_26_SANITIZE_TEXT_TOOLS_DEBUG_BATCH_delta.zip

docs/dev/COMMIT_COMMENT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BUILD PR: add self-test runner for shared extraction guard.
1+
BUILD PR: centralize sanitizeText across tools/debug batch to inspectorUtils shared helper.

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Next: continue BUILD chain.
1+
Next: continue duplicate-family batch extraction using the duplicate report as source of truth.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Adds a temp-workspace self-test runner for the guard.
1+
Batch extraction for sanitizeText across tools/dev/shared debug consumers only.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
self-test runner added correctly
1+
sanitizeText batch moved to shared helper with consumer imports updated.
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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

tools/dev/advanced/debugMacroExecutor.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ David Quesenberry
55
debugMacroExecutor.js
66
*/
77

8-
function sanitizeText(value) {
9-
return typeof value === "string" ? value.trim() : "";
10-
}
8+
import { sanitizeText } from "../../../src/engine/debug/inspectors/shared/inspectorUtils.js";
119

1210
function parseCommandName(commandLine) {
1311
const line = sanitizeText(commandLine);

tools/dev/advanced/debugMacroRegistry.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ David Quesenberry
55
debugMacroRegistry.js
66
*/
77

8-
function sanitizeText(value) {
9-
return typeof value === "string" ? value.trim() : "";
10-
}
8+
import { sanitizeText } from "../../../src/engine/debug/inspectors/shared/inspectorUtils.js";
119

1210
function asStepArray(value) {
1311
if (!Array.isArray(value)) {

tools/dev/advanced/debugPanelGroupRegistry.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ David Quesenberry
55
debugPanelGroupRegistry.js
66
*/
77

8-
function sanitizeText(value) {
9-
return typeof value === "string" ? value.trim() : "";
10-
}
8+
import { sanitizeText } from "../../../src/engine/debug/inspectors/shared/inspectorUtils.js";
119

1210
function asStringArray(value) {
1311
if (!Array.isArray(value)) {

tools/dev/canvasDebugHudRenderer.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ David Quesenberry
55
canvasDebugHudRenderer.js
66
*/
77

8-
function sanitizeText(value) {
9-
return typeof value === "string" ? value.trim() : "";
10-
}
8+
import { sanitizeText } from "../../src/engine/debug/inspectors/shared/inspectorUtils.js";
119

1210
function toArrayLines(lines) {
1311
return Array.isArray(lines)

0 commit comments

Comments
 (0)