Skip to content

Commit 1465fb8

Browse files
committed
Verify runtime usage of palette_source_swatches - PR_26160_075-palette-runtime-usage-verification
1 parent 8f498f8 commit 1465fb8

4 files changed

Lines changed: 162 additions & 22 deletions

File tree

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ Missing changed runtime JS files are WARN, not FAIL.
66
Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
77

88
Changed runtime JS files considered:
9-
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10-
(0%) src/engine/api/mock-db-viewer-ui.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
119
(86%) toolbox/colors/colors.js - executed lines 2289/2289; executed functions 193/224
1210

1311
Guardrail warnings:
14-
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
15-
(0%) src/engine/api/mock-db-viewer-ui.js - WARNING: changed runtime JS file missing from coverage; advisory only
12+
(100%) none - no changed runtime JS coverage warnings
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# PR_26160_075-palette-runtime-usage-verification
2+
3+
Generated: 2026-06-09
4+
5+
## Branch Validation
6+
7+
| Check | Status | Evidence |
8+
| --- | --- | --- |
9+
| Current branch | PASS | `git branch --show-current` returned `main`. |
10+
| Expected branch | PASS | Required branch is `main`. |
11+
12+
## Executive Finding
13+
14+
Recommendation: **DEPRECATE**.
15+
16+
`palette_source_swatches` is requested by the live Colors page through the palette repository snapshot path, and it contributes to visible output through the Colors `Repository Tables` panel (`Source Swatches838`). It does **not** affect the current generated Picker Preview grid, project swatch editing, symbol-free validation, import/export, or save/load behavior. Current source-browser UI controls are absent, and current harmony matching is supplied by generated picker swatches even when the user selects source-based match modes.
17+
18+
Do not remove the table in this PR. A removal PR should first remove or replace the dead source-browser and source-harmony code paths, then update DB Viewer grouping and tests.
19+
20+
## Runtime Trace Evidence
21+
22+
Targeted Playwright/Chromium trace opened:
23+
24+
- `/toolbox/colors/index.html`
25+
- `/toolbox/colors/index.html?source=empty`
26+
27+
The trace captured palette API calls, DOM state, grid hexes, edit/save behavior, and reload behavior.
28+
29+
### Normal Source Rows
30+
31+
| Runtime item | Observed value |
32+
| --- | --- |
33+
| Page | `/toolbox/colors/index.html` |
34+
| Source controls rendered | `0` for `[data-palette-source-select]`, `[data-palette-source-search]`, `[data-palette-source-pin-all]`, `[data-palette-source-list]` |
35+
| Initial grid count | `24` |
36+
| First 12 grid hexes | `#245F34`, `#34813E`, `#4C9C4D`, `#80B65C`, `#AFC082`, `#D6CEA2`, `#A36E44`, `#43633A`, `#102A17`, `#1F4D25`, `#346B35`, `#5D8A3E` |
37+
| Rendered source table output | `Source Swatches838` |
38+
| Add picker swatch | Project count changed from `0` to `1`; selected swatch `Nature Forest Full Green #245F34` |
39+
| Reload after add | Project count remained `1`; `Source Swatches838` remained visible |
40+
| Snapshot source values | `sourcePaletteRecordCount=838`, `sourcePaletteOptions=11`, `palette_source_swatches rows=838` |
41+
42+
### Empty Source Rows
43+
44+
| Runtime item | Observed value |
45+
| --- | --- |
46+
| Page | `/toolbox/colors/index.html?source=empty` |
47+
| Source controls rendered | `0` |
48+
| Initial grid count | `24` |
49+
| First 12 grid hexes | Same as normal source rows: `#245F34`, `#34813E`, `#4C9C4D`, `#80B65C`, `#AFC082`, `#D6CEA2`, `#A36E44`, `#43633A`, `#102A17`, `#1F4D25`, `#346B35`, `#5D8A3E` |
50+
| Rendered source table output | `Source Swatches0` |
51+
| Add picker swatch | Project count changed from `0` to `1`; selected swatch `Nature Forest Full Green #245F34` |
52+
| Snapshot source values | `sourcePaletteRecordCount=0`, `sourcePaletteOptions=0`, `palette_source_swatches rows=0` |
53+
54+
Conclusion: emptying source rows changes the diagnostic/table-count output, but not the generated grid.
55+
56+
### Harmony Runtime Trace
57+
58+
The trace selected a picker swatch, then switched Color Harmony Schemes Match to `All Sources Closest Match` and `Current Source Closest Match`.
59+
60+
| Source mode | Match mode | Rendered output |
61+
| --- | --- | --- |
62+
| Normal source rows | All Sources Closest Match | `Showing 1 Complementary colors from All Sources Closest Match.` First title: `Complementary Nature Forest Full Orange #6F4B2E`. |
63+
| Empty source rows | All Sources Closest Match | Same rendered output: `Complementary Nature Forest Full Orange #6F4B2E`. |
64+
| Normal source rows | Current Source Closest Match | `Showing 1 Complementary colors from Current Source Closest Match.` First title: `Complementary Nature Forest Full Orange #6F4B2E`. |
65+
| Empty source rows | Current Source Closest Match | Same rendered output: `Complementary Nature Forest Full Orange #6F4B2E`. |
66+
67+
Conclusion: current harmony output does not depend on `palette_source_swatches` because `toolbox/colors/colors.js` passes generated picker swatches from `currentHarmonyMatchSwatches()` into `repository.createHarmonySuggestions()`. In `harmonyForSwatch()`, provided match swatches win over source palette rows.
68+
69+
## Page Requests
70+
71+
| Page | Runtime request evidence |
72+
| --- | --- |
73+
| `toolbox/colors/index.html` | Requests `/api/toolbox/palette/repositories` and repeated `/api/toolbox/palette/repositories/{id}/methods/getSnapshot`; snapshot responses include source count/options/table data. |
74+
| `toolbox/colors/index.html?source=empty` | Same page route with test option; confirms grid behavior without source rows. |
75+
76+
No current Colors page request directly called the `listSourceSwatches` repository method during the trace.
77+
78+
## API / Service Methods Reading Source Rows
79+
80+
| Method/path | Runtime role | Source-row effect |
81+
| --- | --- | --- |
82+
| `createProjectWorkspacePaletteRepository()` | Repository creation reads `loadedMockDbTables.palette_source_swatches` into `sourcePaletteRows`. | Active initialization read. |
83+
| `getSnapshot()` | Returns `sourcePaletteOptions`, `sourcePaletteRecordCount`, `tableCounts`, and `tables`, all derived from `sourcePaletteRows`/`getTables()`. | Active read; visible only through Repository Tables count on current page. |
84+
| `sourcePaletteOptions()` | Builds source option metadata from `sourcePaletteRows`. | Dead for current UI because source select is absent; still returned in snapshots. |
85+
| `listSourceSwatches()` | Reads source rows by source/filter/sort. | Dead for current Colors page trace; no request to this method occurred. |
86+
| `createHarmonySuggestions()` | Builds `sourcePaletteData` from `sourcePaletteOptions()` and `listSourceSwatches()` before calling `harmonyForSwatch()`. | Dead read in current UI because provided generated picker `matchSwatches` override source palettes. |
87+
| `getTables()` | Emits `palette_source_swatches` rows and table counts. | Active diagnostic/table-count read; also included in persistence snapshots. |
88+
89+
## UI Consumer List
90+
91+
| UI component | Consumes `palette_source_swatches` data? | Evidence |
92+
| --- | --- | --- |
93+
| Repository Tables panel | YES | `renderTables()` consumes `snapshot.tableCounts`; `displayColorsTableName()` maps `palette_source_swatches` to `Source Swatches`; runtime showed `Source Swatches838`. |
94+
| Source browser controls | NO in current page | HTML has no source select/search/pin/list nodes; trace source control count was `0`; `renderSourceOptions()` and `renderSourceSwatches()` return early. |
95+
| Picker Preview grid | NO | Normal and empty-source runs both rendered 24 grid swatches with the same first 12 hexes. Grid is generated from curated arrays in `toolbox/colors/colors.js`. |
96+
| Color Harmony Schemes | NO for current behavior | Source rows are read by service helper code, but generated picker swatches are passed as `matchSwatches` and determine rendered harmony output. Normal and empty-source traces matched. |
97+
| Project Swatches list/editing | NO | Add/update/remove/tag behavior reads/writes `palette_colors` through active project swatches, not `palette_source_swatches`. |
98+
| Import/export | NO | Current UI does not expose import/export; repository `loadActiveProjectPalettePayload()` validates and loads `tools.palette-browser.swatches` only. |
99+
| Save/load persistence | INDIRECT / redundant | Palette save operations persist current adapter tables through `getTables()`, including unchanged source rows, but source rows do not determine project swatch save/load results. |
100+
101+
## Requested Behavior Questions
102+
103+
| Question | Finding |
104+
| --- | --- |
105+
| Does `palette_source_swatches` contribute to rendered Colors page output? | YES, through Repository Tables row `Source Swatches838`; not through source browser controls. |
106+
| Does it affect grid rendering? | NO. Empty-source trace produced the same grid count and first grid hexes. |
107+
| Does it affect import/export? | NO current import/export UI; repository payload loading uses active project swatches only. |
108+
| Does it affect palette editing? | NO for current manual/picker editing. Picker add/save uses generated swatch data and `palette_colors`. |
109+
| Does it affect save operations? | Not functionally. Saves persist full palette table state including unchanged source rows, but source rows do not change saved project swatches. |
110+
111+
## Dead Read Findings
112+
113+
| Dead read | Evidence |
114+
| --- | --- |
115+
| `sourcePaletteOptions` in current Colors UI | Returned in snapshots but no source select is rendered. |
116+
| `renderSourceOptions()` / `renderSourceSwatches()` source UI path | Functions exist, but no matching DOM nodes exist in `toolbox/colors/index.html`; runtime source control count was `0`. |
117+
| `createHarmonySuggestions()` source palette data build | Service constructs source palette data, but current UI passes generated picker `matchSwatches`, so `harmonyForSwatch()` uses generated swatches instead. Empty-source and normal-source harmony output matched. |
118+
| `listSourceSwatches()` API method for current page | No runtime request to the repository `listSourceSwatches` method appeared in the trace. |
119+
120+
## Dead Write Findings
121+
122+
| Dead/redundant write | Evidence |
123+
| --- | --- |
124+
| Persisting unchanged `palette_source_swatches` during palette edits | `pinSourceSwatch`/save paths persist repository tables through `getTables()`, which includes unchanged source rows. This keeps adapter snapshots complete, but the current edit/save result does not depend on source row content. |
125+
126+
## Removal Path
127+
128+
1. Remove or replace source-browser code paths in `toolbox/colors/colors.js`: `renderSourceOptions()`, `renderSourceSwatches()`, source sort/size/pin-all handlers, and source-only state.
129+
2. Remove `sourcePaletteOptions`, `listSourceSwatches`, and source-data preloading from `createHarmonySuggestions()` unless a real source-backed harmony UX is restored.
130+
3. Update `getSnapshot()` to omit source options/record count/tables from the Colors runtime snapshot, or move them to an admin-only diagnostics endpoint.
131+
4. Remove `palette_source_swatches` from `PALETTE_TOOL_TABLES`, mock DB schemas, DB Viewer Palette grouping, and seed generation.
132+
5. Update Playwright/repository tests that still assert source table behavior.
133+
134+
Until that cleanup is intentionally scoped, keep the physical table but mark it as deprecated/legacy source-browser data.
135+
136+
## Validation
137+
138+
| Lane | Status | Command | Evidence |
139+
| --- | --- | --- | --- |
140+
| Branch guard | PASS | `git branch --show-current` | Returned `main`. |
141+
| Runtime trace | PASS | Inline Playwright/Chromium trace against normal and empty-source Colors pages | Captured API methods, source snapshot counts, source control count, grid hexes, add behavior, reload behavior, and harmony output. |
142+
| Colors Playwright | PASS | `npx playwright test tests/playwright/tools/PaletteToolMockRepository.spec.mjs --reporter=line` | 9 passed. Covers Colors page load, grid rendering, palette editing, save/load behavior, and symbol-free validation. |
143+
| Static whitespace validation | PASS | `git diff --check` | No whitespace errors after reports were generated. |
144+
145+
## Skipped Lanes
146+
147+
| Lane | Status | Reason |
148+
| --- | --- | --- |
149+
| Full samples validation | SKIP | This PR is evidence-only for Colors runtime usage and does not touch samples. |
150+
| DB Viewer Playwright | SKIP | The request explicitly said not to rely on DB Viewer visibility and asked for targeted Colors runtime validation only. |
151+
| Toolbox/Admin migration validation | SKIP | This PR does not migrate Toolbox/Admin data. |

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Exercised tool entry points detected:
1717
(77%) Theme V2 Shared JS - exercised 3 runtime JS files
1818

