|
| 1 | +# PR_26161_016 Controls Input Mapping Rebuild Report |
| 2 | + |
| 3 | +## Branch Validation |
| 4 | + |
| 5 | +PASS |
| 6 | + |
| 7 | +- Current branch: `main` |
| 8 | +- Expected branch: `main` |
| 9 | +- Worktree was clean before PR_26161_016 edits. |
| 10 | + |
| 11 | +## Scope |
| 12 | + |
| 13 | +- Impacted lane: Controls/Input Mapping tool UI/runtime, shared mock DB adapter table registration, local mock API repository routing, Controls metadata launch route, and targeted Playwright coverage. |
| 14 | +- Playwright impacted: Yes. |
| 15 | +- Runtime engine behavior changed: No. |
| 16 | +- Samples validation: Skipped as requested. No sample JSON alignment, auth behavior, production DB behavior, or engine runtime behavior changed. |
| 17 | + |
| 18 | +## Requirement Checklist |
| 19 | + |
| 20 | +- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before edits. |
| 21 | +- PASS: Verified current git branch was `main` before edits. |
| 22 | +- PASS: Reviewed `docs_build/tools/input-mapping-v2/uat.md` before implementation. |
| 23 | +- PASS: Used `archive/v1-v2/tools/old_input-mapping-v2/` as UX/reference only; no legacy CSS, shell, inline patterns, or deprecated structure were copied. |
| 24 | +- PASS: Rebuilt Controls/Input Mapping with current Theme V2 layout and external JavaScript only. |
| 25 | +- PASS: Added `toolbox/input-mapping-v2/index.html` as the UAT launch route. |
| 26 | +- PASS: Replaced the old `toolbox/controls/index.html` wireframe with the rebuilt working surface for compatibility. |
| 27 | +- PASS: Updated Controls metadata/nav launch route to `toolbox/input-mapping-v2/index.html`. |
| 28 | +- PASS: Promoted Controls metadata status to `beta` for the rebuilt DB-backed tool. |
| 29 | +- PASS: Preserved useful old workflow concepts: default actions, keyboard capture, mouse capture, gamepad capture WARN, mapping list, Mapping JSON/status output, and device/source diagnostics. |
| 30 | +- PASS: Implemented table-first mapping input with `Object | Action | Input Device | Input | State | Actions`. |
| 31 | +- PASS: Uses Objects DB records as selectable Object values when available. |
| 32 | +- PASS: Persists mappings through the shared DB/mock adapter via `input_mapping_records`, not page-local-only storage. |
| 33 | +- PASS: Default actions are alphabetically sorted and include movement, confirm/cancel, fire, thrust, rotation, Pause, Select, and Start. |
| 34 | +- PASS: Workspace launch mode shows `Return to Workspace`. |
| 35 | +- PASS: Did not add sample JSON alignment, auth behavior, production DB behavior, or unrelated tool rewrites. |
| 36 | +- PASS: Kept Theme V2 only; no inline CSS, inline JS, script/style blocks, or inline event handlers. |
| 37 | + |
| 38 | +## Testing Performed |
| 39 | + |
| 40 | +- PASS: `node --check toolbox/input-mapping-v2/input-mapping-v2.js` |
| 41 | +- PASS: `node --check toolbox/input-mapping-v2/input-mapping-api-client.js` |
| 42 | +- PASS: `node --check src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js` |
| 43 | +- PASS: `node --check src/dev-runtime/server/mock-api-router.mjs` |
| 44 | +- PASS: `node --check src/dev-runtime/persistence/mock-db-store.js` |
| 45 | +- PASS: `node --check src/dev-runtime/guest-seeds/tool-metadata-inventory.js` |
| 46 | +- PASS: `node --check tests/playwright/tools/InputMappingV2Tool.spec.mjs` |
| 47 | +- PASS: `rg --pcre2 -n '<script(?![^>]*\bsrc=)|<style\b|\son[a-z]+\s*=' toolbox/input-mapping-v2/index.html toolbox/controls/index.html` |
| 48 | + - Expected no matches; command exited with no matches. |
| 49 | +- PASS: `rg -n 'Static wireframe only|Not implemented yet|no database|no runtime behavior|legacy CSS|deprecated structure|session-only|MVP' toolbox/input-mapping-v2/index.html toolbox/controls/index.html toolbox/input-mapping-v2/input-mapping-v2.js` |
| 50 | + - Expected no matches; command exited with no matches. |
| 51 | +- PASS: `git diff --check` |
| 52 | + - Result: PASS. Git reported line-ending normalization warnings only. |
| 53 | +- PASS: `npx playwright test tests/playwright/tools/InputMappingV2Tool.spec.mjs --workers=1 --reporter=line` |
| 54 | + - Result: 3 passed. |
| 55 | + |
| 56 | +## Playwright Behavior Covered |
| 57 | + |
| 58 | +- PASS: UAT launch route `/toolbox/input-mapping-v2/index.html` renders the required panels: Actions, Capture, Mappings, Mapping JSON, Devices, and Status. |
| 59 | +- PASS: Workspace launch query shows `Return to Workspace`. |
| 60 | +- PASS: Mapping table columns are `Object`, `Action`, `Input Device`, `Input`, `State`, and `Actions`. |
| 61 | +- PASS: Default actions are sorted alphabetically and include movement, confirm/cancel, fire, thrust, rotation, Pause, Select, and Start. |
| 62 | +- PASS: Device diagnostics list `InputService + KeyboardState`, `InputService + MouseState`, `InputService + GamepadState + GamepadInputAdapter`, and `GamepadInputAdapter`. |
| 63 | +- PASS: Device refresh updates the status log. |
| 64 | +- PASS: Gamepad capture shows an actionable `WARN` when no live browser gamepad value is available. |
| 65 | +- PASS: Keyboard capture maps `KeyA` to the selected `Move Left` action. |
| 66 | +- PASS: Captured token `Keyboard KeyA` deletes the persisted mapping when clicked. |
| 67 | +- PASS: Objects DB records are available as selectable Object values. |
| 68 | +- PASS: Mapping records persist through the shared DB/mock adapter after reload. |
| 69 | +- PASS: Compatibility route `/toolbox/controls/index.html` uses the rebuilt Input Mapping surface and no longer shows wireframe-only copy. |
| 70 | +- PASS: Controls registry route resolves to `toolbox/input-mapping-v2/index.html` with status `beta`. |
| 71 | + |
| 72 | +## Playwright V8 Coverage |
| 73 | + |
| 74 | +- Report: `docs_build/dev/reports/playwright_v8_coverage_report.txt` |
| 75 | +- Current PR browser runtime JavaScript coverage: |
| 76 | + - `(81%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 700/700; executed functions 64/79` |
| 77 | + - `(100%) toolbox/input-mapping-v2/input-mapping-api-client.js - executed lines 12/12; executed functions 2/2` |
| 78 | +- Advisory WARN entries remain for server/dev-runtime files because Playwright browser V8 coverage does not collect Node-side mock API modules. |
| 79 | +- The report may also list previous `HEAD` changed JS such as Objects files; those are advisory from the coverage helper's HEAD comparison and are not PR_26161_016 worktree changes. |
| 80 | + |
| 81 | +## Manual Validation Steps |
| 82 | + |
| 83 | +1. Open `/toolbox/input-mapping-v2/index.html?workspace=demo-project`. |
| 84 | +2. Confirm `Return to Workspace` is visible. |
| 85 | +3. Confirm Actions, Capture, Mappings, Mapping JSON, Devices, and Status panels appear. |
| 86 | +4. Confirm the default action dropdown is alphabetically sorted and includes Pause, Select, and Start. |
| 87 | +5. Select `Move Left`, click `Capture Keyboard`, press `A`, and confirm `Keyboard KeyA` appears in the mapping table and JSON. |
| 88 | +6. Click the `Keyboard KeyA` token and confirm the mapping is deleted. |
| 89 | +7. Click `Capture Gamepad` with no live gamepad value and confirm the actionable WARN. |
| 90 | +8. Create or seed an Object record, reload Input Mapping, and confirm the Object dropdown includes it. |
| 91 | +9. Reload after saving a mapping and confirm the mapping persists from `input_mapping_records`. |
| 92 | + |
| 93 | +## Skipped Lanes |
| 94 | + |
| 95 | +- Full samples validation: SKIP, explicitly requested and no samples changed. |
| 96 | +- Full workspace/project suite: SKIP, broad Project Workspace behavior was not changed; targeted Playwright validates the UAT launch return action and Controls registry route. |
| 97 | +- Engine runtime tests: SKIP, no `src/engine/input` behavior changed. |
| 98 | +- Auth and production DB validation: SKIP, no auth or production DB behavior changed; shared mock DB adapter wiring was covered by targeted Playwright and syntax checks. |
0 commit comments