|
| 1 | +PR 11.110 - Schema-only validation boundary enforcement |
| 2 | + |
| 3 | +Purpose implemented: |
| 4 | +- Tool sample preset JSON is validated against the tool schema at load-time. |
| 5 | +- Schema failures now surface as visible on-screen load errors through existing status-text paths. |
| 6 | + |
| 7 | +Validation path changes: |
| 8 | +1) Added shared schema-only validator |
| 9 | +- tools/shared/schemaOnlyToolPresetValidation.js |
| 10 | + - Loads canonical schema by tool id: /tools/schemas/tools/<toolId>.schema.json |
| 11 | + - Validates loaded JSON value against schema (strict object/array/type/required/additionalProperties checks) |
| 12 | + - Throws a formatted contract error with: |
| 13 | + - tool id/name |
| 14 | + - JSON source path |
| 15 | + - schema path |
| 16 | + - failed field/path |
| 17 | + - validation summary |
| 18 | + |
| 19 | +2) Wired schema gate into shared loaded boundary |
| 20 | +- tools/shared/toolLoadDiagnostics.js |
| 21 | + - logToolLoadLoaded is now async. |
| 22 | + - When loadedDocument is provided, schema validation runs before boundary emission. |
| 23 | + - Invalid schema now throws before tool-specific extraction/normalization path continues. |
| 24 | + |
| 25 | +3) Updated active sample-preset load callers to await loaded-boundary schema validation and pass loadedDocument |
| 26 | +- tools/3D Asset Viewer/main.js |
| 27 | +- tools/3D Camera Path Editor/main.js |
| 28 | +- tools/3D JSON Payload/main.js |
| 29 | +- tools/Asset Browser/main.js |
| 30 | +- tools/Asset Pipeline/main.js |
| 31 | +- tools/Palette Browser/main.js |
| 32 | +- tools/Parallax Scene Studio/main.js |
| 33 | +- tools/Performance Profiler/main.js |
| 34 | +- tools/Physics Sandbox/main.js |
| 35 | +- tools/Replay Visualizer/main.js |
| 36 | +- tools/SVG Asset Studio/main.js |
| 37 | +- tools/Sprite Editor/modules/spriteEditorApp.js |
| 38 | +- tools/State Inspector/main.js |
| 39 | +- tools/Tile Model Converter/main.js |
| 40 | +- tools/Tilemap Studio/main.js |
| 41 | +- tools/Vector Map Editor/editor/VectorMapEditorApp.js |
| 42 | + |
| 43 | +Schema-only load-path simplifications applied in this PR: |
| 44 | +- Removed several post-load custom required-field throws and switched to canonical payload access in: |
| 45 | + - 3D Asset Viewer |
| 46 | + - 3D Camera Path Editor |
| 47 | + - 3D JSON Payload |
| 48 | + - Asset Browser |
| 49 | + - Asset Pipeline |
| 50 | + - Palette Browser |
| 51 | + - Performance Profiler |
| 52 | + - Physics Sandbox |
| 53 | + - Replay Visualizer |
| 54 | + - State Inspector |
| 55 | + - Tile Model Converter |
| 56 | + - Vector Map Editor |
| 57 | + |
| 58 | +Targeted validation executed: |
| 59 | +1) Syntax checks |
| 60 | +- node --check on changed JS files |
| 61 | +- Result: PASS for all changed JS files, including tools/shared/schemaOnlyToolPresetValidation.js |
| 62 | + |
| 63 | +2) Schema gate behavior sanity (targeted runtime helper check) |
| 64 | +- Ran a targeted Node ESM script invoking enforceToolPresetSchemaOnlyContract with mocked fetch. |
| 65 | +- Evidence: |
| 66 | + - PASS valid payload accepted |
| 67 | + - PASS invalid payload rejected with contract details |
| 68 | + - PASS cached schema path remains operational for repeated validation |
| 69 | + |
| 70 | +3) Screen-error path wiring checks |
| 71 | +- Verified changed load paths contain: |
| 72 | + - awaited schema gate at loaded boundary |
| 73 | + - visible load-failed status text path |
| 74 | +- Result: PASS for updated loader files. |
| 75 | + |
| 76 | +4) Launch smoke regression check |
| 77 | +- npm run test:launch-smoke -- --tools |
| 78 | +- Result: PASS=287 FAIL=0 TOTAL=287 |
| 79 | +- Report regenerated at docs/dev/reports/launch_smoke_report.md |
| 80 | + |
| 81 | +Acceptance summary: |
| 82 | +- Schema validation is now a first-class load boundary for updated tool preset loaders. |
| 83 | +- Invalid schema data is rejected before downstream tool loading logic. |
| 84 | +- Rejections surface as visible on-screen load errors through existing tool status text outputs. |
| 85 | +- Missing file and malformed JSON still surface as visible load failures via existing catch/status paths. |
0 commit comments