1919
Changed runtime JS files covered:
20-
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
21-
(0%) src/engine/api/mock-db-viewer-ui.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
2220
(86%) toolbox/colors/colors.js - executed lines 2289/2289; executed functions 193/224
2321

2422
Files with executed line/function counts where available:
@@ -31,11 +29,7 @@ Files with executed line/function counts where available:
3129
(100%) toolbox/colors/palette-api-client.js - executed lines 19/19; executed functions 4/4
3230

3331
Uncovered or low-coverage changed JS files:
34-
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: uncovered changed runtime JS file; advisory only
35-
(0%) src/engine/api/mock-db-viewer-ui.js - WARNING: uncovered changed runtime JS file; advisory only
32+
(100%) none - no low-coverage changed runtime JS files
3633

3734
Changed JS files considered:
38-
(0%) src/dev-runtime/server/mock-api-router.mjs - changed JS file not collected as browser runtime coverage
39-
(0%) src/engine/api/mock-db-viewer-ui.js - changed JS file not collected as browser runtime coverage
40-
(0%) tests/playwright/tools/AdminDbViewer.spec.mjs - changed JS file not collected as browser runtime coverage
4135
(86%) toolbox/colors/colors.js - changed JS file with browser V8 coverage
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Testing Lane Execution Report
22

