Skip to content

Commit debf0c0

Browse files
author
DavidQ
committed
Fix Asset Browser schema for flat manifest assets and sample 1902 preview id - PR 11.97
1 parent 2f615ee commit debf0c0

7 files changed

Lines changed: 216 additions & 12 deletions

File tree

docs/dev/codex_commands.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1-
# Codex Command PR 11.96
1+
# Codex Command - PR 11.97
22

33
Model: GPT-5.4
44
Reasoning: high
55

6-
```bash
7-
codex exec --model gpt-5.4 --reasoning high "Apply PR 11.96. Update the manifest/schema/workspace contract so asset-browser.assets is a flat asset-id map for all asset kinds. Do not restore media. Fix runtime/tool loaders and sample 1902 workspace usage that still expect media. Update schemas. Preserve Asteroids bezel.png/background/font manifest loading. No aliases, no compatibility shims, no fallback data. Add reports under docs/dev/reports and keep targeted validation only."
6+
```text
7+
Run BUILD_PR_LEVEL_11_97_FIX_ASSET_BROWSER_SCHEMA_PROPERLY.
8+
9+
Goal:
10+
Fix the Asset Browser schema to match the flat asset-browser.assets contract and update sample 1902 workspace data accordingly.
11+
12+
Requirements:
13+
- Update tools/schemas/tools/asset-browser.schema.json.
14+
- asset-browser.assets must be a flat map of asset ids to entries.
15+
- Asset ids must follow <kind>.<domain>.<name>, for example image.sample1902.preview.
16+
- Asset entries require path, kind, and source.
17+
- Allow optional stretchOverride.uniformEdgeStretchPx on image.*.bezel asset entries.
18+
- Do not restore nested media.
19+
- Do not remove existing compatibility properties unless proven obsolete.
20+
- Fix sample 1902 preview asset to image.sample1902.preview.
21+
- Search for generic asset-browser asset id preview and fix if found.
22+
- Add/update docs/dev/reports/PR_11_97_schema_validation.md with exact validation results.
23+
- Run targeted validation only; do not run full sample suite.
24+
25+
Return a ZIP artifact at <project folder>/tmp/PR_11_97_FIX_ASSET_BROWSER_SCHEMA_PROPERLY.zip.
826
```

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Flatten asset manifest schema and align sample 1902 workspace loaders - PR 11.96
1+
Fix Asset Browser schema for flat manifest assets and sample 1902 preview id - PR 11.97
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# PR 11.97 Expected Validation Report
2+
3+
Codex must fill this file with actual command outputs.
4+
5+
Required checks:
6+
7+
- Schema JSON parses.
8+
- `asset-browser.assets` exists in schema.
9+
- Asset entries require `path`, `kind`, and `source`.
10+
- Optional `stretchOverride.uniformEdgeStretchPx` is accepted for bezel entries.
11+
- No generic `preview` asset id remains for sample 1902 asset-browser assets.
12+
- `image.sample1902.preview` exists where sample 1902 declares workspace preview assets.
13+
- Nested `media` was not restored as the Asset Browser asset contract.
14+
- Full samples test skipped unless a shared loader/framework was changed; reason must be recorded.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# PR 11.97 Schema Validation
2+
3+
## Scope
4+
Implemented `BUILD_PR_LEVEL_11_97_FIX_ASSET_BROWSER_SCHEMA_PROPERLY` with targeted schema + sample 1902 data updates only.
5+
6+
## Files Changed
7+
- `tools/schemas/tools/asset-browser.schema.json`
8+
- `samples/phase-19/1902/sample.1902.workspace-all-tools.json`
9+
10+
## Contract Fixes Applied
11+
1. `asset-browser.assets` remains a flat map (no nested `media`).
12+
2. Asset id format enforced as `<kind>.<domain>.<name>` using strict key patterns.
13+
3. Asset entry now requires:
14+
- `path`
15+
- `kind`
16+
- `source`
17+
4. `stretchOverride.uniformEdgeStretchPx` remains allowed only for `image.*.bezel` entries.
18+
5. Compatibility payload properties preserved:
19+
- `assetBrowserPreset`
20+
- `approvedAssets`
21+
- `importHubPreset`
22+
6. Sample 1902 preview asset id updated:
23+
- `sample-1902-preview` -> `image.sample1902.preview`
24+
7. Sample 1902 asset-browser workspace preset id normalized to schema pattern:
25+
- `sample-1902-workspace-preset` -> `other.sample1902.workspace-preset`
26+
27+
## Search/Fix Evidence
28+
- Search for stale preview id:
29+
- Command: `rg -n -F "sample-1902-preview" samples tools games tests`
30+
- Result: no matches
31+
- Generic asset-browser id `preview` scan:
32+
- Command: custom JSON scan over repo JSON files for `tools["asset-browser"].assets.preview`
33+
- Result: `NO_GENERIC_PREVIEW_ASSET_ID_FOUND`
34+
35+
## Targeted Validation Commands
36+
1. Strict schema + sample contract validation:
37+
- `node -e "import('./tests/tools/ToolSchemaStrictModeValidation.test.mjs').then(async (m)=>{await m.run(); console.log('ToolSchemaStrictModeValidation: PASS');})"`
38+
- Result: `ToolSchemaStrictModeValidation: PASS`
39+
2. Sample 1902 targeted launch smoke:
40+
- `node ./tests/runtime/LaunchSmokeAllEntries.test.mjs --samples --sample-range=1902-1902 --tools`
41+
- Result: PASS (`19/19`)
42+
3. Sample 1902 asset id pattern check:
43+
- Command: custom JSON check script
44+
- Result:
45+
- `assetKeys=["other.sample1902.workspace-preset","image.sample1902.preview"]`
46+
- `allKeysValid=true`
47+
- `previewEntryExists=true`
48+
49+
## Full Suite
50+
Skipped by design (targeted schema/sample scope only).
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# PR 11.97 - Fix Asset Browser Schema Properly
2+
3+
## Purpose
4+
Update the Asset Browser schema so it matches the current flat manifest contract:
5+
6+
- `asset-browser.assets` is the single source of truth for all asset kinds.
7+
- No nested `media` contract.
8+
- No generic asset keys like `preview`.
9+
- Asset ids must use a predictable namespaced form such as `image.sample1902.preview`, `image.asteroids.bezel`, `font.asteroids.vector-battle`, or `audio.asteroids.fire`.
10+
11+
## Scope
12+
- Update `tools/schemas/tools/asset-browser.schema.json`.
13+
- Add an `assets` property under the asset-browser payload/model where this repo expects Asset Browser payload validation.
14+
- Validate each asset entry requires `path`, `kind`, and `source`.
15+
- Allow optional per-asset fields such as `stretchOverride` for bezel assets.
16+
- Align sample 1902 workspace usage to the flat asset-id model.
17+
- Do not restore `media`.
18+
- Do not move runtime loaders back to nested media.
19+
20+
## Required schema behavior
21+
The schema must accept:
22+
23+
```json
24+
"assets": {
25+
"image.sample1902.preview": {
26+
"path": "/samples/phase-19/1902/assets/images/preview.svg",
27+
"kind": "image",
28+
"source": "workspace-manager"
29+
},
30+
"image.asteroids.bezel": {
31+
"path": "/games/Asteroids/assets/images/bezel.png",
32+
"kind": "image",
33+
"source": "workspace-manager",
34+
"stretchOverride": {
35+
"uniformEdgeStretchPx": 10
36+
}
37+
}
38+
}
39+
```
40+
41+
The schema must reject or flag generic keys such as:
42+
43+
```json
44+
"assets": {
45+
"preview": {}
46+
}
47+
```
48+
49+
## Asset id rule
50+
Use this shape:
51+
52+
```text
53+
<kind>.<domain>.<name>
54+
```
55+
56+
Examples:
57+
58+
```text
59+
image.sample1902.preview
60+
image.asteroids.bezel
61+
image.asteroids.background
62+
font.asteroids.vector-battle
63+
audio.asteroids.fire
64+
```
65+
66+
## Implementation notes for Codex
67+
1. Open `tools/schemas/tools/asset-browser.schema.json`.
68+
2. Add an `assets` property in the correct schema location used by asset-browser payload validation.
69+
3. Define `$defs.assetMap` and `$defs.assetEntry` rather than leaving `assets` as unconstrained `jsonValue`.
70+
4. Keep compatibility fields currently present unless they are explicitly obsolete.
71+
5. Do not remove `assetCatalog`, `assetBrowserPreset`, `approvedAssets`, or `importHubPreset` unless current code proves they are obsolete.
72+
6. Ensure `additionalProperties: false` does not block the new `assets` property.
73+
7. Update sample 1902 manifest/workspace data so its preview uses `image.sample1902.preview`, not `preview`.
74+
8. Search the repo for `"assets": { "preview"` and generic `"preview"` asset ids and fix them if they are Asset Browser asset entries.
75+
76+
## Validation
77+
Run targeted validation only:
78+
79+
```powershell
80+
# Schema parses
81+
Get-Content .\tools\schemas\tools\asset-browser.schema.json | ConvertFrom-Json | Out-Null
82+
83+
# No nested media contract in asset-browser assets
84+
Select-String -Path .\samples\**\*.json, .\games\**\*.json -Pattern '"media"'
85+
86+
# No generic preview asset id under asset-browser.assets
87+
Select-String -Path .\samples\**\*.json, .\games\**\*.json -Pattern '"preview"\s*:'
88+
89+
# Confirm sample 1902 preview asset id
90+
Select-String -Path .\samples\phase-19\1902\*.json -Pattern 'image.sample1902.preview'
91+
```
92+
93+
Do not run the full sample suite unless a shared loader/framework change requires it.
94+
95+
## Acceptance
96+
- Asset Browser schema defines flat `assets`.
97+
- Asset entries require `path`, `kind`, and `source`.
98+
- Bezel `stretchOverride.uniformEdgeStretchPx` is valid only on asset entries such as `image.*.bezel`.
99+
- Sample 1902 uses `image.sample1902.preview`.
100+
- Runtime/tool loaders remain aligned to flat `asset-browser.assets`.
101+
- No `media` restoration.

samples/phase-19/1902/sample.1902.workspace-all-tools.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@
381381
"status": "registered"
382382
},
383383
{
384-
"id": "sample-1902-preview",
384+
"id": "image.sample1902.preview",
385385
"label": "1902 Preview Art",
386386
"type": "image",
387387
"category": "Preview Art",
@@ -533,18 +533,18 @@
533533
"payload": {
534534
"assetBrowserPreset": {
535535
"selectedCategory": "All",
536-
"selectedAssetId": "sample-1902-workspace-preset",
536+
"selectedAssetId": "other.sample1902.workspace-preset",
537537
"search": "",
538538
"importCategory": "Workflow JSON"
539539
}
540540
},
541541
"assets": {
542-
"sample-1902-workspace-preset": {
542+
"other.sample1902.workspace-preset": {
543543
"path": "/samples/phase-19/1902/sample.1902.workspace-all-tools.json",
544544
"kind": "other",
545545
"source": "workspace-manager"
546546
},
547-
"sample-1902-preview": {
547+
"image.sample1902.preview": {
548548
"path": "/samples/phase-19/1902/assets/images/preview.svg",
549549
"kind": "image",
550550
"source": "workspace-manager"

tools/schemas/tools/asset-browser.schema.json

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,33 @@
3030
"type": "object",
3131
"additionalProperties": false,
3232
"patternProperties": {
33-
"^.+$": {
33+
"^image\\.[a-z0-9][a-z0-9-]*\\.bezel$": {
3434
"$ref": "#/$defs/assetEntry"
35+
},
36+
"^(?!image\\.[a-z0-9][a-z0-9-]*\\.bezel$)[a-z][a-z0-9-]*\\.[a-z0-9][a-z0-9-]*\\.[a-z0-9][a-z0-9-]*$": {
37+
"allOf": [
38+
{
39+
"$ref": "#/$defs/assetEntry"
40+
},
41+
{
42+
"not": {
43+
"required": [
44+
"stretchOverride"
45+
]
46+
}
47+
}
48+
]
3549
}
3650
},
3751
"propertyNames": {
38-
"type": "string",
39-
"minLength": 1
52+
"anyOf": [
53+
{
54+
"pattern": "^image\\.[a-z0-9][a-z0-9-]*\\.bezel$"
55+
},
56+
{
57+
"pattern": "^(?!image\\.[a-z0-9][a-z0-9-]*\\.bezel$)[a-z][a-z0-9-]*\\.[a-z0-9][a-z0-9-]*\\.[a-z0-9][a-z0-9-]*$"
58+
}
59+
]
4060
}
4161
},
4262
"payload": {
@@ -61,7 +81,8 @@
6181
"type": "object",
6282
"required": [
6383
"path",
64-
"kind"
84+
"kind",
85+
"source"
6586
],
6687
"additionalProperties": false,
6788
"properties": {

0 commit comments

Comments
 (0)