|
| 1 | +# BUILD_PR_LEVEL_10_6F_ALL_SAMPLE_PALETTE_SSOT_NORMALIZATION |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Normalize every duplicate sample palette pair under `samples/` to a single canonical palette source of truth. |
| 5 | + |
| 6 | +Known pattern: |
| 7 | +- `sample.NNNN.palette.json` contains the canonical palette object. |
| 8 | +- `sample.NNNN.palette-browser.json` duplicates the same palette under a Palette Browser tool wrapper. |
| 9 | + |
| 10 | +This PR applies the normalization to all matching samples, not just sample 0313. |
| 11 | + |
| 12 | +## Scope |
| 13 | +- Search only under `samples/` and directly related sample metadata/test files needed to keep validation green. |
| 14 | +- Keep canonical `*.palette.json` as the only persisted palette JSON for each sample. |
| 15 | +- Remove/de-reference duplicate `*.palette-browser.json` files. |
| 16 | +- Update sample manifests/metadata/tool bindings so Palette Browser receives the canonical palette object from the sample manifest/normalized input path. |
| 17 | +- Update roadmap status markers only if execution-backed. |
| 18 | + |
| 19 | +## Do Not |
| 20 | +- Do not keep both palette files for the same sample. |
| 21 | +- Do not introduce a new persisted wrapper schema for Palette Browser. |
| 22 | +- Do not transform canonical palettes into `$schema`, `engine.paletteList`, `config.palette`, or another tool-specific persisted wrapper. |
| 23 | +- Do not add silent fallback palettes or hardcoded sample asset paths. |
| 24 | +- Do not modify `start_of_day` folders. |
| 25 | +- Do not do a repo-wide refactor. |
| 26 | + |
| 27 | +## Required Normalization Rules |
| 28 | + |
| 29 | +### Canonical persisted palette |
| 30 | +For each sample, the only persisted palette JSON must be: |
| 31 | + |
| 32 | +```text |
| 33 | +samples/**/sample.*.palette.json |
| 34 | +``` |
| 35 | + |
| 36 | +This file owns the palette fields: |
| 37 | + |
| 38 | +```text |
| 39 | +schema |
| 40 | +version |
| 41 | +name |
| 42 | +source |
| 43 | +swatches |
| 44 | +``` |
| 45 | + |
| 46 | +Preserve an existing `$schema` in the canonical file unless an existing schema/test contract explicitly requires removal. |
| 47 | + |
| 48 | +### Browser wrapper removal |
| 49 | +Remove or de-reference every duplicate file matching: |
| 50 | + |
| 51 | +```text |
| 52 | +samples/**/sample.*.palette-browser.json |
| 53 | +``` |
| 54 | + |
| 55 | +Palette Browser must not depend on a persisted wrapper like: |
| 56 | + |
| 57 | +```json |
| 58 | +{ |
| 59 | + "tool": "palette-browser", |
| 60 | + "config": { |
| 61 | + "palette": {} |
| 62 | + } |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +### Runtime input contract |
| 67 | +Palette Browser may receive a runtime envelope only if the existing runner requires one, but that envelope must be built by the runner/normalizer from the canonical palette object. It must not be stored as a second sample JSON file. |
| 68 | + |
| 69 | +### No fallback data |
| 70 | +If a sample has no palette input, Palette Browser must show a safe empty state. It must not auto-load hidden/default/sample palettes. |
| 71 | + |
| 72 | +## Codex Targeted Discovery |
| 73 | +Run: |
| 74 | + |
| 75 | +```powershell |
| 76 | +Get-ChildItem .\samples -Recurse -Filter "*.palette-browser.json" | Select-Object -ExpandProperty FullName |
| 77 | +Get-ChildItem .\samples -Recurse -Filter "*.palette.json" | Select-Object -ExpandProperty FullName |
| 78 | +Select-String -Path .\samples\**\*.json -Pattern "palette-browser|palette.json|config.palette|paletteList" -List |
| 79 | +Select-String -Path .\tests\**\*.mjs,.\samples\metadata\*.json -Pattern "palette-browser|palette.json|config.palette|paletteList" -List |
| 80 | +``` |
| 81 | + |
| 82 | +## Implementation Steps |
| 83 | +1. Inventory every `samples/**/sample.*.palette-browser.json` file. |
| 84 | +2. Match each wrapper file to its sibling or referenced `sample.*.palette.json`. |
| 85 | +3. Compare `wrapper.config.palette` to the canonical palette object. |
| 86 | +4. If the content is the same palette with only wrapper/source/schema drift, keep canonical `*.palette.json` and remove the wrapper file. |
| 87 | +5. Update all sample metadata/manifest/tool references that point to `*.palette-browser.json` so they point to canonical `*.palette.json` or manifest palette data. |
| 88 | +6. Update sample standalone normalizer/test expectations only if they currently require persisted wrapper files. |
| 89 | +7. Ensure the flow remains: `sample -> schema -> normalized input -> tool -> UI/state`. |
| 90 | +8. Generate a report listing each removed wrapper and each updated reference. |
| 91 | +9. Run required tests and place outputs under `docs/dev/reports/`. |
| 92 | + |
| 93 | +## Required Tests |
| 94 | + |
| 95 | +```powershell |
| 96 | +npm run test:launch-smoke:games |
| 97 | +npm run test:sample-standalone:data-flow |
| 98 | +``` |
| 99 | + |
| 100 | +## Required Report |
| 101 | +Create: |
| 102 | + |
| 103 | +```text |
| 104 | +docs/dev/reports/level_10_6f_all_sample_palette_ssot_normalization_report.md |
| 105 | +``` |
| 106 | + |
| 107 | +It must include: |
| 108 | + |
| 109 | +```text |
| 110 | +Palette browser wrapper files found: N |
| 111 | +Palette browser wrapper files removed: N |
| 112 | +Canonical palette files retained: N |
| 113 | +References updated: N |
| 114 | +Generic failure signals detected: X |
| 115 | +``` |
| 116 | + |
| 117 | +Also include: |
| 118 | + |
| 119 | +```text |
| 120 | +sample | removed palette-browser file | canonical palette file | updated references | validation result |
| 121 | +``` |
| 122 | + |
| 123 | +## Acceptance |
| 124 | +- No `samples/**/sample.*.palette-browser.json` duplicate files remain unless listed as blocked with a concrete reason. |
| 125 | +- No sample metadata points to a palette-browser JSON wrapper as the palette source. |
| 126 | +- Palette Browser uses the canonical palette object from manifest/normalized input. |
| 127 | +- `npm run test:launch-smoke:games` passes. |
| 128 | +- `npm run test:sample-standalone:data-flow` passes. |
| 129 | +- Report shows `Generic failure signals detected: 0`. |
0 commit comments