|
| 1 | +# PR_26161_031 Controls Engine Input And Profile Scope Report |
| 2 | + |
| 3 | +## Scope |
| 4 | +- Routed Controls keyboard, mouse, wheel, and gamepad detection through shared `src/engine/input` services. |
| 5 | +- Removed local gamepad polling and local gamepad input interpretation from Controls. |
| 6 | +- Removed Mapping Profile from Input Mapping rows. |
| 7 | +- Scoped mappings by `controllerProfileId`: Keyboard/Mouse mappings use the Keyboard/Mouse profile scope, and Gamepad mappings use the selected saved Controller Profile. |
| 8 | +- Relaxed Controller Profile saving so generated inputs may remain unassigned. |
| 9 | + |
| 10 | +## Branch Validation |
| 11 | +- PASS: current branch verified as `main` before edits. |
| 12 | + |
| 13 | +## Impacted Lane |
| 14 | +- Controls / Input Mapping. |
| 15 | +- Shared input helper lane for `src/engine/input`. |
| 16 | + |
| 17 | +## Playwright Impacted |
| 18 | +- Yes. |
| 19 | + |
| 20 | +## Validation Performed |
| 21 | +- PASS: `node --check src/engine/input/GamepadInputClassifier.js` |
| 22 | +- PASS: `node --check src/engine/input/InputService.js` |
| 23 | +- PASS: `node --check src/engine/input/GamepadState.js` |
| 24 | +- PASS: `node --check toolbox/controls/controls.js` |
| 25 | +- PASS: `node --check tests/playwright/tools/InputMappingV2Tool.spec.mjs` |
| 26 | +- PASS: `node tests/input/GamepadState.test.mjs` |
| 27 | +- PASS: `node tests/input/InputService.test.mjs` |
| 28 | +- PASS: `node tests/input/GamepadInputAdapter.test.mjs` |
| 29 | +- PASS: `Select-String -Path toolbox/controls/index.html -Pattern '<style',' onclick=',' onchange=',' oninput=',' onsubmit='` |
| 30 | +- PASS: `git diff --check` |
| 31 | +- PASS: `rg -n "navigator\\.getGamepads|Array\\.from\\(navigator" toolbox/controls/controls.js` returned no matches. |
| 32 | +- PASS: `npx playwright test tests/playwright/tools/InputMappingV2Tool.spec.mjs` |
| 33 | + |
| 34 | +## Manual Validation Steps |
| 35 | +- Open Controls. |
| 36 | +- Confirm Input Mapping table columns are Object, Action, Input Device, Input, State, Actions. |
| 37 | +- Add a Keyboard mapping, capture a key, and confirm the selected input text turns Theme V2 gold while editing. |
| 38 | +- Add a Mouse mapping, capture a mouse button or wheel input, and confirm the selected input text turns Theme V2 gold while editing. |
| 39 | +- Refresh devices with a gamepad available and confirm diagnostics report multiple active controller inputs when multiple inputs are pressed. |
| 40 | +- Add a Controller Profile, edit it, leave generated inputs unassigned, save, and confirm the profile saves without invalid or blocking status. |
| 41 | +- Reopen the profile, assign Actions, press controller inputs, and confirm only selected Action text turns Theme V2 gold. |
| 42 | +- Add a Gamepad mapping after selecting a saved Controller Profile and confirm the saved mapping stores the selected `controllerProfileId` without displaying Mapping Profile in the row. |
| 43 | +- Reload and confirm mappings and profiles persist. |
| 44 | + |
| 45 | +## Shared Input Gap / Extension |
| 46 | +- PASS: Controls needed shared generated controller profile labels and active profile input names. Added the smallest shared extension to `src/engine/input/GamepadInputClassifier.js`. |
| 47 | +- PASS: Controls needed browser gamepad button `value` support through the shared input path. Updated `InputService` and `GamepadState` to treat button value above threshold as active. |
| 48 | +- PASS: No local Controls workaround or duplicate controller polling remains. |
| 49 | + |
| 50 | +## Skipped Lanes |
| 51 | +- Full samples validation skipped by request. |
| 52 | +- Auth, production DB, production game runtime, and sample JSON lanes skipped because this PR only changes Controls UI/runtime behavior plus targeted shared input helpers used by Controls. |
| 53 | +- Broad engine/game validation skipped because the shared input changes were narrow and covered by targeted input unit tests plus Controls Playwright. |
| 54 | + |
| 55 | +## Runtime Engine Behavior |
| 56 | +- PASS: no production game runtime wiring or sample behavior changed. |
| 57 | +- PASS: shared input helpers were extended only to expose existing browser input state to Controls. |
| 58 | + |
| 59 | +## Coverage Notes |
| 60 | +- PASS: Playwright V8 coverage report produced. |
| 61 | +- WARN: `src/engine/input/InputService.js` reports advisory low function coverage in V8 coverage, but changed lines were executed and targeted input unit tests passed. |
| 62 | + |
| 63 | +## Requirement Checklist |
| 64 | +- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before edits. |
| 65 | +- PASS: Verified branch `main` before edits. |
| 66 | +- PASS: Continued from PR_26161_030. |
| 67 | +- PASS: Controls status remains Wireframe. |
| 68 | +- PASS: Controls data remains DB-backed through the shared DB/mock adapter only. |
| 69 | +- PASS: Controller Profile can save with no Action assignments. |
| 70 | +- PASS: Generated controller inputs may remain unassigned. |
| 71 | +- PASS: Unassigned generated inputs display as unassigned, not invalid. |
| 72 | +- PASS: Controls uses `src/engine/input` classes/services for keyboard, mouse, and game controller input detection. |
| 73 | +- PASS: Controls no longer performs duplicate local controller polling or input interpretation. |
| 74 | +- PASS: Missing shared input capability was addressed with the smallest shared input extension. |
| 75 | +- PASS: Multiple simultaneous game controller input states are reported when exposed by `src/engine/input`. |
| 76 | +- PASS: Keyboard selected input text changes to Theme V2 gold during capture/edit. |
| 77 | +- PASS: Mouse button and wheel selected input text changes to Theme V2 gold during capture/edit. |
| 78 | +- PASS: Controller selected Action text remains Theme V2 gold only. |
| 79 | +- PASS: Mapping Profile no longer appears in Input Mapping rows. |
| 80 | +- PASS: Mappings are scoped by selected Controller Profile through `controllerProfileId`. |
| 81 | +- PASS: Keyboard and Mouse mappings use the Keyboard/Mouse profile scope. |
| 82 | +- PASS: Gamepad mappings use the selected saved controller profile scope. |
| 83 | +- PASS: Controller profile generation, device refresh guidance, Create Profile From Default edit mode, custom Actions, accordions, reset confirmation, DB persistence, and object-aware action filtering are preserved. |
| 84 | +- PASS: No sample JSON alignment, auth behavior, production game runtime behavior, or unrelated rewrites were added. |
| 85 | +- PASS: Theme V2 only; no inline CSS, inline JS, script/style blocks, or inline event handlers were added. |
0 commit comments