1- # LEVEL 10.6B — Palette Contract Alignment
1+ # Level 10.6B - Palette Contract Alignment
22
33## 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.
4+ Normalize palette runtime payload contracts so manifest palette input and standalone tool palette input use one canonical shape.
445
456## Canonical Runtime Palette Shape
46- Palette runtime payloads should use one canonical shape:
477
488``` json
499{
5010 "schema" : " html-js-gaming.palette" ,
5111 "version" : 1 ,
52- "name" : " Asteroids Palette" ,
12+ "name" : " Example Palette" ,
5313 "source" : " manifest" ,
5414 "swatches" : [
5515 {
@@ -61,40 +21,37 @@ Palette runtime payloads should use one canonical shape:
6121}
6222```
6323
64- ## Contract Rule
24+ ## Changed Files
6525
66- ``` text
67- sample -> manifest -> normalized input -> tool -> UI/state
68- `` `
26+ - ` tools/Palette Browser/main.js `
27+ - ` docs/dev/reports/level_10_6_standalone_tool_data_flow_report.md `
28+ - ` docs/dev/reports/level_10_6B_palette_contract_alignment.md `
6929
70- For palette tools:
30+ ## What Was Aligned
7131
72- ``` text
73- payload.palette -> state.palette -> UI
74- ```
32+ - Palette Browser preset import path now preserves canonical ` payload.palette.source ` instead of forcing ` custom ` , keeping manifest-derived source identity through UI binding.
33+ - Palette-bearing standalone sample payloads were verified as canonical ( ` schema ` , ` version ` , ` name ` , ` source ` , ` swatches ` ) with no contract failures.
34+ - Standalone data-flow validation passed with zero schema, contract, roundtrip, or generic failures.
7535
76- The tool must not silently reshape, merge, inject fallback palettes, or auto-load hidden palette data.
36+ ## Validation
7737
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.
38+ Commands run:
8739
88- ## Expected Validation
89- ``` powershell
90- npm run test:launch-smoke:games
91- npm run test:sample-standalone:data-flow
92- ```
40+ - ` npm run test:launch-smoke:games `
41+ - ` npm run test:sample-standalone:data-flow `
9342
94- Expected direction :
43+ Results :
9544
96- ``` text
97- Generic failure signals detected: 0
98- ```
45+ - ` test:launch-smoke:games ` -> ` PASS=12 FAIL=0 TOTAL=12 `
46+ - ` test:sample-standalone:data-flow ` ->
47+ - ` schemaFailures=[] `
48+ - ` contractFailures=[] `
49+ - ` roundtripPathFailures=[] `
50+ - ` genericFailures=[] `
51+
52+ ## Guardrails
9953
100- If not zero, remaining failures should be non-palette path/event-stream issues and should be handled in the next PR.
54+ - No new schemas added.
55+ - No fallback/demo data added.
56+ - No hardcoded asset paths added.
57+ - No start_of_day changes.
0 commit comments