|
| 1 | +# PR_26159_031 Colors Picker Viewer Restore Report |
| 2 | + |
| 3 | +## Executive Summary |
| 4 | + |
| 5 | +Status: PASS |
| 6 | +Playwright impacted: Yes |
| 7 | +Full samples validation: Skipped, not impacted. |
| 8 | + |
| 9 | +Colors Picker Preview now renders available picker swatches first and already-in-project picker swatches in a separate bottom section. ROYGBIV was added as a curated Defined Swatch Selector source, and active Colors Symbol validation remains removed. |
| 10 | + |
| 11 | +## Root Cause: Unavailable Picker Swatches |
| 12 | + |
| 13 | +Some picker swatches are unavailable because their normalized RGB value already exists in Project Swatches. The exact rule is `pinnedSwatchForHex(hex)`: compare the generated picker swatch hex against Project Swatches using the first seven normalized hex characters, ignoring alpha. |
| 14 | + |
| 15 | +Unavailable swatches are not unavailable because of contrast/filter rules, missing metadata, or generic disabled picker state. They are RGB duplicates of an existing Project Swatches color. |
| 16 | + |
| 17 | +This PR places available swatches in the top `Available Picker Swatches` section and places duplicates in the bottom `Already in Project` section. The unavailable section preserves the real color, does not use disabled buttons, does not change opacity, and click attempts do not add duplicates. The override checkbox is now named `Include already in Project swatches` and only affects that already-in-project subset. |
| 18 | + |
| 19 | +## Root Cause: Symbol Regression |
| 20 | + |
| 21 | +The returned `Symbol: Enter a symbol for this swatch.` error came from older/stale Colors validation paths where swatches required a one-character symbol. The current active Colors flow is key/hex/name based. Active Colors source no longer has Symbol fields, Symbol validation, or `data-palette-symbol` controls. |
| 22 | + |
| 23 | +This PR also corrected the browser API helper for `validatePaletteSwatchInput` so it forwards the same input, existing-swatches, and options contract used by the server-side palette validation. Add, Update, picker selection, Project Swatches, and `tools.palette-browser.swatches` all operate without Symbol input. |
| 24 | + |
| 25 | +## Requirement Checklist |
| 26 | + |
| 27 | +| Requirement | Status | Evidence | |
| 28 | +| --- | --- | --- | |
| 29 | +| Read `PROJECT_INSTRUCTIONS.md` first | PASS | Read before implementation. | |
| 30 | +| Inspect PR_26159_025 behavior/history | PASS | Inspected commit `1ad83b4c2` and current picker render code. | |
| 31 | +| Available picker swatches grouped at top | PASS | Playwright validates `Available Picker Swatches` top group and counts. | |
| 32 | +| Unavailable picker swatches grouped at bottom | PASS | Playwright validates `Already in Project` bottom group and counts. | |
| 33 | +| Preserve subset unavailable behavior | PASS | Unavailable subset is only RGB duplicates already in Project Swatches. | |
| 34 | +| Keep newer Defined Swatch Selector controls/options | PASS | Existing Theme Collection, Palette Type, Variant controls and curated options remain; Playwright iterates all expected collections/types. | |
| 35 | +| Add ROYGBIV curated selector option | PASS | Added ROYGBIV collection/type with Red, Orange, Yellow, Green, Blue, Indigo, Violet base swatches; Playwright validates generated names. | |
| 36 | +| Report why swatches are unavailable | PASS | Root-cause section above. | |
| 37 | +| Report exact bottom-section rule | PASS | `pinnedSwatchForHex(hex)` normalized RGB match against Project Swatches. | |
| 38 | +| Do not gray out unavailable swatches | PASS | Unavailable swatches do not use disabled button opacity; Playwright validates opacity remains `1`. | |
| 39 | +| Remove red not-allowed cursor behavior | PASS | Unavailable swatches are not disabled and Playwright validates cursor is not `not-allowed`. | |
| 40 | +| Unavailable swatches preserve true color | PASS | Playwright validates unavailable color input value matches the generated hex. | |
| 41 | +| Unavailable swatches do not add on click | PASS | Playwright clicks unavailable swatch and verifies Project Swatches count stays unchanged. | |
| 42 | +| Available swatches add on click | PASS | Playwright clicks available picker swatches and verifies Project Swatches count increases. | |
| 43 | +| Remove global enable/disable checkbox behavior | PASS | Old global picker checkbox strings are absent; remaining checkbox only affects already-in-project swatches. | |
| 44 | +| Fix Symbol validation error | PASS | Active Symbol validation scan is clean; Add/Update Playwright passes without Symbol field. | |
| 45 | +| `tools.palette-browser.swatches` accepts swatches without Symbol | PASS | Repository and UI tests add swatches using key/hex/name payloads with no Symbol input. | |
| 46 | +| Validate no console errors | PASS | Palette Playwright captures page errors/console errors and passed. | |
| 47 | +| Do not run full samples validation | PASS | Full samples skipped; no sample JSON or shared sample loader changed. | |
| 48 | + |
| 49 | +## Validation Evidence |
| 50 | + |
| 51 | +- `node --check toolbox/colors/colors.js` - PASS |
| 52 | +- `node --check toolbox/colors/palette-api-client.js` - PASS |
| 53 | +- `node --check tests/playwright/tools/PaletteToolMockRepository.spec.mjs` - PASS |
| 54 | +- `npx playwright test tests/playwright/tools/PaletteToolMockRepository.spec.mjs` - PASS, 6 passed |
| 55 | +- `git diff --check` - PASS with line-ending warnings only |
| 56 | +- Active `rg` scan for Symbol validation/control strings - PASS, no matches |
| 57 | +- Active `rg` scan for old global picker checkbox strings - PASS, no matches |
| 58 | + |
| 59 | +## Skipped Lanes |
| 60 | + |
| 61 | +- Full samples validation: skipped because this PR only changes the Colors tool runtime/test path and does not change sample JSON, sample launcher code, or shared sample framework behavior. |
| 62 | +- Broad Playwright suite: skipped because targeted Palette Playwright validates the affected picker viewer, Add/Update, validation, and console-error behavior. |
| 63 | + |
| 64 | +## Artifacts |
| 65 | + |
| 66 | +- `docs_build/dev/reports/codex_review.diff` |
| 67 | +- `docs_build/dev/reports/codex_changed_files.txt` |
| 68 | +- `docs_build/dev/reports/playwright_v8_coverage_report.txt` |
| 69 | +- `tmp/PR_26159_031-colors-picker-viewer-restore_delta.zip` |
0 commit comments