|
| 1 | +# LEVEL 10.6B — Palette Contract Alignment |
| 2 | + |
| 3 | +## PR Purpose |
| 4 | +Close the largest standalone sample generic-failure cluster by removing palette contract drift between manifest payloads and tool palette JSON files. |
| 5 | + |
| 6 | +## Scope |
| 7 | +This PR is limited to palette payload contract alignment for standalone sample/tool stability. |
| 8 | + |
| 9 | +## Problem |
| 10 | +Palette-bearing samples fail because the palette object passed through the manifest does not match the shape used by tool palette JSON files. |
| 11 | + |
| 12 | +Observed manifest shape: |
| 13 | + |
| 14 | +```json |
| 15 | +"palette-browser": { |
| 16 | + "schema": "html-js-gaming.tool.palette-browser", |
| 17 | + "version": 1, |
| 18 | + "name": "Palette Browser", |
| 19 | + "source": "manifest", |
| 20 | + "palette": { |
| 21 | + "schema": "html-js-gaming.palette", |
| 22 | + "version": 1, |
| 23 | + "name": "Asteroids Palette", |
| 24 | + "source": "singleton-merged-from-tool-palettes", |
| 25 | + "swatches": [] |
| 26 | + } |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +Observed tool JSON shape: |
| 31 | + |
| 32 | +```json |
| 33 | +{ |
| 34 | + "$schema": "../../../tools/schemas/palette.schema.json", |
| 35 | + "schema": "html-js-gaming.palette", |
| 36 | + "version": 1, |
| 37 | + "name": "Sample 0302 Palette", |
| 38 | + "source": "engine/paletteList", |
| 39 | + "swatches": [] |
| 40 | +} |
| 41 | +``` |
| 42 | + |
| 43 | +The leading metadata and legacy `source` value cause standalone samples to look loaded while tool state/UI receives a mismatched contract. |
| 44 | + |
| 45 | +## Canonical Runtime Palette Shape |
| 46 | +Palette runtime payloads should use one canonical shape: |
| 47 | + |
| 48 | +```json |
| 49 | +{ |
| 50 | + "schema": "html-js-gaming.palette", |
| 51 | + "version": 1, |
| 52 | + "name": "Asteroids Palette", |
| 53 | + "source": "manifest", |
| 54 | + "swatches": [ |
| 55 | + { |
| 56 | + "symbol": "!", |
| 57 | + "hex": "#1CAC78", |
| 58 | + "name": "color-001" |
| 59 | + } |
| 60 | + ] |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +## Contract Rule |
| 65 | + |
| 66 | +```text |
| 67 | +sample -> manifest -> normalized input -> tool -> UI/state |
| 68 | +``` |
| 69 | + |
| 70 | +For palette tools: |
| 71 | + |
| 72 | +```text |
| 73 | +payload.palette -> state.palette -> UI |
| 74 | +``` |
| 75 | + |
| 76 | +The tool must not silently reshape, merge, inject fallback palettes, or auto-load hidden palette data. |
| 77 | + |
| 78 | +## Codex Implementation Requirements |
| 79 | +- Normalize palette-bearing sample/tool data to the canonical runtime palette shape. |
| 80 | +- Remove `$schema` from runtime palette payloads where it creates tool/manifest mismatch. |
| 81 | +- Remove legacy `source: engine/paletteList` runtime usage. |
| 82 | +- Ensure Palette Browser consumes `payload.palette` directly. |
| 83 | +- Ensure palette-dependent tools do not read `paletteList`, `colors`, or `data.palette` unless explicitly normalized before tool entry. |
| 84 | +- Preserve explicit empty state behavior when no palette is provided. |
| 85 | +- Do not introduce new features, schemas, tools, hardcoded asset paths, or fallback data. |
| 86 | +- Update standalone data-flow test/report expectations only where they enforce the corrected contract. |
| 87 | + |
| 88 | +## Expected Validation |
| 89 | +```powershell |
| 90 | +npm run test:launch-smoke:games |
| 91 | +npm run test:sample-standalone:data-flow |
| 92 | +``` |
| 93 | + |
| 94 | +Expected direction: |
| 95 | + |
| 96 | +```text |
| 97 | +Generic failure signals detected: 0 |
| 98 | +``` |
| 99 | + |
| 100 | +If not zero, remaining failures should be non-palette path/event-stream issues and should be handled in the next PR. |
0 commit comments