|
| 1 | +# PR_26139_030 Shared Utils Duplicate Method Extraction Report |
| 2 | + |
| 3 | +## Scope |
| 4 | + |
| 5 | +- Read `docs/dev/PROJECT_INSTRUCTIONS.md` and `tmp/dups.txt`. |
| 6 | +- Treated `tmp/dups.txt` as broad duplicate-input signal only; ignored vendor, bundled, Playwright/test-runner, generated, and unrelated tool noise. |
| 7 | +- Limited extraction to high-confidence helpers whose behavior matched current callers. |
| 8 | + |
| 9 | +## Changes |
| 10 | + |
| 11 | +- Added shared geometry helpers in `src/shared/utils/geometryUtils.js`: |
| 12 | + - `normalizePoints` |
| 13 | + - `centerPoints` |
| 14 | + - `maxRadius` |
| 15 | +- Added exact JSON-clone helper `deepClone` in `src/shared/utils/jsonUtils.js`. |
| 16 | + - Preserved existing `cloneJson` nullish behavior by delegating non-nullish values to `deepClone`. |
| 17 | +- Reused existing `asArray` from `src/shared/utils/arrayUtils.js`. |
| 18 | +- Reused existing `isRecord` / `isPlainObject` shared guards where local semantics matched. |
| 19 | +- Replaced duplicate local helpers in: |
| 20 | + - Asteroids ship, bullet, UFO, ship debris, and asteroid profile geometry modules. |
| 21 | + - Asteroids manifest object geometry loader. |
| 22 | + - Shared Object Vector collision path. |
| 23 | + - Collision Inspector V2 constants. |
| 24 | + - Object Vector Studio V2 app/schema service. |
| 25 | + |
| 26 | +## Deliberate Non-Changes |
| 27 | + |
| 28 | +- Did not merge `src/engine/collision/objectVector.js` local `normalizePoints`; it preserves non-finite point entries via fallback conversion, while the extracted Asteroids helper filters non-finite points. |
| 29 | +- Did not normalize broad `sanitizeText`, `normalizeText`, `clamp`, or `toFiniteNumber` duplicates because `tmp/dups.txt` includes many unrelated or semantically different active/tool/vendor definitions. |
| 30 | +- Did not touch deprecated Vector Map Editor, Playwright internals, CodeMirror/bundled code, generated artifacts, or test-runner code. |
| 31 | + |
| 32 | +## Validation |
| 33 | + |
| 34 | +- PASS `npm run build:manifest` |
| 35 | +- PASS `node tests/games/AsteroidsValidation.test.mjs` |
| 36 | +- PASS `node tests/games/AsteroidsPresentation.test.mjs` |
| 37 | +- PASS `node tests/tools/ObjectVectorStudioV2DeleteCleanup.test.mjs` |
| 38 | +- PASS `npx playwright test tests/playwright/tools/AsteroidsGameSceneCleanup.spec.mjs --project=playwright --workers=1 --reporter=list` |
| 39 | +- PASS `npx playwright test tests/playwright/tools/ObjectVectorStudioV2FirstClassToolStarter.spec.mjs --project=playwright --workers=1 --reporter=list` |
| 40 | +- PASS `npx playwright test tests/playwright/tools/CollisionInspectorV2.spec.mjs --project=playwright --workers=1 --reporter=list` |
| 41 | +- PASS `npx playwright test tests/playwright/tools/AsteroidsGameSceneCleanup.spec.mjs tests/playwright/tools/ObjectVectorStudioV2FirstClassToolStarter.spec.mjs tests/playwright/tools/CollisionInspectorV2.spec.mjs --project=playwright --workers=1 --reporter=list` |
| 42 | +- PASS vendor/generated modification check: no `vendor`, bundled, minified, generated, Playwright-report, or test-results paths were modified. |
| 43 | +- Advisory Playwright V8 coverage refreshed in `docs/dev/reports/playwright_v8_coverage_report.txt` and `docs/dev/reports/coverage_changed_js_guardrail.txt`. |
| 44 | + |
| 45 | +## Notes |
| 46 | + |
| 47 | +- `npm run build:manifest` generated `docs/build/sample-manifest.json`; it was removed after validation because it is a generated build artifact outside this PR scope. |
| 48 | +- Full samples smoke test was skipped; this PR is a scoped helper extraction and requested targeted Asteroids/Object Vector/Collision Inspector validation instead. |
0 commit comments