Skip to content

Commit 8407b4a

Browse files
committed
Split Controls into game mappings and player controller profiles - PR_26161_032-controls-player-controller-split
1 parent d47b80d commit 8407b4a

13 files changed

Lines changed: 6994 additions & 2013 deletions
Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1-
assets/theme-v2/css/typography.css
2-
docs_build/dev/reports/codex_changed_files.txt
3-
docs_build/dev/reports/codex_review.diff
4-
docs_build/dev/reports/controls-engine-input-and-profile-scope-report.md
5-
docs_build/dev/reports/coverage_changed_js_guardrail.txt
6-
docs_build/dev/reports/playwright_v8_coverage_report.txt
7-
src/engine/input/GamepadInputClassifier.js
8-
src/engine/input/GamepadState.js
9-
src/engine/input/InputService.js
10-
tests/playwright/tools/InputMappingV2Tool.spec.mjs
11-
toolbox/controls/controls.js
12-
toolbox/controls/index.html
1+
# 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
5+
M docs_build/dev/reports/playwright_v8_coverage_report.txt
6+
M src/dev-runtime/persistence/mock-db-store.js
7+
M src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js
8+
M src/engine/input/InputService.js
9+
M tests/playwright/tools/InputMappingV2Tool.spec.mjs
10+
M toolbox/controls/controls.js
11+
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
15+
16+
# 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
20+
21+
# 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(-)

docs_build/dev/reports/codex_review.diff

