Skip to content

Commit ffb6c9e

Browse files
author
DavidQ
committed
Add Asset Manager V2 file picker asset controls with role validation - PR_26126_084-asset-manager-v2-file-picker-assets
1 parent 7f34887 commit ffb6c9e

20 files changed

Lines changed: 723 additions & 80 deletions
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# PR_26126_083 Asset Manager V2 Manual Validation Notes
2+
3+
Date: 2026-05-06
4+
5+
## Validation Performed
6+
7+
- Ran `npm run test:workspace-v2`.
8+
- Ran a local Playwright/Chromium computed-style comparison between `tools/templates-v2/index.html` and `tools/asset-manager-v2/index.html`.
9+
- Searched runtime/test/script targets for the removed `tools/schemas/tool.manifest.schema.json` dependency.
10+
- Checked changed files to confirm sample JSON was not modified.
11+
12+
## Results
13+
14+
- `npm run test:workspace-v2`: passed, 10 tests.
15+
- Asset Manager V2 tool mode: passed through the workspace-v2 Playwright test. It loaded the tool menu, hid workspace actions, loaded `asset-browser.schema.json`, added an approved image asset, rejected unsupported `svg` payloads, and cleared status without page errors.
16+
- Asset Manager V2 workspace mode: passed through the workspace-v2 Playwright test. Workspace V2 launched Asset Manager V2 with `launch=workspace`, hid tool actions, showed workspace actions, inserted an approved audio asset into `tools.asset-browser.assets`, and did not create `asset-manager-v2` or `workspace-v2` tool payloads in the workspace manifest.
17+
- Theme parity: passed. Asset Manager V2 body, app shell, panels, accordions, inputs, menu, status clear button, and local shell frame matched Templates V2 computed theme values.
18+
- Schema relocation: passed. The test-only manifest schema now lives at `tests/schemas/tool.manifest.schema.json`, and the boundary test reference points to that path.
19+
- Runtime schema dependency check: passed. No `tests`, `tools`, or `scripts` references to `tools/schemas/tool.manifest.schema.json` remain.
20+
- Asset Browser logic reuse check: passed. Asset Manager V2 continues to use the asset-browser schema/workspace payload key only; no legacy `tools/Asset Browser` implementation is imported or reused.
21+
- Sample JSON check: passed. No sample JSON files were modified.
22+
23+
## Reports
24+
25+
- `docs/dev/reports/playwright_v8_coverage_report.txt`
26+
- `docs/dev/reports/coverage_changed_js_guardrail.txt`
27+
- `docs/dev/reports/PR_26126_083_asset_manager_v2_theme_comparison_notes.md`
28+
- `docs/dev/reports/PR_26126_083_asset_manager_v2_manual_validation_notes.md`
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# PR_26126_083 Asset Manager V2 Theme Comparison Notes
2+
3+
Date: 2026-05-06
4+
5+
## Scope
6+
7+
Compared `tools/asset-manager-v2/index.html` rendered styling against `tools/templates-v2/index.html` after aligning `tools/asset-manager-v2/styles/assetManager.css` with the Templates V2 theme variables and shell structure.
8+
9+
## Method
10+
11+
Used a local Playwright/Chromium pass against the repo test server at 1440x900. The check collected computed styles for these paired elements:
12+
13+
- `body`
14+
- app shell
15+
- left, center, and right panels
16+
- first accordion panel
17+
- representative text input
18+
- status clear button
19+
- tool action menu
20+
- local shell frame
21+
22+
Compared rendered `backgroundImage`, `backgroundColor`, `color`, `borderRadius`, `borderColor`, `boxShadow`, `padding`, `gridTemplateColumns`, `overflow`, and `display`.
23+
24+
## Result
25+
26+
All compared values matched between Asset Manager V2 and Templates V2 for the body and panel theme surfaces.
27+
28+
Confirmed matching rendered values included:
29+
30+
- Body gradient: Templates V2 purple theme gradient matched Asset Manager V2.
31+
- App shell: `20px` radius, matching border color, `0 20px 44px rgba(0, 0, 0, 0.26)` shadow, `340px minmax(0, 1fr) 360px` column structure.
32+
- Panels: matching `rgba(76, 29, 149, 0.88)` surface, `8px` radius, `14px` padding, `auto` overflow.
33+
- Accordions: matching `rgba(43, 16, 91, 0.9)` surface, `8px` radius, shared border color, and `0 14px 30px rgba(0, 0, 0, 0.12)` shadow.
34+
- Inputs: matching `10px` radius, `rgba(43, 16, 91, 0.9)` surface, and `rgb(247, 244, 255)` text.
35+
- Status clear button: matching `10px` radius and Templates V2 button padding.
36+
- Menu: matching panel surface, `8px` radius, `10px` padding, and flex layout.
37+
- Local shell frame: matching gradient, `18px` radius, and Templates V2 frame shadow.
38+
39+
## Notes
40+
41+
The Asset Manager V2 header markup already matched the Templates V2 first-class tool header structure, so the change kept the existing HTML structure and aligned the theme values through CSS.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# PR_26126_084 Asset Manager V2 Manual Validation Notes
2+
3+
Date: 2026-05-06
4+
5+
## Validation Performed
6+
7+
- Ran `npm run test:workspace-v2`.
8+
- Confirmed Asset Manager V2 tool mode launch through the Playwright workspace-v2 suite.
9+
- Confirmed Asset Manager V2 Workspace V2 launch mode through the Playwright workspace-v2 suite.
10+
- Confirmed picker accept filters for image, audio, font, video, shader, data, and localization file inputs.
11+
- Confirmed selected-file schema validation, schema rejection, role validation, and Workspace V2 insertion through Playwright.
12+
- Searched Asset Manager V2 targets for legacy Asset Browser implementation reuse.
13+
- Checked that no sample or game JSON files were modified.
14+
15+
## Results
16+
17+
- `npm run test:workspace-v2`: passed, 10 tests.
18+
- Tool mode: passed. Asset Manager V2 shows the tool action nav, hides workspace action nav, loads `asset-browser.schema.json`, exposes all seven file picker controls, and validates selected files before Add Asset.
19+
- Accept filters: passed. Playwright asserted kind-specific accept filters on image, audio, font, video, shader, data, and localization picker inputs.
20+
- Selected file validation: passed. Image `nebula-backdrop.png` selected with the `background` role derived `image.assets.nebula-backdrop.background`, `assets/images/nebula-backdrop.png`, validated against the schema, and added successfully.
21+
- Picker rejection: passed. `notes.txt` selected through the image picker was rejected and Add Asset stayed disabled.
22+
- Role validation: passed. A JSON payload with an audio asset using the image-only `background` role was rejected.
23+
- Workspace mode: passed. Workspace V2 launched Asset Manager V2 with `launch=workspace`, inserted the selected audio asset into `tools.asset-browser.assets`, and did not create `asset-manager-v2` or `workspace-v2` manifest entries.
24+
- Asset Browser reuse check: passed. No legacy Asset Browser implementation imports or app references were added.
25+
- Sample JSON check: passed. No sample or game JSON files were modified.
26+
27+
## Reports
28+
29+
- `docs/dev/reports/playwright_v8_coverage_report.txt`
30+
- `docs/dev/reports/coverage_changed_js_guardrail.txt`
31+
- `docs/dev/reports/PR_26126_084_asset_manager_v2_schema_validation_notes.md`
32+
- `docs/dev/reports/PR_26126_084_asset_manager_v2_manual_validation_notes.md`
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# PR_26126_084 Asset Manager V2 Schema Validation Notes
2+
3+
Date: 2026-05-06
4+
5+
## Schema Changes
6+
7+
- Expanded `tools/schemas/tools/asset-browser.schema.json` asset id patterns and `kind` enum to include `image`, `audio`, `font`, `video`, `shader`, `data`, and `localization`.
8+
- Added optional `role` to asset entries.
9+
- Added schema-owned `assetRolesByKind` rules consumed by Asset Manager V2 validation:
10+
- image: `sprite`, `background`, `bezel`, `ui`
11+
- audio: `sound`, `music`
12+
- font: `ui`, `display`
13+
- video: `cutscene`, `loop`
14+
- shader: `fragment`, `vertex`, `compute`
15+
- data: `config`, `table`
16+
- localization: `strings`, `dialogue`
17+
18+
## Runtime Validation
19+
20+
- Asset Manager V2 loads allowed kinds, roles, and role-by-kind rules from `asset-browser.schema.json`.
21+
- File selection derives a path and asset id, then validates the selected file entry through `AssetSchemaValidator.validateFileSelection()`.
22+
- The selected file entry is also validated as an `assets` payload before the Add Asset button can persist it.
23+
- Invalid picker selections are blocked before insertion. Example covered by Playwright: `notes.txt` selected through the image picker is rejected by accept validation.
24+
- Invalid role combinations are rejected by schema-backed validation. Example covered by Playwright: `role: "background"` on an audio asset is rejected.
25+
- Image `bezel` role requires an `image.*.bezel` asset id.
26+
- `stretchOverride` remains allowed only on `image.*.bezel` assets.
27+
28+
## Workspace Location
29+
30+
Validated assets are inserted only into the Workspace V2 asset schema location:
31+
32+
```text
33+
workspaceManifest.tools["asset-browser"].assets
34+
```
35+
36+
No `asset-manager-v2` or `workspace-v2` tool payload is written into the Workspace V2 manifest.

