Skip to content

Commit bd60300

Browse files
author
DavidQ
committed
Complete Asset Manager V2 single picker flow - PR_26126_084
1 parent ffb6c9e commit bd60300

25 files changed

Lines changed: 1935 additions & 381 deletions

docs/dev/PLAN_PR.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ tools/
1818
workspace.manifest.schema.json
1919
tool.manifest.schema.json
2020
palette.schema.json
21-
sample.tool-payload.schema.json
21+
samples/
22+
sample.tool-payload.schema.json
2223
tools/
2324
vector-map-editor.schema.json
2425
vector-asset-studio.schema.json

docs/dev/reports/PR_26126_084_asset_manager_v2_manual_validation_notes.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,29 @@ Date: 2026-05-06
77
- Ran `npm run test:workspace-v2`.
88
- Confirmed Asset Manager V2 tool mode launch through the Playwright workspace-v2 suite.
99
- 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.
10+
- Confirmed the old per-kind file inputs are absent and the single `Pick Asset File` control is present.
11+
- Confirmed kind derivation from selected file extension/MIME type for image and audio files.
12+
- Confirmed role selection is required before Add and restricted to the approved kind's roles.
13+
- Confirmed asset ID assignment includes approved kind, filename slug, and role.
14+
- Confirmed project-root path normalization for selected open-dialog paths.
15+
- Confirmed unsupported file rejection, invalid role schema rejection, and Workspace V2 insertion through Playwright.
1216
- Searched Asset Manager V2 targets for legacy Asset Browser implementation reuse.
13-
- Checked that no sample or game JSON files were modified.
17+
- Kept sample JSON files unmodified; the old sample schema path is a compatibility pointer to the moved canonical schema.
1418

1519
## Results
1620

1721
- `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+
- Tool mode: passed. Asset Manager V2 shows the tool action nav, hides workspace action nav, loads `asset-browser.schema.json`, exposes one picker, derives approved kind, and validates selected files before Add.
23+
- Selected file validation: passed. `nebula-backdrop.png` selected from a project-root path derived `image`, required `background`, assigned `image.assets.nebula-backdrop.background`, normalized `assets/images/nebula-backdrop.png`, validated, and added successfully.
24+
- Picker rejection: passed. `notes.exe` was rejected as an unapproved asset type and Add stayed disabled.
2225
- 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.
26+
- Workspace mode: passed. Workspace V2 launched Asset Manager V2 with `launch=workspace`, inserted `audio.assets.fire.sound` into `tools.asset-browser.assets`, and did not create `asset-manager-v2` or `workspace-v2` manifest entries.
2427
- 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.
2628

2729
## Reports
2830

2931
- `docs/dev/reports/playwright_v8_coverage_report.txt`
3032
- `docs/dev/reports/coverage_changed_js_guardrail.txt`
3133
- `docs/dev/reports/PR_26126_084_asset_manager_v2_schema_validation_notes.md`
34+
- `docs/dev/reports/PR_26126_084_asset_manager_v2_path_normalization_notes.md`
3235
- `docs/dev/reports/PR_26126_084_asset_manager_v2_manual_validation_notes.md`
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# PR_26126_084 Asset Manager V2 Path Normalization Notes
2+
3+
Date: 2026-05-06
4+
5+
## Rule
6+
7+
Selected file paths are normalized to repository-relative asset paths:
8+
9+
```text
10+
HTML-JavaScript-Gaming/assets/audio/fire.wav -> assets/audio/fire.wav
11+
C:\Users\davidq\Documents\GitHub\HTML-JavaScript-Gaming\assets\images\nebula-backdrop.png -> assets/images/nebula-backdrop.png
12+
```
13+
14+
Backslashes are converted to `/`, repeated separators are collapsed, and the `HTML-JavaScript-Gaming` project-root prefix is removed when present.
15+
16+
## Fallback
17+
18+
If the browser does not expose a project-root path, Asset Manager V2 falls back to the derived kind folder and sanitized filename, for example:
19+
20+
```text
21+
assets/images/nebula-backdrop.png
22+
assets/audio/fire.wav
23+
```
24+
25+
## Validation
26+
27+
Playwright validated both a Windows absolute project path and a project-root-prefixed path through the single picker flow. Both resolved to Workspace V2-safe relative paths before schema validation and insertion.

docs/dev/reports/PR_26126_084_asset_manager_v2_schema_validation_notes.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,20 @@ Date: 2026-05-06
44

55
## Schema Changes
66

7+
- Moved the canonical sample wrapper schema to `tools/schemas/samples/sample.tool-payload.schema.json`.
8+
- Kept `tools/schemas/sample.tool-payload.schema.json` as a compatibility `$ref` pointer so existing sample JSON files remain unmodified.
79
- 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`
10+
- Required `role` on asset entries and kept role validation schema-owned through `assetRolesByKind`.
11+
- Kept `stretchOverride` optional and constrained to `image.*.bezel` assets only; generic asset records do not require Stretch.
1712