3-
PR: PR_26160_074-palette-db-legacy-table-audit
3+
PR: PR_26160_075-palette-runtime-usage-verification
44
Generated: 2026-06-09
55
Full samples validation: SKIPPED
66

77
## Summary
88

9-
PASS: 6
9+
PASS: 4
1010
WARN: 0
1111
FAIL: 0
1212
SKIP: 3
@@ -15,21 +15,19 @@ SKIP: 3
1515

1616
| Lane | Status | Command | Evidence |
1717
| --- | --- | --- | --- |
18-
| Branch guard | PASS | `git branch --show-current`; `git branch --list` | Current branch was `main`; local branch list contained `main`. |
19-
| Palette DB audit probe | PASS | Inline Node probe importing `createPaletteSourceMockDbRows()` and `createProjectWorkspacePaletteRepository()` | Confirmed `palette_source_swatches` seed count 838, repository table count 838, 11 source options, and palette table counts. |
20-
| Changed JS syntax | PASS | `node --check toolbox/colors/colors.js` | Changed Colors runtime file parsed successfully. |
21-
| Colors grid/runtime Playwright | PASS | `npx playwright test tests/playwright/tools/PaletteToolMockRepository.spec.mjs --reporter=line` | 9 passed after the metadata-only sort setting repair. |
22-
| Admin DB Viewer Playwright | PASS | `npx playwright test tests/playwright/tools/AdminDbViewer.spec.mjs --reporter=line` | 7 passed. Covers Palette grouping, `palette_source_swatches` visibility, DB-shaped Palette tables, Local Mem, Local DB readonly, and diagnostics. |
18+
| Branch guard | PASS | `git branch --show-current` | Returned `main`. |
19+
| Colors runtime trace | PASS | Inline Playwright/Chromium trace against `/toolbox/colors/index.html` and `/toolbox/colors/index.html?source=empty` | Captured palette API calls, source snapshot values, source control count, grid count/hexes, add behavior, reload behavior, and harmony output. |
20+
| Colors runtime Playwright | PASS | `npx playwright test tests/playwright/tools/PaletteToolMockRepository.spec.mjs --reporter=line` | 9 passed. Covers Colors page load, grid rendering, palette editing, save/load behavior, and symbol-free validation. |
2321
| Static whitespace validation | PASS | `git diff --check` | No whitespace errors after final artifact generation. |
2422

