Skip to content

Commit ce45844

Browse files
committed
Gate Controls capture to edit mode and populate controller profiles from devices - PR_26161_024-controls-edit-gated-capture-devices
1 parent ea0ca26 commit ce45844

9 files changed

Lines changed: 1644 additions & 286 deletions

File tree

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# git status --short
2-
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
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
35
M docs_build/dev/reports/playwright_v8_coverage_report.txt
46
M tests/playwright/tools/InputMappingV2Tool.spec.mjs
57
M toolbox/controls/index.html
68
M toolbox/input-mapping-v2/index.html
79
M toolbox/input-mapping-v2/input-mapping-v2.js
8-
?? docs_build/dev/reports/controls-footer-action-object-selection-report.md
10+
?? docs_build/dev/reports/controls-edit-gated-capture-devices-report.md
911

1012
# git ls-files --others --exclude-standard
11-
docs_build/dev/reports/controls-footer-action-object-selection-report.md
13+
docs_build/dev/reports/controls-edit-gated-capture-devices-report.md
1214

1315
# git diff --stat
14-
.../dev/reports/coverage_changed_js_guardrail.txt | 2 +-
15-
.../dev/reports/playwright_v8_coverage_report.txt | 4 +--
16-
tests/playwright/tools/InputMappingV2Tool.spec.mjs | 19 ++++++++------
17-
toolbox/controls/index.html | 30 +++++++++++++---------
18-
toolbox/input-mapping-v2/index.html | 30 +++++++++++++---------
19-
toolbox/input-mapping-v2/input-mapping-v2.js | 27 ++++++++-----------
20-
6 files changed, 61 insertions(+), 51 deletions(-)
16+
docs_build/dev/reports/codex_changed_files.txt | 17 +-
17+
docs_build/dev/reports/codex_review.diff | 713 +++++++++++++--------
18+
.../dev/reports/coverage_changed_js_guardrail.txt | 2 +-
19+
.../dev/reports/playwright_v8_coverage_report.txt | 6 +-
20+
tests/playwright/tools/InputMappingV2Tool.spec.mjs | 125 +++-
21+
toolbox/controls/index.html | 6 +
22+
toolbox/input-mapping-v2/index.html | 6 +
23+
toolbox/input-mapping-v2/input-mapping-v2.js | 129 +++-
24+
8 files changed, 684 insertions(+), 320 deletions(-)

docs_build/dev/reports/codex_review.diff

