Skip to content

Commit f5233e3

Browse files
author
DavidQ
committed
Normalize all sample palettes to canonical SSoT and remove palette-browser duplicates - PR 10.6F
1 parent a355cbc commit f5233e3

13 files changed

Lines changed: 378 additions & 81 deletions

docs/dev/codex_commands.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Codex Commands
22

3-
Model: GPT-5.4
3+
Model: GPT-5.4-codex
44
Reasoning: high
55

6+
Run from repo root:
7+
68
```powershell
7-
codex --model gpt-5.4 --reasoning high "Run BUILD_PR_LEVEL_10_6D_PALETTE_CONTRACT_EVIDENCE_CAPTURE exactly as documented in docs/pr/BUILD_PR_LEVEL_10_6D_PALETTE_CONTRACT_EVIDENCE_CAPTURE.md. Diagnostics only. Do not normalize palette files. Run npm run test:sample-standalone:data-flow fresh, collect the exact palette manifest/tool/schema files, produce docs/dev/reports/level_10_6d_palette_contract_evidence/palette_contract_evidence_report.md, and package repo-relative evidence into tmp/BUILD_PR_LEVEL_10_6D_PALETTE_CONTRACT_EVIDENCE_CAPTURE.zip."
9+
codex exec --model gpt-5.4-codex --reasoning high --file docs/pr/BUILD_PR_LEVEL_10_6F_ALL_SAMPLE_PALETTE_SSOT_NORMALIZATION.md
10+
```
11+
12+
Codex must produce:
13+
14+
```text
15+
tmp/BUILD_PR_LEVEL_10_6F_ALL_SAMPLE_PALETTE_SSOT_NORMALIZATION.zip
816
```

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Capture palette contract evidence for explicit normalization follow-up - PR 10.6D
1+
Normalize all sample palettes to canonical SSoT and remove palette-browser duplicates - PR 10.6F

docs/dev/reports/launch_smoke_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Launch Smoke Report
22

3-
Generated: 2026-04-27T16:40:59.455Z
3+
Generated: 2026-04-27T17:16:29.337Z
44

55
Filters: games=true, samples=false, tools=false, sampleRange=all
66

