Skip to content

Commit 1f60960

Browse files
committed
Implement normalized Controls architecture with player profiles game mappings and defaults - PR_26161_033-controls-normalized-default-input-architecture
1 parent 8407b4a commit 1f60960

14 files changed

Lines changed: 1704 additions & 6438 deletions
Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
# git status --short
2-
M docs_build/dev/reports/codex_changed_files.txt
3-
M docs_build/dev/reports/codex_review.diff
4-
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
2+
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
53
M docs_build/dev/reports/playwright_v8_coverage_report.txt
64
M src/dev-runtime/persistence/mock-db-store.js
75
M src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js
86
M src/engine/input/InputService.js
7+
M src/engine/input/NormalizedInputRegistry.js
8+
M tests/input/NormalizedInputRegistry.test.mjs
9+
M tests/playwright/tools/AdminDbViewer.spec.mjs
910
M tests/playwright/tools/InputMappingV2Tool.spec.mjs
1011
M toolbox/controls/controls.js
1112
M toolbox/controls/index.html
12-
?? docs_build/dev/reports/controls-player-controller-split-report.md
13-
?? src/engine/input/NormalizedInputRegistry.js
14-
?? tests/input/NormalizedInputRegistry.test.mjs
13+
?? docs_build/dev/reports/controls-normalized-default-input-architecture-report.md
1514

1615
# git ls-files --others --exclude-standard
17-
docs_build/dev/reports/controls-player-controller-split-report.md
18-
src/engine/input/NormalizedInputRegistry.js
19-
tests/input/NormalizedInputRegistry.test.mjs
16+
docs_build/dev/reports/controls-normalized-default-input-architecture-report.md
2017

2118
# git diff --stat
22-
docs_build/dev/reports/codex_changed_files.txt | 40 +-
23-
docs_build/dev/reports/codex_review.diff | 3424 +++++++++++++++-----
24-
.../dev/reports/coverage_changed_js_guardrail.txt | 13 +-
25-
.../dev/reports/playwright_v8_coverage_report.txt | 35 +-
26-
src/dev-runtime/persistence/mock-db-store.js | 4 +-
27-
.../input-mapping-mock-repository.js | 16 +-
28-
src/engine/input/InputService.js | 22 +
29-
tests/playwright/tools/InputMappingV2Tool.spec.mjs | 836 +----
30-
toolbox/controls/controls.js | 661 ++--
31-
toolbox/controls/index.html | 58 +-
32-
10 files changed, 3062 insertions(+), 2047 deletions(-)
19+
.../dev/reports/coverage_changed_js_guardrail.txt | 10 +-
20+
.../dev/reports/playwright_v8_coverage_report.txt | 21 ++-
21+
src/dev-runtime/persistence/mock-db-store.js | 6 +-
22+
.../input-mapping-mock-repository.js | 93 +++++-------
23+
src/engine/input/InputService.js | 12 +-
24+
src/engine/input/NormalizedInputRegistry.js | 167 ++++++++++++++++++---
25+
tests/input/NormalizedInputRegistry.test.mjs | 75 +++++++--
26+
tests/playwright/tools/AdminDbViewer.spec.mjs | 10 +-
27+
tests/playwright/tools/InputMappingV2Tool.spec.mjs | 107 +++++++------
28+
toolbox/controls/controls.js | 103 ++++++-------
29+
toolbox/controls/index.html | 30 ++--
30+
11 files changed, 410 insertions(+), 224 deletions(-)

docs_build/dev/reports/codex_review.diff