1813
## Runtime Validation
1914

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.
15+
- Asset Manager V2 uses one `Pick Asset File` control for all asset types.
16+
- File selection derives the approved kind from extension or MIME type before role selection.
17+
- Role selection is required and limited to allowed roles for the derived kind.
18+
- Asset IDs are auto-assigned from derived kind, filename, and selected role.
19+
- Source is always written as `asset-manager-v2`.
20+
- Invalid extensions, unsupported roles, duplicate asset IDs, and schema-invalid JSON are rejected before insertion.
2721

2822
## Workspace Location
2923

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# git status --short
2+
M docs/dev/PLAN_PR.md
3+
M docs/dev/reports/PR_26126_084_asset_manager_v2_manual_validation_notes.md
4+
M docs/dev/reports/PR_26126_084_asset_manager_v2_schema_validation_notes.md
5+
M docs/dev/reports/coverage_changed_js_guardrail.txt
6+
M docs/dev/reports/playwright_v8_coverage_report.txt
7+
M tests/playwright/PreviewGeneratorV2Baseline.spec.mjs
8+
M tests/tools/ToolWorkspaceSchemaManifestBoundaries.test.mjs
9+
M tests/validation/samples.curriculum.validation.json
10+
M tests/validation/samples.runtime.validation.report.json
11+
M tests/validation/samples.shared.boundaries.report.json
12+
M tools/asset-manager-v2/README.md
13+
M tools/asset-manager-v2/index.html
14+
M tools/asset-manager-v2/js/AssetManagerV2App.js
15+
M tools/asset-manager-v2/js/assetManagerMetadata.js
16+
M tools/asset-manager-v2/js/bootstrap.js
17+
M tools/asset-manager-v2/js/controls/AssetFormControl.js
18+
M tools/asset-manager-v2/js/services/AssetSchemaValidator.js
19+
M tools/asset-manager-v2/styles/assetManager.css
20+
M tools/schemas/README.md
21+
M tools/schemas/sample.tool-payload.schema.json
22+
M tools/schemas/tools/asset-browser.schema.json
23+
?? docs/dev/reports/PR_26126_084_asset_manager_v2_path_normalization_notes.md
24+
?? tools/schemas/samples/
25+
26+
# git ls-files --others --exclude-standard
27+
docs/dev/reports/PR_26126_084_asset_manager_v2_path_normalization_notes.md
28+
tools/schemas/samples/sample.tool-payload.schema.json
29+
30+
# git diff --stat
31+
docs/dev/PLAN_PR.md | 3 +-
32+
...084_asset_manager_v2_manual_validation_notes.md | 21 +--
33+
...084_asset_manager_v2_schema_validation_notes.md | 26 ++--
34+
docs/dev/reports/coverage_changed_js_guardrail.txt | 19 +--
35+
docs/dev/reports/playwright_v8_coverage_report.txt | 47 ++-----
36+
.../playwright/PreviewGeneratorV2Baseline.spec.mjs | 134 +++++++++++++------
37+
.../ToolWorkspaceSchemaManifestBoundaries.test.mjs | 2 +-
38+
.../validation/samples.curriculum.validation.json | 2 +-
39+
.../samples.runtime.validation.report.json | 2 +-
40+
.../samples.shared.boundaries.report.json | 2 +-
41+
tools/asset-manager-v2/README.md | 2 +-
42+
tools/asset-manager-v2/index.html | 70 +---------
43+
tools/asset-manager-v2/js/AssetManagerV2App.js | 12 ++
44+
tools/asset-manager-v2/js/assetManagerMetadata.js | 130 ++++++++++++++++++-
45+
tools/asset-manager-v2/js/bootstrap.js | 9 +-
46+
.../js/controls/AssetFormControl.js | 144 +++++++++++++--------
47+
.../js/services/AssetSchemaValidator.js | 15 +--
48+
tools/asset-manager-v2/styles/assetManager.css | 47 ++-----
49+
tools/schemas/README.md | 3 +-
50+
tools/schemas/sample.tool-payload.schema.json | 83 +-----------
51+
tools/schemas/tools/asset-browser.schema.json | 1 +
52+
21 files changed, 393 insertions(+), 381 deletions(-)

0 commit comments

Comments
 (0)