docs/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@ Source: Playwright/Chromium built-in V8 coverage from npm run test:workspace-v2.
77

88
Changed runtime JS files considered:
99
(50%) tools/toolRegistry.js - executed lines 448/448; executed functions 4/8
10-
(59%) tools/asset-manager-v2/js/AssetManagerV2App.js - executed lines 273/273; executed functions 19/32
10+
(62%) tools/asset-manager-v2/js/AssetManagerV2App.js - executed lines 301/301; executed functions 21/34
1111
(67%) tools/asset-manager-v2/js/controls/AssetManagerShellControl.js - executed lines 100/100; executed functions 8/12
1212
(80%) tools/asset-manager-v2/js/controls/AccordionSection.js - executed lines 27/27; executed functions 4/5
13-
(86%) tools/asset-manager-v2/js/controls/AssetCatalogControl.js - executed lines 50/50; executed functions 6/7
13+
(86%) tools/asset-manager-v2/js/controls/AssetCatalogControl.js - executed lines 51/51; executed functions 6/7
14+
(92%) tools/asset-manager-v2/js/assetManagerMetadata.js - executed lines 106/106; executed functions 12/13
1415
(93%) tools/workspace-v2/index.js - executed lines 104/104; executed functions 14/15
15-
(100%) tools/asset-manager-v2/js/bootstrap.js - executed lines 59/59; executed functions 4/4
16+
(100%) tools/asset-manager-v2/js/bootstrap.js - executed lines 62/62; executed functions 4/4
1617
(100%) tools/asset-manager-v2/js/controls/ActionNavControl.js - executed lines 52/52; executed functions 6/6
17-
(100%) tools/asset-manager-v2/js/controls/AssetFormControl.js - executed lines 60/60; executed functions 14/14
18+
(100%) tools/asset-manager-v2/js/controls/AssetFormControl.js - executed lines 150/150; executed functions 26/26
1819
(100%) tools/asset-manager-v2/js/controls/InspectorControl.js - executed lines 8/8; executed functions 3/3
1920
(100%) tools/asset-manager-v2/js/controls/StatusLogControl.js - executed lines 30/30; executed functions 9/9
20-
(100%) tools/asset-manager-v2/js/services/AssetSchemaValidator.js - executed lines 145/145; executed functions 17/17
21+
(100%) tools/asset-manager-v2/js/services/AssetSchemaValidator.js - executed lines 186/186; executed functions 21/21
2122
(100%) tools/asset-manager-v2/js/services/WorkspaceBridge.js - executed lines 85/85; executed functions 10/10
2223
(100%) tools/renderToolsIndex.js - executed lines 166/166; executed functions 25/25
2324