Lines changed: 1200 additions & 6194 deletions
Large diffs are not rendered by default.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# PR_26161_033 Controls Normalized Default Input Architecture
2+
3+
## Branch Validation
4+
- PASS: Current git branch was verified as `main` before edits.
5+
6+
## Impacted Lane
7+
- Controls / Input Mapping
8+
- `src/engine/input` normalized input helpers
9+
- Shared DB/mock adapter Controls tables
10+
11+
## Playwright Impacted
12+
- Yes.
13+
14+
## Summary
15+
- Renamed the visible Controls sections to `Game Input Mapping` and `Player Input Mapping`.
16+
- Added the normalized input contract used by keyboard, mouse, and gamepad defaults:
17+
- `action.primary`, `action.secondary`, `action.tertiary`, `action.quaternary`
18+
- `action.confirm`, `action.cancel`, `action.start`, `action.select`, `action.pause`
19+
- movement, aim, d-pad, and trigger normalized inputs remain in the same registry.
20+
- Added visible system default fallback profiles:
21+
- `System Default Gamepad`
22+
- `System Default Keyboard/Mouse`
23+
- Documented and tested runtime lookup order:
24+
1. user/player controller profile exact match
25+
2. user/player keyboard/mouse profile
26+
3. system default gamepad profile
27+
4. system default keyboard/mouse profile
28+
5. missing mapping warning
29+
- Replaced Controls persistence ownership with two DB-backed contracts:
30+
- `player_controller_profiles`: player-owned Physical Input -> Normalized Input
31+
- `game_input_mappings`: project-owned Normalized Input -> Game Action
32+
- Confirmed `game_input_mappings` does not store raw physical input, controller name, or controller id.
33+
- Confirmed `player_controller_profiles` does not store game actions or object actions.
34+
35+
## Validation
36+
- PASS: `node --check src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js`
37+
- PASS: `node --check src/dev-runtime/persistence/mock-db-store.js`
38+
- PASS: `node --check src/engine/input/InputService.js`
39+
- PASS: `node --check src/engine/input/NormalizedInputRegistry.js`
40+
- PASS: `node --check toolbox/controls/controls.js`
41+
- PASS: `node --check tests/playwright/tools/InputMappingV2Tool.spec.mjs`
42+
- PASS: `node --check tests/playwright/tools/AdminDbViewer.spec.mjs`
43+
- PASS: `node --check tests/input/NormalizedInputRegistry.test.mjs`
44+
- PASS: `node tests/input/NormalizedInputRegistry.test.mjs`
45+
- PASS: `npx playwright test tests/playwright/tools/InputMappingV2Tool.spec.mjs`
46+
47+
## Extra Check
48+
- PARTIAL: `npx playwright test tests/playwright/tools/AdminDbViewer.spec.mjs`
49+
- Result: 6 passed, 1 failed from unrelated missing asset requests for `assets/theme-v2/images/characters/palette-manager.png`.
50+
- The changed Admin DB Viewer Controls table expectation passed before the unrelated failure.
51+
52+
## Manual Validation Steps
53+
1. Open `/toolbox/controls/index.html`.
54+
2. Confirm the center accordions read `Game Input Mapping` and `Player Input Mapping`.
55+
3. Open Inspector > Devices and confirm the fallback profiles and runtime lookup order are visible.
56+
4. Select `Keyboard/Mouse`, create a player input mapping, and confirm `Space` maps to `action.primary`.
57+
5. Add a Game Input Mapping row from `action.primary` to `Jump`, save, reload, and confirm persistence.
58+
6. Open the mock DB snapshot and confirm game mappings are stored in `game_input_mappings`.
59+
7. Confirm player physical mappings are stored in `player_controller_profiles`.
60+
8. Confirm `game_input_mappings` has no controller id/name or raw physical input fields.
61+
9. Confirm `player_controller_profiles` has no game action/object action fields.
62+
63+
## Skipped Lanes
64+
- Full samples validation was skipped by request.
65+
- Full repository Playwright was not run; targeted Controls/Input Mapping Playwright was the impacted lane.
66+
- `npm run test:workspace-v2` was not run because this PR does not change Workspace V2 behavior.
67+
68+
## Runtime Engine Behavior
69+
- No production game runtime behavior or sample JSON alignment was added.
70+
- `src/engine/input` was extended only for the requested normalized input/default profile contract and lookup helper used by Controls validation.
71+
72+
## Required Artifacts
73+
- `docs_build/dev/reports/codex_review.diff`
74+
- `docs_build/dev/reports/codex_changed_files.txt`
75+
- `docs_build/dev/reports/playwright_v8_coverage_report.txt`
76+
- `tmp/PR_26161_033-controls-normalized-default-input-architecture_delta.zip`

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
88
Changed runtime JS files considered:
99
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1010
(0%) src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
11-
(31%) src/engine/input/InputService.js - executed lines 443/443; executed functions 20/64
12-
(61%) src/engine/input/GamepadInputClassifier.js - executed lines 412/412; executed functions 23/38
13-
(80%) src/engine/input/GamepadState.js - executed lines 100/100; executed functions 16/20
14-
(93%) toolbox/controls/controls.js - executed lines 1417/1417; executed functions 154/165
15-
(100%) src/engine/input/NormalizedInputRegistry.js - executed lines 120/120; executed functions 19/19
11+
(32%) src/engine/input/InputService.js - executed lines 451/451; executed functions 21/66
12+
(93%) toolbox/controls/controls.js - executed lines 1412/1412; executed functions 154/165
13+
(100%) src/engine/input/NormalizedInputRegistry.js - executed lines 242/242; executed functions 26/26
1614

