|
| 1 | +# PR_26139_014-shared-transform-service-extraction |
| 2 | + |
| 3 | +## Scope |
| 4 | +- Extracted the finalized object-vector transform pipeline into `ObjectVectorTransformService`. |
| 5 | +- Extracted world/screen scale, runtime object render transform, and inspector user zoom handling into `WorldScreenTransformService`. |
| 6 | +- Kept existing public helper functions as thin compatibility wrappers so Asteroids runtime, Collision Inspector V2, Object Vector Studio V2, and shared collision code continue using shared engine APIs. |
| 7 | +- Preserved Asteroids runtime as the placement/orientation source of truth: runtime object calls still provide world position, radians rotation, and manifest object IDs. |
| 8 | +- Preserved Object Vector Studio V2 editor semantics: editor zoom remains viewport/editor-only, while shared runtime/world scale remains independent. |
| 9 | +- Preserved manifest geometry as the SSoT, intentional ship flame flicker, and intentional asteroid scale tuning. |
| 10 | + |
| 11 | +## Service Ownership |
| 12 | +- `src/engine/rendering/ObjectVectorTransformService.js` |
| 13 | + - Owns local shape point transforms. |
| 14 | + - Owns object origin/pivot handling. |
| 15 | + - Owns manifest shape rotation/scale/translation. |
| 16 | + - Owns runtime instance rotation, scale, and world position transforms. |
| 17 | + - Owns object-vector point/bounds helpers and pipeline creation. |
| 18 | +- `src/engine/rendering/WorldScreenTransformService.js` |
| 19 | + - Owns canonical world-to-screen scale. |
| 20 | + - Owns runtime object render transform application. |
| 21 | + - Owns inspector/user viewport zoom. |
| 22 | + - Owns screen/world/viewport point conversion. |
| 23 | +- `src/engine/rendering/OrientationTransform.js` and `WorldScreenTransform.js` |
| 24 | + - Now act as compatibility wrappers over the service classes. |
| 25 | + |
| 26 | +## Runtime/Tool Alignment |
| 27 | +- Asteroids runtime render path still resolves through `ObjectVectorRuntimeAssetService`, which calls `createWorldScreenTransform(...).applyObjectRenderTransform(...)`. |
| 28 | +- Collision Inspector V2 still renders through the shared engine collision path and uses `applyViewportTransform(...)`; at zoom `1.0`, it matches runtime placement/orientation. |
| 29 | +- Object Vector Studio V2 preview still uses editor viewport zoom only; its transformed point and bounds checks now validate against the service-backed pipeline. |
| 30 | + |
| 31 | +## Validation |
| 32 | +- PASS: `node --check src/engine/rendering/ObjectVectorTransformService.js` |
| 33 | +- PASS: `node --check src/engine/rendering/OrientationTransform.js` |
| 34 | +- PASS: `node --check src/engine/rendering/WorldScreenTransformService.js` |
| 35 | +- PASS: `node --check src/engine/rendering/WorldScreenTransform.js` |
| 36 | +- PASS: `node --check src/engine/rendering/index.js` |
| 37 | +- PASS: `node --check src/engine/rendering/ObjectVectorRuntimeAssetService.js` |
| 38 | +- PASS: `node --check src/engine/collision/objectVector.js` |
| 39 | +- PASS: `node --check tools/collision-inspector-v2/js/CollisionInspectorV2Renderer.js` |
| 40 | +- PASS: `node --check tools/object-vector-studio-v2/js/ToolStarterApp.js` |
| 41 | +- PASS: `node --check tests/playwright/tools/CollisionInspectorV2.spec.mjs` |
| 42 | +- PASS: direct module import/service sanity check for `ObjectVectorTransformService` and `WorldScreenTransformService`. |
| 43 | +- PASS: `npm run build:manifest` |
| 44 | + - Wrote `docs/build/sample-manifest.json`; generated output was removed after validation. |
| 45 | +- PASS: `node --input-type=module -e "import('./tests/games/AsteroidsPresentation.test.mjs').then((module) => module.run())"` |
| 46 | +- PASS: `node --input-type=module -e "import('./tests/final/PrecisionCollisionSystems.test.mjs').then((module) => module.run())"` |
| 47 | +- PASS: `npx playwright test tests/playwright/tools/CollisionInspectorV2.spec.mjs --project=playwright --workers=1 --reporter=list` |
| 48 | + - `4 passed` |
| 49 | + - Validates manifest object loading, runtime/collision placement alignment, bullet/object orientation, Collision Inspector viewport transforms, and Object Vector Studio V2 editor-only zoom against the extracted services. |
| 50 | +- PASS: `npx playwright test tests/playwright/tools/WorkspaceManagerV2.spec.mjs --project=playwright --workers=1 --reporter=list --grep "aligns Object Vector Studio V2 selection bounds to transformed preview geometry"` |
| 51 | + - `1 passed` |
| 52 | + - Validates OVS preview selection bounds still match transformed geometry after service extraction. |
| 53 | +- PASS: `git diff --check` |
| 54 | + - Only line-ending conversion warnings were reported. |
| 55 | +- PASS: Playwright V8 coverage report generated at `docs/dev/reports/playwright_v8_coverage_report.txt`. |
| 56 | + |
| 57 | +## Workspace V2 Gate |
| 58 | +- WARN/FAIL: `npm run test:workspace-v2` |
| 59 | + - Result: `54 passed`, `2 failed`. |
| 60 | + - Failing tests: |
| 61 | + - `validates optional Text to Speech V2 schema contract through Workspace Manager V2 schema` |
| 62 | + - `tracks Object Vector Studio V2 dirty state through persisted edits and save outcomes` |
| 63 | + - These are the same non-transform failures documented in PR_26139_013. The transform-sensitive Workspace Manager V2 / Object Vector Studio V2 selection-bounds test passes. |
| 64 | + |
| 65 | +## Full Samples Smoke Test |
| 66 | +- Skipped. This PR extracts shared transform services and validates the impacted runtime/tool paths directly; it does not broadly change sample loading/framework behavior. |
| 67 | + |
| 68 | +## Manual Test Notes |
| 69 | +- Open `games/Asteroids/index.html`, rotate the ship, fire bullets, and verify ship, bullet, asteroid, and UFO placement/orientation remain visually aligned. |
| 70 | +- Open `tools/collision-inspector-v2/index.html?manifestPath=/games/Asteroids/game.manifest.json`, choose ship/bullet/asteroid/UFO pairs, change rotation and zoom, and verify zoom `1.0` matches runtime placement/orientation. |
| 71 | +- Open Object Vector Studio V2, select/rotate transformed shapes, and verify selection bounds track preview geometry while editor zoom remains viewport-only. |
0 commit comments