docs/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,26 @@ Note: coverage entries are aggregated across every page/tool where coverageRepor
1313

1414
Exercised tool entry points detected:
1515
(87%) Preview Generator V2 - exercised 19 runtime JS files
16-
(84%) Asset Manager V2 - exercised 11 runtime JS files
16+
(87%) Asset Manager V2 - exercised 12 runtime JS files
1717
(49%) Palette Manager - exercised 12 runtime JS files
1818
(84%) Tool Template V2 - exercised 10 runtime JS files
1919
(93%) Workspace V2 - exercised 1 runtime JS files
2020
(0%) Workspace Manager - not exercised by this Playwright run
2121

2222
Changed runtime JS files covered:
2323
(50%) tools/toolRegistry.js - executed lines 448/448; executed functions 4/8
24-
(59%) tools/asset-manager-v2/js/AssetManagerV2App.js - executed lines 273/273; executed functions 19/32
24+
(62%) tools/asset-manager-v2/js/AssetManagerV2App.js - executed lines 301/301; executed functions 21/34
2525
(67%) tools/asset-manager-v2/js/controls/AssetManagerShellControl.js - executed lines 100/100; executed functions 8/12
2626
(80%) tools/asset-manager-v2/js/controls/AccordionSection.js - executed lines 27/27; executed functions 4/5
27-
(86%) tools/asset-manager-v2/js/controls/AssetCatalogControl.js - executed lines 50/50; executed functions 6/7
27+
(86%) tools/asset-manager-v2/js/controls/AssetCatalogControl.js - executed lines 51/51; executed functions 6/7
28+
(92%) tools/asset-manager-v2/js/assetManagerMetadata.js - executed lines 106/106; executed functions 12/13
2829
(93%) tools/workspace-v2/index.js - executed lines 104/104; executed functions 14/15
29-
(100%) tools/asset-manager-v2/js/bootstrap.js - executed lines 59/59; executed functions 4/4
30+
(100%) tools/asset-manager-v2/js/bootstrap.js - executed lines 62/62; executed functions 4/4
3031
(100%) tools/asset-manager-v2/js/controls/ActionNavControl.js - executed lines 52/52; executed functions 6/6
31-
(100%) tools/asset-manager-v2/js/controls/AssetFormControl.js - executed lines 60/60; executed functions 14/14
32+
(100%) tools/asset-manager-v2/js/controls/AssetFormControl.js - executed lines 150/150; executed functions 26/26
3233
(100%) tools/asset-manager-v2/js/controls/InspectorControl.js - executed lines 8/8; executed functions 3/3
3334
(100%) tools/asset-manager-v2/js/controls/StatusLogControl.js - executed lines 30/30; executed functions 9/9
34-
(100%) tools/asset-manager-v2/js/services/AssetSchemaValidator.js - executed lines 145/145; executed functions 17/17
35+
(100%) tools/asset-manager-v2/js/services/AssetSchemaValidator.js - executed lines 186/186; executed functions 21/21
3536
(100%) tools/asset-manager-v2/js/services/WorkspaceBridge.js - executed lines 85/85; executed functions 10/10
3637
(100%) tools/renderToolsIndex.js - executed lines 166/166; executed functions 25/25
3738