8.29 KB
Binary file not shown.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# level_10_6e_palette_ssot_normalization_report
2+
3+
## build
4+
- BUILD: `BUILD_PR_LEVEL_10_6E_PALETTE_SSOT_NORMALIZATION`
5+
- Generated: 2026-04-27T17:18:26.803Z
6+
7+
## objective
8+
- Normalize Sample 0313 palette flow to a single canonical source of truth: `samples/phase-03/0313/sample.0313.palette.json`.
9+
- De-reference duplicate tool-wrapped payload `samples/phase-03/0313/sample.0313.palette-browser.json` as a required runtime input.
10+
11+
## duplicate reference audit
12+
- Runtime reference found before changes:
13+
- `samples/metadata/samples.index.metadata.json:2835` -> `/samples/phase-03/0313/sample.0313.palette-browser.json`
14+
- Test boundary assumptions found before changes:
15+
- `tests/runtime/SampleStandaloneToolDataFlow.test.mjs` used tool-file lookup for targeted cases and expected palette only at `config.palette`.
16+
- Generator audit:
17+
- Searched `scripts/`, `tests/`, `tools/`, `samples/` (excluding docs) for emitted/reference coupling to `sample.0313.palette-browser.json`.
18+
- No active generator emitting this file was found.
19+
- Post-change reference scan:
20+
- No remaining matches in `tests/`, `scripts/`, `tools/`, or `samples/` for `sample.0313.palette-browser.json`.
21+
- Remaining mentions are documentation/history only.
22+
23+
## implementation
24+
1. Updated Sample 0313 palette-browser roundtrip preset binding to canonical palette JSON.
25+
- File: `samples/metadata/samples.index.metadata.json:2835`
26+
- Change: `/samples/phase-03/0313/sample.0313.palette-browser.json` -> `/samples/phase-03/0313/sample.0313.palette.json`
27+
28+
2. Updated data-flow contract harness to accept canonical palette payload for palette-browser routes.
29+
- File: `tests/runtime/SampleStandaloneToolDataFlow.test.mjs`
30+
- Added shared palette contract validator: `appendPaletteContractFailures` (line ~390).
31+
- Added canonical preset detection for palette-browser rows: `canonicalPalettePresetFiles` (line ~435).
32+
- Added palette extraction that supports wrapped and canonical shapes: `extractPaletteFromPresetPayload` (line ~689).
33+
- Updated targeted-case preset loading to use metadata `row.presetPath` (line ~736) instead of forcing `sample.<id>.<tool>.json`.
34+
- Updated targeted palette-browser expectation to consume extracted palette payload (line ~1210).
35+
36+
3. Removed duplicate Sample 0313 tool-wrapped palette payload file.
37+
- Deleted: `samples/phase-03/0313/sample.0313.palette-browser.json`
38+
39+
## required final data flow (verified)
40+
- `sample manifest -> canonical palette JSON -> normalized tool input -> Palette Browser UI/state`
41+
42+
## before/after evidence (sample 0313)
43+
- Before (from prior evidence capture report/run):
44+
- targeted palette-browser summary indicated wrapper-origin source: `5 swatches | source: manifest`.
45+
- Artifact: `docs/dev/reports/level_10_6d_palette_contract_evidence/test_sample_standalone_data_flow_output.txt`
46+
- After (this BUILD):
47+
- targeted palette-browser summary for sample 0313: `5 swatches | source: generated-from-sample-colors`
48+
- targeted title: `Sample 0313 Palette`
49+
- swatchCount: `5`
50+
- Artifact: `docs/dev/reports/level_10_6e_sample_standalone_data_flow_output.txt`
51+
52+
## validation
53+
1. `npm run test:sample-standalone:data-flow`
54+
- Result: PASS
55+
- generatedAt: `2026-04-27T17:15:24.813Z`
56+
- schemaFailures: `0`
57+
- contractFailures: `0`
58+
- roundtripPathFailures: `0`
59+
- genericFailures: `0`
60+
61+
2. `npm run test:launch-smoke:games`
62+
- Result: PASS
63+
- summary: PASS=12 FAIL=0 TOTAL=12
64+
- Artifact: `docs/dev/reports/level_10_6e_launch_smoke_games_output.txt`
65+
66+
## guardrails check
67+
- No fallback palette data added.
68+
- No hardcoded Sample 0313 asset path introduced in Palette Browser runtime code.
69+
- No `start_of_day` folder changes.
70+
- No palette field rename or swatch reshaping applied to canonical sample palette.
71+
72+
## files changed
73+
- `samples/metadata/samples.index.metadata.json`
74+
- `tests/runtime/SampleStandaloneToolDataFlow.test.mjs`
75+
- `docs/dev/reports/level_10_6e_sample_standalone_data_flow_output.txt`
76+
- `docs/dev/reports/level_10_6e_launch_smoke_games_output.txt`
77+
- `docs/dev/reports/launch_smoke_report.md` (updated by required launch-smoke test run)
78+
- `tmp/sample-standalone-tool-data-flow-results.json` (updated by required data-flow test run)
79+
80+
## files removed
81+
- `samples/phase-03/0313/sample.0313.palette-browser.json`
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
samples/phase-03/0313/sample.0313.palette-browser.json
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# LEVEL 10.6F Report Template
2+
3+
Codex must replace this template with real execution output.
4+
5+
Required summary:
6+
7+
- Palette browser wrapper files found:
8+
- Palette browser wrapper files removed:
9+
- Canonical palette files retained:
10+
- References updated:
11+
- Generic failure signals detected:
12+
13+
Required validation:
14+
15+
- npm run test:launch-smoke:games
16+
- npm run test:sample-standalone:data-flow
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# BUILD_PR_LEVEL_10_6E_PALETTE_SSOT_NORMALIZATION
2+
3+
## Purpose
4+
5+
Normalize Sample 0313 palette handling so there is exactly one palette source of truth.
6+
7+
## Problem
8+
9+
Two uploaded files show the same palette content in two shapes:
10+
11+
- `sample.0313.palette.json` is the canonical palette payload.
12+
- `sample.0313.palette-browser.json` duplicates the same palette under `config.palette` with a tool-specific wrapper.
13+
14+
Palette Browser must consume the canonical palette input directly through the sample manifest/data-flow. It must not require a duplicate tool-shaped palette JSON.
15+
16+
## Explicit Codex Steps
17+
18+
1. Locate the Sample 0313 palette files in the workspace:
19+
- `sample.0313.palette.json`
20+
- `sample.0313.palette-browser.json`
21+
2. Treat `sample.0313.palette.json` as the source of truth.
22+
3. Find every reference to `sample.0313.palette-browser.json`.
23+
4. Update the sample manifest or tool binding so Palette Browser receives the canonical palette directly.
24+
5. If a generator creates `sample.0313.palette-browser.json`, update it so it no longer emits duplicated palette data.
25+
6. If Palette Browser expects `$schema`, `tool`, or `config.palette`, move that adaptation to the normalization boundary and pass only the canonical palette payload into the tool.
26+
7. Do not rename palette fields.
27+
8. Do not reshape `swatches`.
28+
9. Do not convert the palette to `engine.paletteList`.
29+
10. Do not add fallback colors.
30+
11. Do not hardcode Sample 0313 paths inside Palette Browser.
31+
12. Remove or de-reference the duplicate browser JSON only after all references are updated.
32+
13. Update the report with exact files changed and before/after data-flow.
33+
14. Update the master roadmap status only if an execution-backed matching item exists. Status-only marker updates are allowed; no roadmap text rewrite.
34+
35+
## Required Final Data Flow
36+
37+
```text
38+
sample manifest → canonical palette JSON → normalized tool input → Palette Browser UI/state
39+
```
40+
41+
## Acceptance Criteria
42+
43+
- One canonical Sample 0313 palette JSON remains.
44+
- Palette Browser loads the canonical palette directly.
45+
- `sample.0313.palette-browser.json` is no longer required.
46+
- `npm run test:sample-standalone:data-flow` passes.
47+
- `npm run test:launch-smoke:games` passes.
48+
- Report lists all duplicate references found and the action taken.
49+
- No hidden default/fallback palette data exists.
50+
51+
## Out of Scope
52+
53+
- No start_of_day changes.
54+
- No broad tool registry refactor.
55+
- No unrelated sample changes.
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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

Comments
 (0)