Lines changed: 6227 additions & 796 deletions
Large diffs are not rendered by default.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# PR_26161_032-controls-player-controller-split
2+
3+
## Branch Validation
4+
- Current branch: `main`
5+
- Expected branch: `main`
6+
- Result: PASS
7+
8+
## Impacted Lane
9+
- Tool/runtime lane: Controls / Input Mapping
10+
- Shared engine lane: `src/engine/input` normalization
11+
- Shared DB lane: mock adapter schemas for Controls tables
12+
- Playwright impacted: Yes
13+
14+
## Scope Summary
15+
- Split Controls into visible `Game Controls` and `Player Controller Profiles` sections.
16+
- `Game Controls` now owns normalized-input-to-game-action mappings: `Normalized Input`, `Game Action`, `Object`, `State`.
17+
- `Player Controller Profiles` now owns physical-input-to-normalized-input mappings: `Physical Controller`, `Physical Input`, `Normalized Input`, analog `Deadzone`, analog `Invert`.
18+
- Added shared `src/engine/input/NormalizedInputRegistry.js` for the normalized input registry and default physical-input normalization.
19+
- Exposed normalized input helpers through `InputService`.
20+
- Extended the shared mock DB adapter so game mappings persist `normalizedInput` and player profiles persist `inputMappings`.
21+
22+
## Requirement Checklist
23+
- PASS - Read `docs_build/dev/PROJECT_INSTRUCTIONS.md`.
24+
- PASS - Verified branch is `main` before edits.
25+
- PASS - Continued from PR_26161_031 behavior while changing ownership.
26+
- PASS - Controller normalization is required for current Controls flow.
27+
- PASS - Controls has clear `Game Controls` and `Player Controller Profiles` sections.
28+
- PASS - Game mappings use `Normalized Input`, `Game Action`, `Object`, and `State`.
29+
- PASS - Player profiles use `Physical Controller`, `Physical Input`, `Normalized Input`, `Deadzone`, and `Invert`.
30+
- PASS - Physical controller buttons are not mapped directly to game actions.
31+
- PASS - Physical inputs route through normalized inputs before game actions.
32+
- PASS - Added normalized registry entries: `move.x`, `move.y`, `aim.x`, `aim.y`, `button.south`, `button.east`, `button.west`, `button.north`, `dpad.up`, `dpad.down`, `dpad.left`, `dpad.right`, `trigger.left`, `trigger.right`, `start`, `select`.
33+
- PASS - Controller profile data persists through the shared DB/mock adapter.
34+
- PASS - Game control mapping data persists through the shared DB/mock adapter.
35+
- PASS - Keyboard and Mouse are included in the same normalization model.
36+
- PASS - Missing profile status appears as `Missing Controller Profile` with `Create Player Controller Profile`.
37+
- PASS - Missing game mapping status appears as `Missing Game Control Mapping`.
38+
- PASS - Controls uses `src/engine/input` services/helpers; no direct `navigator.getGamepads` polling is present in `toolbox/controls/controls.js`.
39+
- PASS - Added the smallest shared engine/input extension needed for normalization.
40+
- PASS - Preserved compatible table-first editing, Add, Cancel, Edit, Trash, Reset confirmation, custom actions, object-aware action filtering, DB reload persistence, and deprecated input-mapping-v2 guidance.
41+
- PASS - Did not add sample JSON alignment, auth behavior, production account behavior, or unrelated rewrites.
42+
- PASS - Kept Theme V2 only; no inline CSS, inline JS, script blocks, style blocks, or inline event handlers were added.
43+
44+
## Testing Performed
45+
- PASS - `node --check toolbox/controls/controls.js`
46+
- PASS - `node --check src/engine/input/NormalizedInputRegistry.js`
47+
- PASS - `node --check src/engine/input/InputService.js`
48+
- PASS - `node --check src/dev-runtime/persistence/mock-db-store.js`
49+
- PASS - `node --check src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js`
50+
- PASS - `node --check tests/playwright/tools/InputMappingV2Tool.spec.mjs`
51+
- PASS - `git diff --check -- toolbox/controls/index.html toolbox/controls/controls.js src/engine/input/InputService.js src/engine/input/NormalizedInputRegistry.js src/dev-runtime/persistence/mock-db-store.js src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js tests/input/NormalizedInputRegistry.test.mjs tests/playwright/tools/InputMappingV2Tool.spec.mjs`
52+
- PASS - `node tests/input/NormalizedInputRegistry.test.mjs`
53+
- PASS - `node tests/input/InputService.test.mjs`
54+
- PASS - `npx playwright test tests/playwright/tools/InputMappingV2Tool.spec.mjs --workers=1` (5 passed)
55+
56+
## Playwright Coverage
57+
- PASS - `docs_build/dev/reports/playwright_v8_coverage_report.txt` generated.
58+
- PASS - `toolbox/controls/controls.js` covered at 93%.
59+
- PASS - `src/engine/input/NormalizedInputRegistry.js` covered at 100%.
60+
- WARN - `src/dev-runtime/persistence/mock-db-store.js` and `src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js` are server/dev-runtime files and were not collected by browser V8 coverage.
61+
- WARN - `src/engine/input/InputService.js` has advisory low function coverage, but all executed lines were collected and existing targeted Node validation passed.
62+
63+
## Manual Validation Steps
64+
- Open `/toolbox/controls/index.html`.
65+
- Confirm the center panel shows `Game Controls` and `Player Controller Profiles`.
66+
- In `Game Controls`, add a row with a normalized input such as `move.x`, choose a game action and object, save, reload, and confirm persistence.
67+
- In `Player Controller Profiles`, select Keyboard, Mouse, or a detected gamepad and create a player profile.
68+
- Edit a player profile and confirm physical inputs map only to normalized inputs, with deadzone/invert controls on analog axes.
69+
- Delete/reset records and confirm persistence after reload.
70+
71+
## Skipped Lanes
72+
- Full samples validation: SKIP. Samples are explicitly out of scope for this Controls/input normalization PR.
73+
- Full workspace suite: SKIP. Targeted Controls Playwright covered the changed tool behavior; no sample JSON, auth, or production account changes were made.
74+
- Production runtime/gameplay validation: SKIP. This PR updates Controls authoring data and shared normalization helpers only; no production gameplay runtime integration was added.
75+
76+
## Runtime Behavior
77+
- No sample JSON alignment changed.
78+
- No auth behavior changed.
79+
- No production account behavior changed.
80+
- No unrelated tool ownership changed.
81+
- Engine input was extended only with the normalized registry/helper surface required by this PR.
82+
83+
## Required Artifacts
84+
- PASS - `docs_build/dev/reports/controls-player-controller-split-report.md`
85+
- PASS - `docs_build/dev/reports/codex_review.diff`
86+
- PASS - `docs_build/dev/reports/codex_changed_files.txt`
87+
- PASS - `docs_build/dev/reports/playwright_v8_coverage_report.txt`
88+
- PASS - `tmp/PR_26161_032-controls-player-controller-split_delta.zip`

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ Missing changed runtime JS files are WARN, not FAIL.
66
Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
77