@@ -120,9 +121,9 @@ Files with executed line/function counts where available:
120121
(56%) tools/palette-manager-v2/modules/paletteUtils.js - executed lines 41/41; executed functions 5/9
121122
(57%) src/engine/input/KeyboardState.js - executed lines 34/34; executed functions 4/7
122123
(57%) src/engine/runtime/FullscreenService.js - executed lines 118/118; executed functions 8/14
123-
(59%) tools/asset-manager-v2/js/AssetManagerV2App.js - executed lines 273/273; executed functions 19/32
124124
(60%) src/engine/persistence/StorageService.js - executed lines 49/49; executed functions 3/5
125125
(61%) src/engine/runtime/gameImageConvention.js - executed lines 207/207; executed functions 11/18
126+
(62%) tools/asset-manager-v2/js/AssetManagerV2App.js - executed lines 301/301; executed functions 21/34
126127
(65%) tools/palette-manager-v2/controls/SourcePaletteBrowserControl.js - executed lines 121/121; executed functions 15/23
127128
(67%) src/shared/number/numberUtils.js - executed lines 14/14; executed functions 2/3
128129
(67%) tools/asset-manager-v2/js/controls/AssetManagerShellControl.js - executed lines 100/100; executed functions 8/12
@@ -137,11 +138,12 @@ Files with executed line/function counts where available:
137138
(80%) src/engine/theme/accordionV2/accordionV2.js - executed lines 26/26; executed functions 4/5
138139
(80%) tools/asset-manager-v2/js/controls/AccordionSection.js - executed lines 27/27; executed functions 4/5
139140
(82%) samples/shared/sampleDetailPageEnhancement.js - executed lines 471/471; executed functions 41/50
140-
(86%) tools/asset-manager-v2/js/controls/AssetCatalogControl.js - executed lines 50/50; executed functions 6/7
141+
(86%) tools/asset-manager-v2/js/controls/AssetCatalogControl.js - executed lines 51/51; executed functions 6/7
141142
(86%) tools/templates-v2/js/controls/StatusLogControl.js - executed lines 24/24; executed functions 6/7
142143
(87%) tools/common/PaletteSortService.js - executed lines 103/103; executed functions 13/15
143144
(88%) tools/templates-v2/js/controls/SourceInputControl.js - executed lines 33/33; executed functions 7/8
144145
(90%) tools/preview-generator-v2/PreviewGeneratorV2App.js - executed lines 539/539; executed functions 52/58
146+
(92%) tools/asset-manager-v2/js/assetManagerMetadata.js - executed lines 106/106; executed functions 12/13
145147
(92%) tools/templates-v2/js/controls/ToolStarterShellControl.js - executed lines 111/111; executed functions 11/12
146148
(93%) tools/workspace-v2/index.js - executed lines 104/104; executed functions 14/15
147149
(100%) samples/phase-01/0102/KeyboardMoveScene.js - executed lines 78/78; executed functions 6/6
@@ -171,12 +173,12 @@ Files with executed line/function counts where available:
171173
(100%) src/shared/string/stringUtil.js - executed lines 1/1; executed functions 1/1
172174
(100%) src/shared/utils/invariantUtils.js - executed lines 11/11; executed functions 2/2
173175
(100%) src/shared/utils/stringUtils.js - executed lines 1/1; executed functions 1/1
174-
(100%) tools/asset-manager-v2/js/bootstrap.js - executed lines 59/59; executed functions 4/4
176+
(100%) tools/asset-manager-v2/js/bootstrap.js - executed lines 62/62; executed functions 4/4
175177
(100%) tools/asset-manager-v2/js/controls/ActionNavControl.js - executed lines 52/52; executed functions 6/6
176-
(100%) tools/asset-manager-v2/js/controls/AssetFormControl.js - executed lines 60/60; executed functions 14/14
178+
(100%) tools/asset-manager-v2/js/controls/AssetFormControl.js - executed lines 150/150; executed functions 26/26
177179
(100%) tools/asset-manager-v2/js/controls/InspectorControl.js - executed lines 8/8; executed functions 3/3
178180
(100%) tools/asset-manager-v2/js/controls/StatusLogControl.js - executed lines 30/30; executed functions 9/9
179-
(100%) tools/asset-manager-v2/js/services/AssetSchemaValidator.js - executed lines 145/145; executed functions 17/17
181+
(100%) tools/asset-manager-v2/js/services/AssetSchemaValidator.js - executed lines 186/186; executed functions 21/21
180182
(100%) tools/asset-manager-v2/js/services/WorkspaceBridge.js - executed lines 85/85; executed functions 10/10
181183
(100%) tools/preview-generator-v2/controls/AccordionSection.js - executed lines 31/31; executed functions 5/5
182184
(100%) tools/preview-generator-v2/controls/AssetFolderControl.js - executed lines 17/17; executed functions 5/5
@@ -208,13 +210,16 @@ Uncovered or low-coverage changed JS files:
208210