2523
## Skipped Lanes
2624

2725
| Lane | Status | Reason |
2826
| --- | --- | --- |
29-
| Full samples validation | SKIP | The PR does not touch sample loaders, playable game runtime, sample assets, or shared sample framework behavior. |
30-
| Broad Toolbox/Admin migration validation | SKIP | The request explicitly scoped validation to Palette/Colors DB audit and DB Viewer grouping. |
31-
| Unrelated game/sample DB migration validation | SKIP | The request explicitly said not to migrate unrelated Toolbox/Admin data. |
27+
| Full samples validation | SKIP | The PR is evidence-only for Colors runtime usage and does not touch samples, sample loaders, or game runtime. |
28+
| Admin DB Viewer Playwright | SKIP | The request explicitly said not to rely on DB Viewer visibility and requested targeted Colors runtime validation only. |
29+
| Toolbox/Admin migration validation | SKIP | The PR does not migrate Toolbox/Admin data or change shared metadata contracts. |
3230

3331
## Manual Test Notes
3432

35-
The targeted Playwright lanes covered the requested browser behavior. The audit found `palette_source_swatches` is still active in service/repository behavior and DB Viewer grouping, so the table was not removed.
33+
No separate manual walkthrough was needed. Runtime trace evidence showed `palette_source_swatches` is requested through palette snapshots and rendered as a Repository Tables count, but does not affect grid rendering, palette editing, import/export, or save/load behavior. The report recommends **DEPRECATE**.

0 commit comments

Comments
 (0)