|
| 1 | +# BUILD_PR_LEVEL_10_6K_SPRITE_EDITOR_PALETTE_PATH_RESOLUTION_FROM_MANIFEST_V2 |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Make sprite-editor resolve its required palette path from the sample manifest and fetch the canonical `*.palette.json` file as a hard dependency. |
| 5 | + |
| 6 | +## Scope |
| 7 | +- Sprite editor launch/load path only. |
| 8 | +- Palette path resolution only. |
| 9 | +- Diagnostics may remain in place if already present. |
| 10 | +- No repo-wide refactor. |
| 11 | +- No start_of_day changes. |
| 12 | +- No implementation fallback data. |
| 13 | + |
| 14 | +## Problem Signal |
| 15 | +Current diagnostics show: |
| 16 | +- sprite-editor receives `samplePresetPath` |
| 17 | +- sprite-editor fetches only `sample.0219.sprite-editor.json` |
| 18 | +- no palette file is fetched |
| 19 | +- classification reports `missing` then `wrong-shape` |
| 20 | +- runtime warning says preset payload did not include a sprite project |
| 21 | + |
| 22 | +This means the tool is not resolving all required manifest inputs before loading. |
| 23 | + |
| 24 | +## Required Behavior |
| 25 | +Codex must implement the smallest executable change so: |
| 26 | + |
| 27 | +1. The sample manifest is the source of truth for tool input paths. |
| 28 | +2. `sprite-editor` requires a palette input. |
| 29 | +3. The palette input must resolve to the canonical sample palette file: |
| 30 | + - `samples/**/sample.NNNN.palette.json` |
| 31 | +4. The deprecated duplicate wrapper file must not be used: |
| 32 | + - `sample.NNNN.palette-browser.json` |
| 33 | +5. If the manifest does not provide a palette path, the tool must fail visibly with a clear diagnostic classification: |
| 34 | + - `missing` |
| 35 | +6. If the palette fetch fails, classify it as: |
| 36 | + - `wrong-path` |
| 37 | +7. If the fetched palette is not the canonical palette schema, classify it as: |
| 38 | + - `wrong-shape` |
| 39 | +8. If the palette is fetched and valid, classify it as: |
| 40 | + - `success` |
| 41 | + |
| 42 | +## Explicit Normalization Rule |
| 43 | +Do not pass palette data through a `palette-browser` wrapper. |
| 44 | + |
| 45 | +The loaded palette object must be the canonical object with: |
| 46 | +- `schema` |
| 47 | +- `version` |
| 48 | +- `name` |
| 49 | +- `source` |
| 50 | +- `swatches` |
| 51 | + |
| 52 | +Allowed metadata: |
| 53 | +- `$schema` |
| 54 | + |
| 55 | +Disallowed required shape: |
| 56 | +- `tool` |
| 57 | +- `config.palette` |
| 58 | +- nested palette browser contract |
| 59 | + |
| 60 | +## Expected Diagnostic Evidence |
| 61 | +When launching sample `0219` into `sprite-editor`, console logs must show: |
| 62 | + |
| 63 | +- `[tool-load:request]` |
| 64 | + - expected includes required inputs: |
| 65 | + - `spriteProject` |
| 66 | + - `palette` |
| 67 | +- `[tool-load:fetch]` |
| 68 | + - one fetch for the sprite-editor preset/project input |
| 69 | + - one fetch for the canonical palette JSON |
| 70 | +- `[tool-load:loaded]` |
| 71 | + - loaded sprite input |
| 72 | + - loaded palette input |
| 73 | +- `[tool-load:classification]` |
| 74 | + - sprite input classified correctly |
| 75 | + - palette input classified correctly |
| 76 | + |
| 77 | +## Files Codex Should Inspect First |
| 78 | +- `samples/phase-02/0219/` |
| 79 | +- the sample manifest for 0219 |
| 80 | +- `tools/sprite-editor/` |
| 81 | +- existing tool-load diagnostics utility |
| 82 | +- existing sample/tool launch resolver |
| 83 | +- any schema or manifest helper already used by other tools |
| 84 | + |
| 85 | +## Guardrails |
| 86 | +- Do not add silent fallback palettes. |
| 87 | +- Do not hardcode sample 0219. |
| 88 | +- Do not infer paths by string replacement unless the manifest already exposes enough data and no resolver exists. |
| 89 | +- Do not preserve use of `*.palette-browser.json`. |
| 90 | +- Do not change unrelated tools unless the shared resolver must be corrected for sprite-editor to work. |
| 91 | +- Do not rewrite roadmap text. |
| 92 | +- Roadmap update, if any, must be status-only. |
| 93 | + |
| 94 | +## Acceptance Tests |
| 95 | +Run: |
| 96 | + |
| 97 | +```powershell |
| 98 | +npm run test:launch-smoke:games |
| 99 | +npm run test:sample-standalone:data-flow |
| 100 | +``` |
| 101 | + |
| 102 | +Then manually launch: |
| 103 | +- `samples/phase-02/0219` into `sprite-editor` |
| 104 | + |
| 105 | +Confirm: |
| 106 | +- palette fetch is visible in browser console |
| 107 | +- no `palette-browser` JSON is fetched |
| 108 | +- no warning says preset payload did not include a sprite project unless the sprite payload is genuinely invalid |
| 109 | +- diagnostics show expected vs actual for both sprite project and palette |
| 110 | + |
| 111 | +## Commit Comment |
| 112 | +Resolve sprite-editor palette input from manifest SSoT and require canonical palette fetch - PR 10.6K |
0 commit comments