Lines changed: 1297 additions & 242 deletions
Large diffs are not rendered by default.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# PR_26161_024 Controls Edit-Gated Capture Devices Report
2+
3+
## Branch Validation
4+
- Current branch: `main`
5+
- Expected branch: `main`
6+
- Result: PASS
7+
8+
## Summary
9+
- Changed saved-row Input tokens so non-edit clicks do nothing.
10+
- Changed edit-row Input value clicks so they start capture for the row currently being edited.
11+
- Added a Controller dropdown in the Controller Profile section with Keyboard, Mouse, detected gamepads, and an actionable unknown/unavailable option.
12+
- Device selection pre-populates an unsaved controller profile row for review and explicit Save.
13+
- Preserved footer Action/Object dropdowns, action descriptions, table-first editing, Add Mapping, Cancel, Edit, Trash, State explanation, Devices, Status, DB reload persistence, and Wireframe status.
14+
15+
## Requirement Checklist
16+
| Requirement | Result | Evidence |
17+
| --- | --- | --- |
18+
| Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` first | PASS | Read before edits. |
19+
| Verify branch is `main` before edits | PASS | `git branch --show-current` returned `main`. |
20+
| Continue from PR_26161_023 | PASS | Footer Action/Object dropdowns and Actions reference catalog preserved. |
21+
| Keep Controls status as Wireframe | PASS | Targeted Playwright asserts registry status/release channel remain `wireframe` and not `beta`. |
22+
| Keep Controls data DB-backed through shared DB/mock adapter only | PASS | Mapping and controller profile saves still use `inputRepository`; no browser storage added. |
23+
| Non-edit row Input click does nothing | PASS | Playwright clicks a saved Input token and verifies no edit row opens and DB records remain unchanged. |
24+
| Edit-mode Input click enables capture for that row | PASS | Playwright clicks the edit-row Input value, captures `KeyB`, and saves. |
25+
| Capture updates only the edited row | PASS | Playwright keeps a second `Fire` mapping at `KeyF` while editing only the `Move Left` mapping to `KeyB`. |
26+
| Captured input persists through shared DB/mock adapter | PASS | Playwright reloads and verifies edited `KeyB` and untouched `KeyF` mappings persist. |
27+
| Add Controller dropdown/list for connected devices | PASS | Controller selector renders Keyboard, Mouse, and a detected test gamepad after device refresh. |
28+
| Selecting a device pre-populates Controller Name, Controller ID, and Mapping Profile | PASS | Playwright verifies Keyboard, Mouse, and detected gamepad prefilled values. |
29+
| Do not silently create fake controller data | PASS | Device selection only creates an unsaved edit row; DB controller profile records remain empty until Save. |
30+
| Unknown/unavailable device path is actionable | PASS | Playwright selects the unknown/unavailable option and verifies WARN status with refresh/connect guidance. |
31+
| Preserve footer Action/Object dropdowns | PASS | Existing targeted Playwright checks remain passing. |
32+
| Preserve action descriptions | PASS | Existing targeted Playwright checks all action descriptions remain visible and sorted. |
33+
| Preserve table-first editing, Add Mapping, Cancel, Edit, Trash, State explanation, Devices, Status, reload persistence | PASS | Covered by targeted Controls/Input Mapping Playwright. |
34+
| Avoid sample JSON, auth, production game runtime behavior, unrelated rewrites | PASS | No samples, auth, production runtime, or engine files changed. |
35+
| Keep Theme V2 only; no inline CSS/JS/event handlers | PASS | HTML restriction scan found no inline style/script/event-handler violations. |
36+
37+
## Impacted Lane
38+
- runtime
39+
- recovery/UAT
40+
41+
## Playwright Impacted
42+
- Yes
43+
44+
## Testing Performed
45+
- `node --check toolbox/input-mapping-v2/input-mapping-v2.js` - PASS
46+
- `node --check tests/playwright/tools/InputMappingV2Tool.spec.mjs` - PASS
47+
- `node --check toolbox/input-mapping-v2/input-mapping-api-client.js` - PASS
48+
- `rg -n --pcre2 "<script(?![^>]*\\bsrc=)|<style\\b|\\son[a-z]+=" toolbox/input-mapping-v2/index.html toolbox/controls/index.html` - PASS, no matches
49+
- `git diff --check` - PASS, CRLF warnings only
50+
- `npx playwright test tests/playwright/tools/InputMappingV2Tool.spec.mjs` - PASS, 5 passed
51+
52+
## Playwright Behavior Covered
53+
- Launch/UAT panels still render and Controls remains Wireframe.
54+
- Controller dropdown renders Keyboard, Mouse, and unknown/unavailable choices on initial load.
55+
- Device refresh adds a detected gamepad exposed through `navigator.getGamepads`.
56+
- Keyboard, Mouse, and detected gamepad selections pre-populate controller profile fields without saving records.
57+
- Unknown/unavailable controller selection shows actionable WARN guidance.
58+
- Saved-row Input token clicks do not enter edit mode.
59+
- Edit-row Input value clicks start capture and update only the edited row.
60+
- Captured inputs persist after reload.
61+
- Trash remains the only covered row deletion path.
62+
63+
## V8 Coverage
64+
- Report: `docs_build/dev/reports/playwright_v8_coverage_report.txt`
65+
- Guardrail: `docs_build/dev/reports/coverage_changed_js_guardrail.txt`
66+
- Changed runtime JS covered: `toolbox/input-mapping-v2/input-mapping-v2.js`
67+
- Coverage result: 91% function coverage, 117/128 functions
68+
69+
## Manual Validation Steps
70+
1. Open `/toolbox/input-mapping-v2/index.html`.
71+
2. Confirm Controls status remains Wireframe in the tool display/registry surfaces.
72+
3. Confirm the Controller Profile section contains a Controller dropdown.
73+
4. Confirm Keyboard and Mouse appear in the dropdown before a gamepad is connected.
74+
5. Connect or expose a gamepad, click Refresh Devices, and confirm the detected gamepad appears.
75+
6. Select Keyboard, Mouse, and a gamepad and confirm Controller Name, Controller ID, and Mapping Profile pre-populate before saving.
76+
7. Select the unknown/unavailable option and confirm WARN guidance explains how to connect/refresh/select a detected device.
77+
8. Add two mappings, save, reload, and confirm both persist.
78+
9. Click a saved Input token and confirm it does not open edit mode.
79+
10. Click Edit on one row, click the row Input value, capture a new key, save, reload, and confirm only that row changed.
80+
11. Delete mappings with Trash and confirm no other click path deletes a row.
81+
82+
## Skipped Lanes
83+
- Full samples validation was skipped as required; this PR does not touch sample JSON or sample runtime behavior.
84+
- Full workspace contract lane was skipped because no Project Workspace contract/runtime files changed; workspace return remains covered by the targeted Controls/Input Mapping Playwright spec.
85+
- Engine lane was skipped because no engine runtime behavior changed.
86+
- Auth and production DB lanes were skipped because no auth or production DB behavior changed.
87+
88+
## Runtime Scope Confirmation
89+
- Controls remains Wireframe.
90+
- Controls mapping and controller profile data remain persisted through the shared DB/mock adapter.
91+
- No page-local storage, `localStorage`, or `sessionStorage` source of truth was added.
92+
- No production controller runtime or production game runtime behavior was added.
93+
- No sample JSON alignment, auth behavior, production DB behavior, or unrelated rewrites were added.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ 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-
(91%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 1129/1129; executed functions 105/116
9+
(91%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 1225/1225; executed functions 117/128
1010

1111
Guardrail warnings:
1212
(100%) none - no changed runtime JS coverage warnings

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ 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-
(88%) Toolbox Index - exercised 4 runtime JS files
15+
(89%) 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-
(91%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 1129/1129; executed functions 105/116
20+
(91%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 1225/1225; executed functions 117/128
2121

2222
Files with executed line/function counts where available:
2323
(53%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 10/19
2424
(58%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 603/603; executed functions 30/52
2525
(64%) assets/theme-v2/js/tool-display-mode.js - executed lines 209/209; executed functions 9/14
2626
(75%) toolbox/tool-registry-api-client.js - executed lines 152/152; executed functions 21/28
27-
(91%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 1129/1129; executed functions 105/116
27+
(91%) toolbox/input-mapping-v2/input-mapping-v2.js - executed lines 1225/1225; executed functions 117/128
2828
(100%) toolbox/input-mapping-v2/input-mapping-api-client.js - executed lines 12/12; executed functions 2/2
2929
(100%) toolbox/objects/objects-api-client.js - executed lines 10/10; executed functions 2/2
3030

0 commit comments

Comments
 (0)