Skip to content

Commit 029998c

Browse files
author
DavidQ
committed
Add PowerShell audit for sample JSON references in sample JS - PR 11.45
1 parent 9d87f29 commit 029998c

6 files changed

Lines changed: 338 additions & 60 deletions

docs/dev/codex_commands.md

Lines changed: 32 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,46 @@
11
MODEL: GPT-5.3-codex
2-
REASONING: high
2+
REASONING: medium
33

44
TASK:
5-
Apply PR 11.44.
5+
Apply PR 11.45.
66

7-
Proceed automatically. Do not ask for confirmation.
7+
Add the PowerShell script:
8+
scripts/audit-sample-json-js-references.ps1
89

9-
Use the current repo state and reports from:
10-
- docs/dev/reports/PR_11_41_sample_json_ownership_audit.md
11-
- docs/dev/reports/PR_11_43_cleanup_batch_1.md
12-
- docs/dev/reports/PR_11_43_validation.txt
10+
Purpose:
11+
Recursively walk the samples directory looking for JSON files, then validate each JSON file is referenced by JS files in the same owning sample subtree.
1312

14-
Goal:
15-
Resolve the next smallest safe batch of deferred sample JSON ownership findings.
13+
Owning sample root:
14+
samples/<group>/<sample>/
1615

17-
Batch rules:
18-
- Select 2–4 deferred items only.
19-
- Select items with obvious ownership and low blast radius.
20-
- Prefer sample-local JSON/sample-local executable fixes.
21-
- Preserve sample-to-tool/use-case coverage.
22-
- Do not touch sample 1902 except to confirm exemption.
23-
- If an item becomes ambiguous during inspection, defer it and choose another safe item.
16+
For each:
17+
samples/<group>/<sample>/**/*.json
2418

25-
Allowed actions:
26-
- KEEP + WIRE: JSON belongs to this sample and can be visibly used there.
27-
- MOVE / REHOME: JSON clearly belongs to another sample/tool.
28-
- DELETE: JSON is stale/obsolete and coverage remains elsewhere.
29-
- CREATE / UPDATE CORRECT SAMPLE: needed to preserve coverage.
30-
- DEFER: ownership uncertain.
19+
Scan:
20+
samples/<group>/<sample>/**/*.js
21+
samples/<group>/<sample>/**/*.mjs
22+
samples/<group>/<sample>/**/*.cjs
3123

32-
Hard rules:
33-
- Do not blindly force JSON into a mismatched sample.
34-
- Do not create hidden fallback/default data.
35-
- Do not create decorative JSON.
36-
- Do not run full samples smoke by default.
37-
- Do not undo SVG Asset Studio rename.
38-
- Do not rename tools.
39-
- Do not modify start_of_day folders.
40-
- Do not change shared sample launch infrastructure unless unavoidable.
24+
Check references by:
25+
- JSON filename
26+
- JSON basename
27+
- JSON path relative to sample root with slash styles
4128

42-
Testing policy:
43-
Full samples smoke takes about 20 minutes.
44-
Do NOT run it unless this PR changes shared sample loader/framework or impacts many samples broadly.
29+
Output:
30+
docs/dev/reports/sample_json_js_reference_audit.csv
4531

46-
Run targeted validation only:
47-
- node --check for changed JS files
48-
- targeted sample/tool smoke for changed samples only
32+
Do NOT:
33+
- run full sample smoke
34+
- modify samples
35+
- delete JSON
36+
- change runtime code
4937

50-
If full suite is required, document the reason before running it.
38+
Validation:
39+
Run:
40+
powershell -ExecutionPolicy Bypass -File scripts/audit-sample-json-js-references.ps1
5141

52-
Reports:
53-
Write:
54-
docs/dev/reports/PR_11_44_cleanup_batch_2.md
55-
docs/dev/reports/PR_11_44_validation.txt
42+
Document:
43+
docs/dev/reports/PR_11_45_validation.txt
5644

