|
| 1 | +# Engine Input Runtime Ownership Completion Report |
| 2 | + |
| 3 | +PR: `PR_26140_118-complete-engine-input-runtime-ownership` |
| 4 | + |
| 5 | +## Summary |
| 6 | +- Extended `InputCaptureSession` into an engine-owned runtime state machine for capture lifecycle, timing lifecycle, combo-visible state, release state, double-click state, drag state, wheel validation, gamepad result handling, and visual complete/cancel reset timing. |
| 7 | +- Added an engine state-change subscription path so Input Mapping V2 renders capture state changes from the engine instead of owning capture timers locally. |
| 8 | +- Rewired `ToolStarterApp.js` to delegate keyboard, mouse, wheel, combo, gamepad, release, double-click, and drag capture sequencing through `InputCaptureSession` runtime methods. |
| 9 | +- Removed remaining tool-local capture timeout, pending double-click timeout, visual-state timer, and gesture-specific sequencing branches where the engine session can own the lifecycle. |
| 10 | +- Preserved existing Input Mapping V2 UI behavior, Action Mapping(s) naming, Workspace Manager V2 launch behavior, and filtered JSON export excluding empty actions. |
| 11 | +- Did not tighten schema `minItems`, and did not touch sample JSON. |
| 12 | + |
| 13 | +## Files Changed |
| 14 | +- `src/engine/input/InputCaptureSession.js` |
| 15 | +- `tools/input-mapping-v2/js/ToolStarterApp.js` |
| 16 | +- `tests/playwright/tools/WorkspaceManagerV2.spec.mjs` |
| 17 | +- `docs/dev/commit_comment.txt` |
| 18 | +- `docs/dev/codex_commands.md` |
| 19 | +- `docs/dev/reports/engine_input_runtime_ownership_completion_report.md` |
| 20 | + |
| 21 | +## Playwright Impact |
| 22 | +- Playwright impacted: Yes. |
| 23 | +- Expected pass behavior: Workspace V2 validation passes while Input Mapping V2 captures keyboard, mouse, wheel, drag, combo, and gamepad inputs through engine runtime paths. |
| 24 | +- Expected fail behavior: tests fail if the tool recreates local capture timers/sequencing, if engine runtime methods do not execute combo/release/hold/double-click/drag flows, if game.manifest discovery breaks, or if exported JSON includes empty actions. |
| 25 | + |
| 26 | +## Runtime Coverage Added/Updated |
| 27 | +- Added in-browser runtime verification for engine-owned capture lifecycle and timeout/visual-reset lifecycle. |
| 28 | +- Added runtime verification for engine-backed combo capture through `InputService` combo state and `InputCaptureSession.handleComboRecord`. |
| 29 | +- Added runtime verification for keyboard release and hold flows through `InputCaptureSession`. |
| 30 | +- Added runtime verification for mouse double-click, wheel validation, drag start/move/release, and pointer drag bounds through engine runtime methods. |
| 31 | +- Added runtime verification for gamepad button press, hold, and release through engine gamepad snapshots and `captureGamepadInput`. |
| 32 | +- Updated the engine ownership assertion to prove the tool subscribes/renders engine session state and no longer contains local capture pending/timeout/visual timer fields. |
| 33 | +- Preserved existing Workspace Manager V2 coverage for active `game.manifest.json` registration, Workspace Manager discovery/runtime load path, and filtered JSON export excluding empty actions. |
| 34 | + |
| 35 | +## Validation |
| 36 | +- PASS: `node --check src/engine/input/InputCaptureSession.js` |
| 37 | +- PASS: `node --check tools/input-mapping-v2/js/ToolStarterApp.js` |
| 38 | +- PASS: `node --check tests/playwright/tools/WorkspaceManagerV2.spec.mjs` |
| 39 | +- PASS: targeted engine import validation with `node --input-type=module`. |
| 40 | +- PASS: focused drag runtime/UI regression check passed 1/1 test. |
| 41 | +- PASS: focused Input Mapping V2 Playwright run passed 12/12 tests. |
| 42 | +- PASS: `npm run test:workspace-v2` passed 71/71 tests. |
| 43 | +- PASS: `git diff --check` reported no whitespace errors. It emitted the existing Windows LF-to-CRLF warning for `tests/playwright/tools/WorkspaceManagerV2.spec.mjs`. |
| 44 | + |
| 45 | +## Coverage Report |
| 46 | +- Browser V8 coverage was generated by the workspace-v2 run. |
| 47 | +- Changed runtime JS coverage lines are present in `docs/dev/reports/playwright_v8_coverage_report.txt`: |
| 48 | + - `(89%) src/engine/input/InputCaptureSession.js - changed JS file with browser V8 coverage` |
| 49 | + - `(94%) tools/input-mapping-v2/js/ToolStarterApp.js - changed JS file with browser V8 coverage` |
| 50 | +- `docs/dev/reports/coverage_changed_js_guardrail.txt` reports no changed runtime JS coverage warnings. |
| 51 | + |
| 52 | +## Manual Test Notes |
| 53 | +1. Open `tools/input-mapping-v2/index.html`. |
| 54 | +2. Add/select an `Action Mapping(s)` tile. |
| 55 | +3. Select `Input Device(s)` and a compatible `Capture Gestures` entry, then capture keyboard release, keyboard combo, mouse double-click, mouse drag release, mouse wheel, and gamepad button release inputs. |
| 56 | +4. Expected result: capture state messages visibly progress through waiting/pending/complete or warning, mappings appear on the selected tile, and invalid gesture/input combinations do not create mappings. |
| 57 | +5. Click JSON or Copy JSON. |
| 58 | +6. Expected result: exported/copied JSON omits actions with empty `inputs` arrays and keeps mapped actions intact. |
| 59 | +7. Open Workspace Manager V2, select Asteroids, and launch Input Mapping V2. |
| 60 | +8. Expected result: Input Mapping V2 is discoverable from the active game manifest and loads through the Workspace Manager runtime path. |
| 61 | + |
| 62 | +## Full Samples Smoke Test |
| 63 | +- Not run, per request and project instructions. This PR is scoped to engine input runtime ownership, Input Mapping V2, and Workspace V2 validation. |
0 commit comments