88
Changed runtime JS files considered:
9-
(37%) src/engine/input/InputService.js - executed lines 425/425; executed functions 22/60
10-
(74%) src/engine/input/GamepadInputClassifier.js - executed lines 412/412; executed functions 31/42
9+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10+
(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
1113
(80%) src/engine/input/GamepadState.js - executed lines 100/100; executed functions 16/20
12-
(95%) toolbox/controls/controls.js - executed lines 1684/1684; executed functions 181/190
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
1316

1417
Guardrail warnings:
15-
(37%) src/engine/input/InputService.js - WARNING: advisory low coverage below 50%; executed lines 425/425; executed functions 22/60
18+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file missing from coverage; advisory only
19+
(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

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,51 @@ Note: entry percentages use function coverage when available, otherwise line cov
1212
Note: coverage entries are aggregated across every page/tool where coverageReporter.start(page) and coverageReporter.stop(page) ran.
1313

1414
Exercised tool entry points detected:
15-
(93%) Toolbox Index - exercised 4 runtime JS files
15+
(91%) Toolbox Index - exercised 4 runtime JS files
1616
(0%) Tool Template V2 - not exercised by this Playwright run
1717
(59%) Theme V2 Shared JS - exercised 2 runtime JS files
1818

1919
Changed runtime JS files covered:
20-
(37%) src/engine/input/InputService.js - executed lines 425/425; executed functions 22/60
21-
(74%) src/engine/input/GamepadInputClassifier.js - executed lines 412/412; executed functions 31/42
20+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
21+
(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
2224
(80%) src/engine/input/GamepadState.js - executed lines 100/100; executed functions 16/20
23-
(95%) toolbox/controls/controls.js - executed lines 1684/1684; executed functions 181/190
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
2427

2528
Files with executed line/function counts where available:
2629
(11%) src/engine/input/InputMappingManifest.js - executed lines 78/78; executed functions 1/9
2730
(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
2832
(33%) src/engine/input/InputMap.js - executed lines 62/62; executed functions 3/9
29-
(37%) src/engine/input/InputService.js - executed lines 425/425; executed functions 22/60
3033
(40%) src/engine/input/MouseState.js - executed lines 57/57; executed functions 4/10
3134
(43%) src/engine/input/KeyboardState.js - executed lines 34/34; executed functions 3/7
3235
(53%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 10/19
33-
(57%) src/engine/input/InputCaptureService.js - executed lines 163/163; executed functions 8/14
36+
(53%) src/engine/input/InputCapabilityDescriptors.js - executed lines 261/261; executed functions 8/15
3437
(58%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 603/603; executed functions 30/52
3538
(59%) src/engine/input/PointerDragState.js - executed lines 225/225; executed functions 13/22
39+
(61%) src/engine/input/GamepadInputClassifier.js - executed lines 412/412; executed functions 23/38
3640
(64%) assets/theme-v2/js/tool-display-mode.js - executed lines 209/209; executed functions 9/14
37-
(73%) src/engine/input/InputCapabilityDescriptors.js - executed lines 261/261; executed functions 11/15
38-
(74%) src/engine/input/GamepadInputClassifier.js - executed lines 412/412; executed functions 31/42
3941
(75%) toolbox/tool-registry-api-client.js - executed lines 152/152; executed functions 21/28
4042
(80%) src/engine/input/GamepadState.js - executed lines 100/100; executed functions 16/20
41-
(95%) toolbox/controls/controls.js - executed lines 1684/1684; executed functions 181/190
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
4245
(100%) toolbox/controls/controls-api-client.js - executed lines 12/12; executed functions 2/2
4346
(100%) toolbox/objects/objects-api-client.js - executed lines 10/10; executed functions 2/2
4447

4548
Uncovered or low-coverage changed JS files:
46-
(37%) src/engine/input/InputService.js - WARNING: advisory low coverage; executed lines 425/425
49+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: uncovered changed runtime JS file; advisory only
50+
(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
4752

4853
Changed JS files considered:
54+
(0%) src/dev-runtime/persistence/mock-db-store.js - changed JS file not collected as browser runtime coverage
55+
(0%) src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js - changed JS file not collected as browser runtime coverage
56+
(0%) tests/input/NormalizedInputRegistry.test.mjs - changed JS file not collected as browser runtime coverage
4957
(0%) tests/playwright/tools/InputMappingV2Tool.spec.mjs - changed JS file not collected as browser runtime coverage
50-
(37%) src/engine/input/InputService.js - changed JS file with browser V8 coverage
51-
(74%) src/engine/input/GamepadInputClassifier.js - changed JS file with browser V8 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
5260
(80%) src/engine/input/GamepadState.js - changed JS file with browser V8 coverage
53-
(95%) toolbox/controls/controls.js - changed JS file with browser V8 coverage
61+
(93%) toolbox/controls/controls.js - changed JS file with browser V8 coverage
62+
(100%) src/engine/input/NormalizedInputRegistry.js - changed JS file with browser V8 coverage

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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", "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", "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"]),
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)