57-
The cleanup report must include:
58-
- source 11.41 deferred findings used
59-
- items selected
60-
- action taken for each
61-
- files changed
62-
- coverage preserved statement
63-
- sample 1902 exemption confirmed
64-
- deferred items remaining
65-
66-
The validation report must include:
67-
- exact targeted tests run
68-
- full samples smoke skipped/run
69-
- reason for skip/run
70-
- results
71-
72-
Commit comment:
73-
Use docs/dev/commit_comment.txt
45+
Full samples smoke:
46+
Skip. This is a utility script only.

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Resolve second targeted sample JSON ownership cleanup batch - PR 11.44
1+
Add PowerShell audit for sample JSON references in sample JS - PR 11.45
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# PR 11.45 Validation
2+
3+
## Changed Files
4+
- scripts/audit-sample-json-js-references.ps1
5+
6+
## Targeted Tests Run
7+
- powershell -ExecutionPolicy Bypass -File scripts/audit-sample-json-js-references.ps1
8+
9+
## Full Samples Smoke
10+
Skipped.
11+
12+
Reason:
13+
- Utility script only; no runtime/sample behavior changed.
14+
15+
## Result
16+
-
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
"SampleRoot","JsonPath","Referenced","ReferencedBy","Match","Note"
2+
"samples\metadata\samples.index.metadata.json","samples\metadata\samples.index.metadata.json","False","","",""
3+
"samples\phase-02\0201","samples\phase-02\0201\sample.0201.3d-camera-path-editor.json","False","","",""
4+
"samples\phase-02\0202","samples\phase-02\0202\sample.0202.3d-camera-path-editor.json","False","","",""
5+
"samples\phase-02\0204","samples\phase-02\0204\sample.0204.3d-asset-viewer.json","True","sample.0204.asset-browser.json","sample\.0204\.3d-asset-viewer\.json",""
6+
"samples\phase-02\0204","samples\phase-02\0204\sample.0204.asset-browser.json","True","main.js","sample\.0204\.asset-browser\.json",""
7+
"samples\phase-02\0205","samples\phase-02\0205\sample.0205.state-inspector.json","False","","",""
8+
"samples\phase-02\0207","samples\phase-02\0207\sample.0207.palette.json","False","","",""
9+
"samples\phase-02\0207","samples\phase-02\0207\sample.0207.sprite-editor.json","True","AnimationSystemScene.js","sample\.0207\.sprite-editor\.json",""
10+
"samples\phase-02\0208","samples\phase-02\0208\sample.0208.state-inspector.json","False","","",""
11+
"samples\phase-02\0210","samples\phase-02\0210\sample.0210.physics-sandbox.json","False","","",""
12+
"samples\phase-02\0213","samples\phase-02\0213\sample.0213.palette.json","False","","",""
13+
"samples\phase-02\0213","samples\phase-02\0213\sample.0213.sprite-editor.json","True","SpriteRenderLayerScene.js","sample\.0213\.sprite-editor\.json",""
14+
"samples\phase-02\0214","samples\phase-02\0214\sample.0214.palette.json","False","","",""
15+
"samples\phase-02\0214","samples\phase-02\0214\sample.0214.sprite-editor.json","True","AnimationSpriteBindingScene.js","sample\.0214\.sprite-editor\.json",""
16+
"samples\phase-02\0217","samples\phase-02\0217\sample.0217.state-inspector.json","False","","",""
17+
"samples\phase-02\0219","samples\phase-02\0219\sample.0219.palette.json","False","","",""
18+
"samples\phase-02\0219","samples\phase-02\0219\sample.0219.sprite-editor.json","True","SpriteAtlasImageRenderingScene.js","sample\.0219\.sprite-editor\.json",""
19+
"samples\phase-02\0220","samples\phase-02\0220\sample.0220.3d-camera-path-editor.json","False","","",""
20+
"samples\phase-02\0221","samples\phase-02\0221\sample.0221.3d-json-payload-normalizer.json","False","","",""
21+
"samples\phase-02\0221","samples\phase-02\0221\sample.0221.palette.json","False","","",""
22+
"samples\phase-02\0221","samples\phase-02\0221\sample.0221.tile-map-editor.json","True","TilemapSystemScene.js","sample\.0221\.tile-map-editor\.json",""
23+
"samples\phase-02\0221","samples\phase-02\0221\sample.0221.tile-model-converter.json","False","","",""
24+
"samples\phase-02\0221","samples\phase-02\0221\sample-0221-tile-map-editor-document.json","True","sample.0221.tile-model-converter.json","sample-0221-tile-map-editor-document\.json",""
25+
"samples\phase-02\0224","samples\phase-02\0224\sample.0224.palette.json","False","","",""
26+
"samples\phase-02\0224","samples\phase-02\0224\sample.0224.sprite-editor.json","True","TileCameraSpriteSliceScene.js","sample\.0224\.sprite-editor\.json",""
27+
"samples\phase-02\0224","samples\phase-02\0224\sample.0224.tile-map-editor.json","True","TileCameraSpriteSliceScene.js","sample\.0224\.tile-map-editor\.json",""
28+
"samples\phase-02\0224","samples\phase-02\0224\sample-0224-tile-map-editor-document.json","False","","",""
29+
"samples\phase-02\0226","samples\phase-02\0226\sample.0226.skin-editor.json","True","PrimitiveSkinEditorBreakoutReadinessScene.js","sample\.0226\.skin-editor\.json",""
30+
"samples\phase-02\0227","samples\phase-02\0227\sample.0227.skin-editor.json","True","PrimitiveSkinEditorPongReadinessScene.js","sample\.0227\.skin-editor\.json",""
31+
"samples\phase-03\0301","samples\phase-03\0301\sample.0301.palette.json","False","","",""
32+
"samples\phase-03\0301","samples\phase-03\0301\sample.0301.sprite-editor.json","True","RealSpriteRenderingScene.js","sample\.0301\.sprite-editor\.json",""
33+
"samples\phase-03\0302","samples\phase-03\0302\sample.0302.palette.json","False","","",""
34+
"samples\phase-03\0302","samples\phase-03\0302\sample.0302.sprite-editor.json","True","AnimationSystemScene.js","sample\.0302\.sprite-editor\.json",""
35+
"samples\phase-03\0303","samples\phase-03\0303\sample.0303.physics-sandbox.json","False","","",""
36+
"samples\phase-03\0305","samples\phase-03\0305\sample.0305.3d-json-payload-normalizer.json","False","","",""
37+
"samples\phase-03\0305","samples\phase-03\0305\sample.0305.palette.json","False","","",""
38+
"samples\phase-03\0305","samples\phase-03\0305\sample.0305.tile-map-editor.json","True","TileMetadataScene.js","sample\.0305\.tile-map-editor\.json",""
39+
"samples\phase-03\0305","samples\phase-03\0305\sample.0305.tile-model-converter.json","False","","",""
40+
"samples\phase-03\0305","samples\phase-03\0305\sample-0305-tile-map-editor-document.json","True","sample.0305.tile-model-converter.json","sample-0305-tile-map-editor-document\.json",""
41+
"samples\phase-03\0306","samples\phase-03\0306\sample.0306.parallax-editor.json","False","","",""
42+
"samples\phase-03\0308","samples\phase-03\0308\sample.0308.palette.json","False","","",""
43+
"samples\phase-03\0313","samples\phase-03\0313\sample.0313.palette.json","False","","",""
44+
"samples\phase-05\0510","samples\phase-05\0510\sample.0510.asset-pipeline-tool.json","False","","",""
45+
"samples\phase-05\0512","samples\phase-05\0512\sample.0512.performance-profiler.json","False","","",""
46+
"samples\phase-07\0708","samples\phase-07\0708\sample.0708.replay-visualizer.json","False","","",""
47+
"samples\phase-09\0901","samples\phase-09\0901\sample.0901.palette.json","False","","",""
48+
"samples\phase-09\0901","samples\phase-09\0901\sample.0901.svg-asset-studio.json","False","","",""
49+
"samples\phase-09\0901","samples\phase-09\0901\sample.0901.vector-map-editor.json","False","","",""
50+
"samples\phase-09\0905","samples\phase-09\0905\sample.0905.palette.json","False","","",""
51+
"samples\phase-09\0905","samples\phase-09\0905\sample.0905.sprite-editor.json","True","PixelPerfectCollisionScene.js","sample\.0905\.sprite-editor\.json",""
52+
"samples\phase-12\1204","samples\phase-12\1204\sample.1204.palette.json","False","","",""
53+
"samples\phase-12\1204","samples\phase-12\1204\sample.1204.parallax-editor.json","False","","",""
54+
"samples\phase-12\1204","samples\phase-12\1204\sample.1204.svg-asset-studio.json","False","","",""
55+
"samples\phase-12\1204","samples\phase-12\1204\sample.1204.vector-map-editor.json","False","","",""
56+
"samples\phase-12\1205","samples\phase-12\1205\sample.1205.palette.json","False","","",""
57+
"samples\phase-12\1205","samples\phase-12\1205\sample.1205.parallax-editor.json","False","","",""
58+
"samples\phase-12\1205","samples\phase-12\1205\sample.1205.vector-map-editor.json","False","","",""
59+
"samples\phase-12\1208","samples\phase-12\1208\assets\data\tileset\demo1208-terrain-tileset.sprite-editor.json","False","","",""
60+
"samples\phase-12\1208","samples\phase-12\1208\data\toolFormattedParallax.json","False","","",""
61+
"samples\phase-12\1208","samples\phase-12\1208\data\toolFormattedTileMap.json","False","","",""
62+
"samples\phase-12\1208","samples\phase-12\1208\sample.1208.3d-asset-viewer.json","False","","",""
63+
"samples\phase-12\1208","samples\phase-12\1208\sample.1208.3d-json-payload-normalizer.json","False","","",""
64+
"samples\phase-12\1208","samples\phase-12\1208\sample.1208.palette.json","False","","",""
65+
"samples\phase-12\1208","samples\phase-12\1208\sample.1208.parallax-editor.json","True","index.html","sample\.1208\.parallax-editor\.json",""
66+
"samples\phase-12\1208","samples\phase-12\1208\sample.1208.svg-asset-studio.json","True","index.html","sample\.1208\.svg-asset-studio\.json",""
67+
"samples\phase-12\1208","samples\phase-12\1208\sample.1208.tile-map-editor.json","True","index.html","sample\.1208\.tile-map-editor\.json",""
68+
"samples\phase-12\1209","samples\phase-12\1209\sample.1209.palette.json","False","","",""
69+
"samples\phase-12\1209","samples\phase-12\1209\sample.1209.tile-map-editor.json","True","index.html","sample\.1209\.tile-map-editor\.json",""
70+
"samples\phase-12\1209","samples\phase-12\1209\sample.1209.tile-model-converter.json","False","","",""
71+
"samples\phase-12\1209","samples\phase-12\1209\sample-1209-tile-map-editor-document.json","True","sample.1209.tile-model-converter.json","sample-1209-tile-map-editor-document\.json",""
72+
"samples\phase-12\1210","samples\phase-12\1210\sample.1210.palette.json","False","","",""
73+
"samples\phase-12\1210","samples\phase-12\1210\sample.1210.tile-map-editor.json","True","index.html","sample\.1210\.tile-map-editor\.json",""
74+
"samples\phase-12\1210","samples\phase-12\1210\sample-1210-tile-map-editor-document.json","False","","",""
75+
"samples\phase-12\1211","samples\phase-12\1211\sample.1211.palette.json","False","","",""
76+
"samples\phase-12\1211","samples\phase-12\1211\sample.1211.tile-map-editor.json","True","index.html","sample\.1211\.tile-map-editor\.json",""
77+
"samples\phase-12\1211","samples\phase-12\1211\sample-1211-tile-map-editor-document.json","False","","",""
78+
"samples\phase-12\1212","samples\phase-12\1212\sample-1212-vector-map-editor.json","True","index.html","sample-1212-vector-map-editor\.json",""
79+
"samples\phase-12\1213","samples\phase-12\1213\sample-1213-vector-map-editor.json","True","index.html","sample-1213-vector-map-editor\.json",""
80+
"samples\phase-12\1214","samples\phase-12\1214\sample-1214-vector-map-editor.json","True","index.html","sample-1214-vector-map-editor\.json",""
81+
"samples\phase-12\1215","samples\phase-12\1215\sample-1215-svg-asset-studio.json","True","index.html","sample-1215-svg-asset-studio\.json",""
82+
"samples\phase-12\1216","samples\phase-12\1216\sample-1216-svg-asset-studio.json","True","index.html","sample-1216-svg-asset-studio\.json",""
83+
"samples\phase-12\1217","samples\phase-12\1217\sample-1217-svg-asset-studio.json","True","index.html","sample-1217-svg-asset-studio\.json",""
84+
"samples\phase-12\1218","samples\phase-12\1218\sample-1218-parallax-editor.json","True","index.html","sample-1218-parallax-editor\.json",""
85+
"samples\phase-12\1219","samples\phase-12\1219\sample-1219-parallax-editor.json","True","index.html","sample-1219-parallax-editor\.json",""
86+
"samples\phase-12\1220","samples\phase-12\1220\sample-1220-parallax-editor.json","True","index.html","sample-1220-parallax-editor\.json",""
87+
"samples\phase-13\1315","samples\phase-13\1315\sample.1315.replay-visualizer.json","False","","",""
88+
"samples\phase-13\1319","samples\phase-13\1319\sample.1319.performance-profiler.json","False","","",""
89+
"samples\phase-14\1406","samples\phase-14\1406\sample.1406.replay-visualizer.json","False","","",""
90+
"samples\phase-14\1407","samples\phase-14\1407\sample.1407.performance-profiler.json","False","","",""
91+
"samples\phase-14\1413","samples\phase-14\1413\sample.1413.3d-asset-viewer.json","True","sample.1413.asset-browser.json","sample\.1413\.3d-asset-viewer\.json",""
92+
"samples\phase-14\1413","samples\phase-14\1413\sample.1413.asset-browser.json","True","sample.1413.asset-browser.json","sample\.1413\.asset-browser\.json",""
93+
"samples\phase-14\1413","samples\phase-14\1413\sample.1413.asset-pipeline-tool.json","True","main.js","sample\.1413\.asset-pipeline-tool\.json",""
94+
"samples\phase-14\1414","samples\phase-14\1414\sample.1414.palette.json","False","","",""
95+
"samples\phase-14\1414","samples\phase-14\1414\sample.1414.sprite-editor.json","True","TextureSpritePreprocessPipelineScene.js","sample\.1414\.sprite-editor\.json",""
96+
"samples\phase-14\1417","samples\phase-14\1417\sample.1417.asset-pipeline-tool.json","False","","",""
97+
"samples\phase-15\1505","samples\phase-15\1505\sample.1505.asset-browser.json","True","main.js","sample\.1505\.asset-browser\.json",""
98+
"samples\phase-16\1606","samples\phase-16\1606\sample.1606.physics-sandbox.json","False","","",""
99+
"samples\phase-19\1902","samples\phase-19\1902\sample.1902.workspace-all-tools.json","True","main.js","sample\.1902\.workspace-all-tools\.json",""
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# PR 11.45 — Add Sample JSON to JS Reference Audit Script
2+
3+
## Purpose
4+
Add a PowerShell utility that recursively scans sample directories for JSON files and verifies each JSON file is referenced by JavaScript files in the same sample subtree.
5+
6+
## Required Behavior
7+
For each JSON file under `samples/**`:
8+
- resolve the owning sample root as `samples/<group>/<sample>/`
9+
- recursively scan JS files under that sample root
10+
- check whether the JSON filename, basename, or relative path is referenced
11+
- write a CSV report to `docs/dev/reports/sample_json_js_reference_audit.csv`
12+
13+
## Usage
14+
```powershell
15+
powershell -ExecutionPolicy Bypass -File scripts/audit-sample-json-js-references.ps1
16+
```
17+
18+
Optional failure mode:
19+
20+
```powershell
21+
powershell -ExecutionPolicy Bypass -File scripts/audit-sample-json-js-references.ps1 -FailOnMissing
22+
```
23+
24+
## Scope
25+
- Adds script only.
26+
- No sample cleanup in this PR.
27+
- No runtime behavior change.
28+
- No full sample smoke test required.
29+
30+
## Acceptance
31+
- Script runs from repo root.
32+
- CSV report is created.
33+
- Missing references are printed.
34+
- `-FailOnMissing` exits non-zero when unreferenced JSON exists.

0 commit comments

Comments
 (0)