Skip to content

Commit d43519d

Browse files
committed
Rebuild Controls input mapping from UAT and legacy UX reference - PR_26161_016-controls-input-mapping-rebuild
1 parent ea617a6 commit d43519d

15 files changed

Lines changed: 3411 additions & 184 deletions
Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
# git status --short
22
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
33
M docs_build/dev/reports/playwright_v8_coverage_report.txt
4-
M tests/playwright/tools/ObjectsTool.spec.mjs
5-
M toolbox/objects/index.html
6-
M toolbox/objects/objects.js
7-
?? docs_build/dev/reports/objects-remove-type-choices-report.md
4+
M src/dev-runtime/admin/header-nav.local.html
5+
M src/dev-runtime/guest-seeds/tool-metadata-inventory.js
6+
M src/dev-runtime/persistence/mock-db-store.js
7+
M src/dev-runtime/server/mock-api-router.mjs
8+
M toolbox/controls/index.html
9+
?? docs_build/dev/reports/controls-input-mapping-rebuild-report.md
10+
?? src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js
11+
?? tests/playwright/tools/InputMappingV2Tool.spec.mjs
12+
?? toolbox/input-mapping-v2/
813

914
# git ls-files --others --exclude-standard
10-
docs_build/dev/reports/objects-remove-type-choices-report.md
15+
docs_build/dev/reports/controls-input-mapping-rebuild-report.md
16+
src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js
17+
tests/playwright/tools/InputMappingV2Tool.spec.mjs
18+
toolbox/input-mapping-v2/index.html
19+
toolbox/input-mapping-v2/input-mapping-api-client.js
20+
toolbox/input-mapping-v2/input-mapping-v2.js
1121

1222
# git diff --stat
13-
docs_build/dev/reports/coverage_changed_js_guardrail.txt | 2 +-
14-
docs_build/dev/reports/playwright_v8_coverage_report.txt | 8 ++++----
15-
tests/playwright/tools/ObjectsTool.spec.mjs | 14 +++++++++++---
16-
toolbox/objects/index.html | 7 -------
17-
toolbox/objects/objects.js | 2 +-
18-
5 files changed, 17 insertions(+), 16 deletions(-)
23+
.../dev/reports/coverage_changed_js_guardrail.txt | 11 ++-
24+
.../dev/reports/playwright_v8_coverage_report.txt | 35 ++++----
25+
src/dev-runtime/admin/header-nav.local.html | 2 +-
26+
.../guest-seeds/tool-metadata-inventory.js | 13 +--
27+
src/dev-runtime/persistence/mock-db-store.js | 5 ++
28+
src/dev-runtime/server/mock-api-router.mjs | 20 ++++-
29+
toolbox/controls/index.html | 94 +++++++++++++++++++---
30+
7 files changed, 148 insertions(+), 32 deletions(-)

docs_build/dev/reports/codex_review.diff

Lines changed: 1784 additions & 141 deletions
Large diffs are not rendered by default.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
77

