|
| 1 | +# PLAN_PR_ASSET_VALIDATION_ENGINE |
| 2 | + |
| 3 | +## Goal |
| 4 | +Define a project-level asset validation engine that enforces dependency and registry correctness for authoring workflows, |
| 5 | +with deterministic validation outcomes and explicit failure rules for invalid projects. |
| 6 | + |
| 7 | +## Context |
| 8 | +The project baseline now includes: |
| 9 | +- registry-aware Sprite Editor |
| 10 | +- registry-aware Tile Map Editor |
| 11 | +- registry-aware Parallax Editor |
| 12 | +- additive project-level asset dependency graph |
| 13 | + |
| 14 | +The next architectural layer is an enforced validation engine that determines whether project state is valid enough |
| 15 | +to save, package, or export under defined project rules. |
| 16 | + |
| 17 | +## Enforced Mode Intent |
| 18 | +This PR is intentionally **enforced**, not passive. |
| 19 | +Validation findings are allowed to block save/package/export operations where contracts are violated. |
| 20 | + |
| 21 | +## Scope |
| 22 | +- Define shared validation engine contracts |
| 23 | +- Define validation result model |
| 24 | +- Define severity levels and blocking rules |
| 25 | +- Define editor integration expectations |
| 26 | +- Define registry + dependency graph validation categories |
| 27 | +- Define backward-compatible rollout behavior for legacy projects |
| 28 | + |
| 29 | +## Non-Goals |
| 30 | +- No engine core API changes |
| 31 | +- No runtime gameplay validator |
| 32 | +- No packaging/export implementation beyond validation gates |
| 33 | +- No destructive migration of legacy projects |
| 34 | + |
| 35 | +## Validation Categories |
| 36 | +- missing asset ID references |
| 37 | +- orphaned graph nodes |
| 38 | +- invalid edge targets |
| 39 | +- duplicate IDs in registry-owned domains |
| 40 | +- illegal circular dependencies where disallowed |
| 41 | +- unresolved palette relationships |
| 42 | +- unresolved tileset/tile/image dependencies |
| 43 | +- stale graph snapshots versus registry source data |
| 44 | + |
| 45 | +## Proposed Result Model |
| 46 | +```json |
| 47 | +{ |
| 48 | + "validation": { |
| 49 | + "status": "valid | invalid", |
| 50 | + "findings": [ |
| 51 | + { |
| 52 | + "code": "MISSING_ASSET_ID", |
| 53 | + "severity": "error | warning | info", |
| 54 | + "blocking": true, |
| 55 | + "sourceType": "sprite | tilemap | parallaxLayer | registry | graph", |
| 56 | + "sourceId": "example-id", |
| 57 | + "message": "Human-readable explanation" |
| 58 | + } |
| 59 | + ] |
| 60 | + } |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +## Severity Contract |
| 65 | +- `error` = blocking in enforced mode |
| 66 | +- `warning` = non-blocking but visible |
| 67 | +- `info` = advisory only |
| 68 | + |
| 69 | +## Blocking Rules |
| 70 | +The following must block guarded operations in enforced mode: |
| 71 | +1. missing required asset IDs |
| 72 | +2. invalid dependency graph targets |
| 73 | +3. duplicate authoritative IDs |
| 74 | +4. illegal circular dependencies |
| 75 | +5. unresolved required palette/tileset/image links |
| 76 | +6. registry/graph corruption that prevents deterministic reconstruction |
| 77 | + |
| 78 | +## Allowed Operations Under Enforcement |
| 79 | +- read/load legacy content |
| 80 | +- inspect project state |
| 81 | +- edit toward remediation |
| 82 | +- run validation repeatedly |
| 83 | + |
| 84 | +## Blocked Operations Under Enforcement |
| 85 | +- save invalid guarded project state when blocking findings exist |
| 86 | +- package/export invalid project state |
| 87 | +- finalize derived artifacts from invalid source state |
| 88 | + |
| 89 | +## Legacy Compatibility |
| 90 | +- Legacy projects without validation data must still load |
| 91 | +- Validation may immediately flag legacy issues after load |
| 92 | +- Editors must permit remediation workflows even when save/package/export are blocked |
| 93 | +- BUILD should prefer additive validation metadata, not migration requirements |
| 94 | + |
| 95 | +## Editor Responsibilities |
| 96 | +### Sprite Editor |
| 97 | +- surface palette and sprite reference failures |
| 98 | +- block guarded save/finalize actions on blocking findings |
| 99 | + |
| 100 | +### Tile Map Editor |
| 101 | +- surface missing tileset/tile/sprite dependencies |
| 102 | +- block guarded save/finalize actions on blocking findings |
| 103 | + |
| 104 | +### Parallax Editor |
| 105 | +- surface missing image/layer dependencies |
| 106 | +- block guarded save/finalize actions on blocking findings |
| 107 | + |
| 108 | +## Shared Responsibilities |
| 109 | +- validation logic should be centralized in shared tooling where practical |
| 110 | +- editors should consume validation results, not reinvent rule logic |
| 111 | +- result formatting should be stable enough for reports and future tooling |
| 112 | + |
| 113 | +## Manual Validation Checklist |
| 114 | +1. Valid registry-aware project passes with no blocking findings. |
| 115 | +2. Missing required asset ID fails validation deterministically. |
| 116 | +3. Duplicate authoritative IDs fail validation deterministically. |
| 117 | +4. Illegal cycle detection produces blocking findings. |
| 118 | +5. Legacy project loads, surfaces issues, and allows remediation. |
| 119 | +6. Blocked operations remain blocked until findings are resolved. |
| 120 | +7. Non-blocking warnings do not prevent remediation workflows. |
| 121 | +8. Engine core APIs remain unchanged. |
| 122 | + |
| 123 | +## Next Command |
| 124 | +BUILD_PR_ASSET_VALIDATION_ENGINE |
0 commit comments