1715
Guardrail warnings:
1816
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file missing from coverage; advisory only
1917
(0%) src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
20-
(31%) src/engine/input/InputService.js - WARNING: advisory low coverage below 50%; executed lines 443/443; executed functions 20/64
18+
(32%) src/engine/input/InputService.js - WARNING: advisory low coverage below 50%; executed lines 451/451; executed functions 21/66

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@ Exercised tool entry points detected:
1919
Changed runtime JS files covered:
2020
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
2121
(0%) src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
22-
(31%) src/engine/input/InputService.js - executed lines 443/443; executed functions 20/64
23-
(61%) src/engine/input/GamepadInputClassifier.js - executed lines 412/412; executed functions 23/38
24-
(80%) src/engine/input/GamepadState.js - executed lines 100/100; executed functions 16/20
25-
(93%) toolbox/controls/controls.js - executed lines 1417/1417; executed functions 154/165
26-
(100%) src/engine/input/NormalizedInputRegistry.js - executed lines 120/120; executed functions 19/19
22+
(32%) src/engine/input/InputService.js - executed lines 451/451; executed functions 21/66
23+
(93%) toolbox/controls/controls.js - executed lines 1412/1412; executed functions 154/165
24+
(100%) src/engine/input/NormalizedInputRegistry.js - executed lines 242/242; executed functions 26/26
2725

2826
Files with executed line/function counts where available:
2927
(11%) src/engine/input/InputMappingManifest.js - executed lines 78/78; executed functions 1/9
3028
(23%) src/engine/input/InputComboState.js - executed lines 173/173; executed functions 3/13
31-
(31%) src/engine/input/InputService.js - executed lines 443/443; executed functions 20/64
29+
(32%) src/engine/input/InputService.js - executed lines 451/451; executed functions 21/66
3230
(33%) src/engine/input/InputMap.js - executed lines 62/62; executed functions 3/9
3331
(40%) src/engine/input/MouseState.js - executed lines 57/57; executed functions 4/10
3432
(43%) src/engine/input/KeyboardState.js - executed lines 34/34; executed functions 3/7
@@ -40,23 +38,22 @@ Files with executed line/function counts where available:
4038
(64%) assets/theme-v2/js/tool-display-mode.js - executed lines 209/209; executed functions 9/14
4139
(75%) toolbox/tool-registry-api-client.js - executed lines 152/152; executed functions 21/28
4240
(80%) src/engine/input/GamepadState.js - executed lines 100/100; executed functions 16/20
43-
(93%) toolbox/controls/controls.js - executed lines 1417/1417; executed functions 154/165
44-
(100%) src/engine/input/NormalizedInputRegistry.js - executed lines 120/120; executed functions 19/19
41+
(93%) toolbox/controls/controls.js - executed lines 1412/1412; executed functions 154/165
42+
(100%) src/engine/input/NormalizedInputRegistry.js - executed lines 242/242; executed functions 26/26
4543
(100%) toolbox/controls/controls-api-client.js - executed lines 12/12; executed functions 2/2
4644
(100%) toolbox/objects/objects-api-client.js - executed lines 10/10; executed functions 2/2
4745

