|
| 1 | +# PR_26140_033 Shared Utils Phase 2 Report |
| 2 | + |
| 3 | +## Summary |
| 4 | +- Added shared string helpers for `normalizeText`, `normalizeToken`, and case-preserving `normalizeGameId`. |
| 5 | +- Added shared `toObject` in `src/shared/utils/objectUtils.js` for callers that intentionally allow arrays, while preserving existing `asObject` array-rejecting semantics. |
| 6 | +- Replaced exact-match local helpers across active game, engine, and tool code for `sanitizeText`, `normalizeToken`, `normalizeGameId`, `toObject`, and `positiveInteger`. |
| 7 | +- Left lowercasing/slug `normalizeGameId` variants and other differing semantics in place. |
| 8 | + |
| 9 | +## Duplicate Scan |
| 10 | +- Re-ran `tools/shared/powerShell/find_dupes_called.ps1` into `tmp/dupes_called.txt`. |
| 11 | +- Verified `node_modules` paths are not present in the regenerated duplicate report. |
| 12 | +- Selected duplicate block counts from `tmp/dupes_called.txt`: |
| 13 | + - `function sanitizeText(value)`: 41 -> 38 |
| 14 | + - `export function sanitizeText(value)`: 3 -> 0 |
| 15 | + - `function toObject(value)`: 12 -> 2 |
| 16 | + - `function normalizeToken(value)`: 5 -> 2 |
| 17 | + - `function normalizeGameId(value)`: 5 -> 2 |
| 18 | + - `function positiveInteger(value)`: 3 -> 0 |
| 19 | + |
| 20 | +## Scope Notes |
| 21 | +- No vendor, generated bundle, `node_modules`, `tests/results`, or archived tool files were modified. |
| 22 | +- `normalizeGameId` variants that lowercase or slugify game IDs remain local because their behavior differs from case-preserving game ID trimming. |
| 23 | +- `normalizeString` helpers that coerce non-strings through `String(value || "")` remain local because they differ from the shared string-only trim semantics. |
| 24 | +- `distance`/`near` helpers were not migrated in this pass because the remaining candidates either use different distance metrics or are outside the requested validation surface. |
| 25 | + |
| 26 | +## Validation |
| 27 | +- PASS: `npm run build:manifest` |
| 28 | +- PASS: `node tests\games\AsteroidsValidation.test.mjs` |
| 29 | +- PASS: `node tests\games\AsteroidsManifestScreenDimensions.test.mjs` |
| 30 | +- PASS: `node tests\games\AsteroidsPresentation.test.mjs` |
| 31 | +- PASS: `node tests\tools\ObjectVectorFinalRuntimeCleanup.test.mjs` |
| 32 | +- PASS: `node tests\tools\ObjectVectorStudioV2DeleteCleanup.test.mjs` |
| 33 | +- PASS: `npm run test:workspace-v2` (58 passed) |
| 34 | +- PASS: `npx playwright test tests/playwright/tools/ObjectVectorStudioV2FirstClassToolStarter.spec.mjs --project=playwright --workers=1 --reporter=list` (4 passed) |
| 35 | +- PASS: `npx playwright test tests/playwright/tools/AsteroidsGameSceneCleanup.spec.mjs --project=playwright --workers=1 --reporter=list` (1 passed) |
| 36 | +- PASS: `git diff --check` (no whitespace errors; Git reported existing CRLF/LF normalization warnings for two modified files) |
| 37 | + |
| 38 | +## Corrected During Validation |
| 39 | +- The first Asteroids Node validation exposed a new browser-absolute import in `games/shared/workspaceGameAssetCatalog.js`; switched new `games/shared` and `games/index.render.js` imports to relative paths and reran validation successfully. |
| 40 | +- A first Playwright invocation used Windows backslashes and matched no tests; reran with forward slashes successfully. |
0 commit comments