88
Changed runtime JS files considered:
99
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10-
(93%) toolbox/objects/objects.js - executed lines 1107/1107; executed functions 98/105
10+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
11+
(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
12+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
13+
(0%) toolbox/objects/objects.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
14+
(81%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 700/700; executed functions 64/79
15+
(100%) toolbox/input-mapping-v2/input-mapping-api-client.js - executed lines 12/12; executed functions 2/2
1116

1217
Guardrail warnings:
1318
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file missing from coverage; advisory only
19+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file missing from coverage; advisory only
20+
(0%) src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
21+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
22+
(0%) toolbox/objects/objects.js - WARNING: changed runtime JS file missing from coverage; advisory only

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,42 @@ 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-
(85%) Toolbox Index - exercised 6 runtime JS files
15+
(80%) 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:
2020
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
21-
(93%) toolbox/objects/objects.js - executed lines 1107/1107; executed functions 98/105
21+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
22+
(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
23+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
24+
(0%) toolbox/objects/objects.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
25+
(81%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 700/700; executed functions 64/79
26+
(100%) toolbox/input-mapping-v2/input-mapping-api-client.js - executed lines 12/12; executed functions 2/2
2227

2328
Files with executed line/function counts where available:
24-
(33%) src/engine/api/toolbox-votes-api-client.js - executed lines 46/46; executed functions 2/6
25-
(38%) src/engine/api/session-api-client.js - executed lines 34/34; executed functions 3/8
2629
(53%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 10/19
2730
(58%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 603/603; executed functions 30/52
2831
(64%) assets/theme-v2/js/tool-display-mode.js - executed lines 209/209; executed functions 9/14
29-
(67%) src/engine/object-model/objectModelRegistry.js - executed lines 139/139; executed functions 4/6
30-
(67%) toolbox/assets/assets-api-client.js - executed lines 17/17; executed functions 2/3
31-
(70%) src/engine/object-model/objectDefinitionValidator.js - executed lines 360/360; executed functions 16/23
32-
(75%) src/engine/object-model/objectDefinitionSchema.js - executed lines 58/58; executed functions 3/4
33-
(77%) toolbox/tools-page-accordions.js - executed lines 965/965; executed functions 79/103
34-
(86%) toolbox/tool-registry-api-client.js - executed lines 152/152; executed functions 24/28
35-
(93%) toolbox/objects/objects.js - executed lines 1107/1107; executed functions 98/105
36-
(100%) src/engine/object-model/index.js - executed lines 29/29; executed functions 1/1
32+
(75%) toolbox/tool-registry-api-client.js - executed lines 152/152; executed functions 21/28
33+
(81%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 700/700; executed functions 64/79
34+
(100%) toolbox/input-mapping-v2/input-mapping-api-client.js - executed lines 12/12; executed functions 2/2
3735
(100%) toolbox/objects/objects-api-client.js - executed lines 10/10; executed functions 2/2
38-
(100%) toolbox/project-workspace/project-workspace-api-client.js - executed lines 12/12; executed functions 2/2
3936

4037
Uncovered or low-coverage changed JS files:
4138
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: uncovered changed runtime JS file; advisory only
39+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: uncovered changed runtime JS file; advisory only
40+
(0%) src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js - WARNING: uncovered changed runtime JS file; advisory only
41+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: uncovered changed runtime JS file; advisory only
42+
(0%) toolbox/objects/objects.js - WARNING: uncovered changed runtime JS file; advisory only
4243

4344
Changed JS files considered:
4445
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - changed JS file not collected as browser runtime coverage
46+
(0%) src/dev-runtime/persistence/mock-db-store.js - changed JS file not collected as browser runtime coverage
47+
(0%) src/dev-runtime/persistence/tool-repositories/input-mapping-mock-repository.js - changed JS file not collected as browser runtime coverage
48+
(0%) src/dev-runtime/server/mock-api-router.mjs - changed JS file not collected as browser runtime coverage
49+
(0%) tests/playwright/tools/InputMappingV2Tool.spec.mjs - changed JS file not collected as browser runtime coverage
4550
(0%) tests/playwright/tools/ObjectsTool.spec.mjs - changed JS file not collected as browser runtime coverage
46-
(93%) toolbox/objects/objects.js - changed JS file with browser V8 coverage
51+
(0%) toolbox/objects/objects.js - changed JS file not collected as browser runtime coverage
52+
(81%) toolbox/input-mapping-v2/input-mapping-v2.js - changed JS file with browser V8 coverage
53+
(100%) toolbox/input-mapping-v2/input-mapping-api-client.js - changed JS file with browser V8 coverage

src/dev-runtime/admin/header-nav.local.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<div class="nav-item nav-popout-item" data-toolbox-menu-group>
8585
<a data-toolbox-menu-group-label data-route="toolbox" href="toolbox/index.html" aria-haspopup="true">Test &#9656;</a>
8686
<div class="sub-menu sub-menu--nested" data-toolbox-submenu aria-label="Test tools">
87-
<a data-nav-link data-toolbox-menu-item data-route="tool-controls" href="toolbox/controls/index.html">Controls</a>
87+
<a data-nav-link data-toolbox-menu-item data-route="tool-controls" href="toolbox/input-mapping-v2/index.html">Controls</a>
8888
<a data-nav-link data-toolbox-menu-item data-route="debug" href="toolbox/debug/index.html">Debug</a>
8989
<a data-nav-link data-toolbox-menu-item data-route="events" href="toolbox/events/index.html">Events</a>
9090
<a data-nav-link data-toolbox-menu-item data-route="game-testing" href="toolbox/game-testing/index.html">Game Testing</a>

src/dev-runtime/guest-seeds/tool-metadata-inventory.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,9 @@ export const TOOL_REGISTRY = Object.freeze([
716716
"displayName": "Controls",
717717
"shortDescription": "Map keyboard, mouse, gamepad, and touch controls.",
718718
"shortLabel": "Controls",
719-
"path": "controls",
720-
"folderName": "controls",
721-
"entryPoint": "controls/index.html",
719+
"path": "input-mapping-v2",
720+
"folderName": "input-mapping-v2",
721+
"entryPoint": "input-mapping-v2/index.html",
722722
"badge": "/assets/theme-v2/images/badges/controls.png",
723723
"tool": "/assets/theme-v2/images/tools/controls.png",
724724
"description": "Map keyboard, mouse, gamepad, and touch controls.",
@@ -730,10 +730,11 @@ export const TOOL_REGISTRY = Object.freeze([
730730
"requiredForTestable": true,
731731
"requiredForPublish": true,
732732
"requires": [],
733-
"status": "Wireframe",
733+
"status": "beta",
734734
"progressChecklist": [
735-
"Review readiness",
736-
"Static planned text only"
735+
"Map object actions",
736+
"Capture keyboard, mouse, and gamepad inputs",
737+
"Persist mappings through shared DB adapter"
737738
],
738739
"deferred": false,
739740
"hidden": false,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ export const MOCK_DB_TOOL_GROUPS = Object.freeze({
8787
label: "Objects",
8888
tableNames: Object.freeze(["object_definition_records"]),
8989
}),
90+
"input-mapping-v2": Object.freeze({
91+
label: "Input Mapping",
92+
tableNames: Object.freeze(["input_mapping_records"]),
93+
}),
9094
"project-journey": Object.freeze({
9195
label: "Project Journey",
9296
tableNames: Object.freeze([
@@ -132,6 +136,7 @@ const MOCK_DB_TABLE_SCHEMAS = Object.freeze({
132136
game_configuration_records: Object.freeze(["key", "projectKey", "status", "summary", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
133137
game_configuration_validation_items: Object.freeze(["key", "projectKey", "label", "status", "action", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
134138
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", "state", "recordOrder", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
135140
project_journey_note_types: Object.freeze(["key", "typeSlug", "name", "seeded", "userExtensible", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
136141
project_journey_notes: Object.freeze(["key", "slug", "projectKey", "ownerKey", "name", "typeKey", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
137142
project_journey_templates: Object.freeze(["key", "templateSlug", "originalMeaning", "systemGuidance", "linkedToolContexts", "version", "isActive", "createdAt", "updatedAt", "createdBy", "updatedBy"]),

0 commit comments

Comments
 (0)