209211
Changed JS files considered:
210212
(0%) scripts/validate-json-contracts.mjs - changed JS file not collected as browser runtime coverage
213+
(0%) scripts/write-codex-review-artifacts.mjs - changed JS file not collected as browser runtime coverage
211214
(0%) tests/helpers/playwrightV8CoverageReporter.mjs - changed JS file not collected as browser runtime coverage
212215
(0%) tests/playwright/PreviewGeneratorV2Baseline.spec.mjs - changed JS file not collected as browser runtime coverage
216+
(0%) tests/tools/ToolWorkspaceSchemaManifestBoundaries.test.mjs - changed JS file not collected as browser runtime coverage
213217
(50%) tools/toolRegistry.js - changed JS file with browser V8 coverage
214-
(59%) tools/asset-manager-v2/js/AssetManagerV2App.js - changed JS file with browser V8 coverage
218+
(62%) tools/asset-manager-v2/js/AssetManagerV2App.js - changed JS file with browser V8 coverage
215219
(67%) tools/asset-manager-v2/js/controls/AssetManagerShellControl.js - changed JS file with browser V8 coverage
216220
(80%) tools/asset-manager-v2/js/controls/AccordionSection.js - changed JS file with browser V8 coverage
217221
(86%) tools/asset-manager-v2/js/controls/AssetCatalogControl.js - changed JS file with browser V8 coverage
222+
(92%) tools/asset-manager-v2/js/assetManagerMetadata.js - changed JS file with browser V8 coverage
218223
(93%) tools/workspace-v2/index.js - changed JS file with browser V8 coverage
219224
(100%) tools/asset-manager-v2/js/bootstrap.js - changed JS file with browser V8 coverage
220225
(100%) tools/asset-manager-v2/js/controls/ActionNavControl.js - changed JS file with browser V8 coverage

0 commit comments

Comments
 (0)