4846
Uncovered or low-coverage changed JS files:
4947
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: uncovered changed runtime JS file; advisory only
5048
(0%) src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js - WARNING: uncovered changed runtime JS file; advisory only
51-
(31%) src/engine/input/InputService.js - WARNING: advisory low coverage; executed lines 443/443
49+
(32%) src/engine/input/InputService.js - WARNING: advisory low coverage; executed lines 451/451
5250

5351
Changed JS files considered:
5452
(0%) src/dev-runtime/persistence/mock-db-store.js - changed JS file not collected as browser runtime coverage
5553
(0%) src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js - changed JS file not collected as browser runtime coverage
5654
(0%) tests/input/NormalizedInputRegistry.test.mjs - changed JS file not collected as browser runtime coverage
55+
(0%) tests/playwright/tools/AdminDbViewer.spec.mjs - changed JS file not collected as browser runtime coverage
5756
(0%) tests/playwright/tools/InputMappingV2Tool.spec.mjs - changed JS file not collected as browser runtime coverage
58-
(31%) src/engine/input/InputService.js - changed JS file with browser V8 coverage
59-
(61%) src/engine/input/GamepadInputClassifier.js - changed JS file with browser V8 coverage
60-
(80%) src/engine/input/GamepadState.js - changed JS file with browser V8 coverage
57+
(32%) src/engine/input/InputService.js - changed JS file with browser V8 coverage
6158
(93%) toolbox/controls/controls.js - changed JS file with browser V8 coverage
6259
(100%) src/engine/input/NormalizedInputRegistry.js - changed JS file with browser V8 coverage

src/dev-runtime/persistence/mock-db-store.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const MOCK_DB_TOOL_GROUPS = Object.freeze({
8989
}),
9090
controls: Object.freeze({
9191
label: "Controls",
92-
tableNames: Object.freeze(["input_mapping_records", "input_controller_profile_records", "input_custom_action_records"]),
92+
tableNames: Object.freeze(["game_input_mappings", "player_controller_profiles", "input_custom_action_records"]),
9393
}),
9494
"project-journey": Object.freeze({
9595
label: "Project Journey",
@@ -136,8 +136,8 @@ const MOCK_DB_TABLE_SCHEMAS = Object.freeze({
136136
game_configuration_records: Object.freeze(["key", "projectKey", "status", "summary", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
137137
game_configuration_validation_items: Object.freeze(["key", "projectKey", "label", "status", "action", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
138138
object_definition_records: Object.freeze(["key", "id", "projectId", "name", "type", "state", "modelType", "renderType", "renderAssetKey", "renderPreviewPath", "capabilities", "behavior", "interaction", "recordOrder", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
139-
input_mapping_records: Object.freeze(["key", "id", "projectId", "objectKey", "objectName", "action", "actionLabel", "normalizedInput", "inputDevice", "source", "binding", "label", "engine", "controllerProfileId", "mappingProfile", "state", "recordOrder", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
140-
input_controller_profile_records: Object.freeze(["key", "id", "projectId", "deviceType", "controllerName", "controllerId", "mappingProfile", "inputs", "actions", "inputMappings", "recordOrder", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
139+
game_input_mappings: Object.freeze(["key", "id", "projectId", "objectKey", "objectName", "gameAction", "gameActionLabel", "normalizedInput", "state", "recordOrder", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
140+
player_controller_profiles: Object.freeze(["key", "id", "playerId", "deviceType", "controllerName", "controllerId", "profileName", "inputs", "inputMappings", "recordOrder", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
141141
input_custom_action_records: Object.freeze(["key", "id", "projectId", "label", "recordOrder", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
142142
project_journey_note_types: Object.freeze(["key", "typeSlug", "name", "seeded", "userExtensible", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
143143
project_journey_notes: Object.freeze(["key", "slug", "projectKey", "ownerKey", "name", "typeKey", "createdAt", "updatedAt", "createdBy", "updatedBy"]),

0 commit comments

Comments
 (0)