Skip to content

Commit b8f460a

Browse files
author
DavidQ
committed
Align all sample palette JSON files to final schema and normalization rules - PR_26124_074-sample-palette-json-audit-and-fix
1 parent 77788d9 commit b8f460a

8 files changed

Lines changed: 319 additions & 416 deletions

File tree

docs/dev/codex_commands.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# Codex Commands - PR_26124_073-palette-manager-playwright-baseline
1+
# Codex Commands - PR_26124_074-sample-palette-json-audit-and-fix
22

33
```bash
4-
npx @openai/codex run --model gpt-5.5 --reasoning high "Run full workflow for PR_26124_073-palette-manager-playwright-baseline. Follow PROJECT_INSTRUCTIONS.md exactly."
4+
npx @openai/codex run --model gpt-5.5 --reasoning high "Run full workflow for PR_26124_074-sample-palette-json-audit-and-fix. Follow PROJECT_INSTRUCTIONS.md exactly."
55
```
66

77
## Validation Commands
88

99
```bash
10-
node --check tests/tools/PaletteManagerV2Baseline.test.mjs
11-
node tests/tools/PaletteManagerV2Baseline.test.mjs
10+
node --input-type=module <sample palette JSON audit/fix>
11+
node --input-type=module <sample palette JSON validation>
1212
git diff --check
1313
npm run test:workspace-v2
1414
npm run codex:review-artifacts
1515
```
1616

1717
## Playwright
1818

19-
The targeted Palette Manager V2 Playwright baseline validates page load, console/runtime cleanliness, menuSample actions, accordion toggles, Validation/Error Viewer Clear placement, source pin scroll preservation, and Tag sort untagged-last behavior.
19+
No targeted Playwright impact is expected because this PR changes sample palette JSON data only. The default requested gate is `npm run test:workspace-v2`.
2020

2121
`npm run test:workspace-v2` failed because `package.json` does not define the `test:workspace-v2` script.
2222

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add Palette Manager V2 Playwright baseline coverage - PR_26124_073-palette-manager-playwright-baseline
1+
Audit and fix sample palette JSON schema compliance - PR_26124_074-sample-palette-json-audit-and-fix
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# PR_26124_074 Sample Palette JSON Audit And Fix
2+
3+
## Summary
4+
Audited all sample palette JSON files against the requested palette swatch contract. No sample palette JSON files required changes.
5+
6+
## Files Audited
7+
- `samples/**/*.palette.json`
8+
- Count: 20 files
9+
10+
## Pattern Note
11+
The requested literal pattern `samples/**/palette.*.*.json` did not match files in this repository. The repo's sample palette files use `sample.<id>.palette.json`, so the audit target was `samples/**/*.palette.json`.
12+
13+
## Contract Checked
14+
- Required swatch fields:
15+
- `symbol`: one-character string
16+
- `hex`: `#RRGGBB` or `#RRGGBBAA`
17+
- `name`: non-empty string
18+
- Optional swatch field:
19+
- `tags`: array of lowercase non-empty strings
20+
- Extra swatch properties are rejected by the audit.
21+
- Duplicate swatches are rejected within each palette by duplicate `name`, `hex`, or `symbol`.
22+
23+
## Result
24+
- No invalid JSON files.
25+
- No schema violations.
26+
- No duplicate swatches.
27+
- No tag normalization changes required.
28+
- No sample palette JSON files changed.
29+
30+
## Files Changed
31+
- `docs/pr/PR_26124_074-sample-palette-json-audit-and-fix/PLAN_PR.md`
32+
- `docs/pr/PR_26124_074-sample-palette-json-audit-and-fix/BUILD_PR.md`
33+
- `docs/pr/PR_26124_074-sample-palette-json-audit-and-fix/APPLY_PR.md`
34+
- `docs/dev/codex_commands.md`
35+
- `docs/dev/commit_comment.txt`
36+
- `docs/dev/reports/codex_review.diff`
37+
- `docs/dev/reports/codex_changed_files.txt`
38+
39+
## Validation
40+
- PASS: read-only sample palette audit.
41+
- PASS: sample palette JSON contract validation, 20 files.
42+
- PASS: `git diff -- samples`
43+
- PASS: `git diff --check`
44+
- FAIL: `npm run test:workspace-v2` is unavailable because `package.json` does not define a `test:workspace-v2` script.
45+
- SKIPPED: full samples smoke test, by instruction.
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# git status --short
22
M docs/dev/codex_commands.md
33
M docs/dev/commit_comment.txt
4-
A docs/dev/reports/PR_26124_073_report.md
5-
A docs/pr/PR_26124_073-palette-manager-playwright-baseline/APPLY_PR.md
6-
A docs/pr/PR_26124_073-palette-manager-playwright-baseline/BUILD_PR.md
7-
A docs/pr/PR_26124_073-palette-manager-playwright-baseline/PLAN_PR.md
8-
A tests/tools/PaletteManagerV2Baseline.test.mjs
4+
A docs/dev/reports/PR_26124_074_report.md
5+
A docs/pr/PR_26124_074-sample-palette-json-audit-and-fix/APPLY_PR.md
6+
A docs/pr/PR_26124_074-sample-palette-json-audit-and-fix/BUILD_PR.md
7+
A docs/pr/PR_26124_074-sample-palette-json-audit-and-fix/PLAN_PR.md
98

109
# git diff --stat
1110
(no output)

docs/dev/reports/codex_review.diff

Lines changed: 145 additions & 405 deletions
Large diffs are not rendered by default.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# APPLY_PR - PR_26124_074-sample-palette-json-audit-and-fix
2+
3+
## Summary
4+
Audited all sample palette JSON files. No sample palette JSON changes were required because all audited files already match the requested swatch contract.
5+
6+
## Audit Result
7+
- Audited 20 files matching `samples/**/*.palette.json`.
8+
- The requested literal pattern `samples/**/palette.*.*.json` has no matches in this repository.
9+
- No invalid JSON files were found.
10+
- No swatches with missing or invalid `symbol`, `hex`, or `name` were found.
11+
- No extra swatch properties were found.
12+
- No uppercase or invalid tags were found.
13+
- No duplicate swatches by `name`, `hex`, or `symbol` were found within a palette.
14+
15+
## Runtime/Data Result
16+
- No sample palette JSON files were modified.
17+
- No tools were modified.
18+
- No workspace/toolState/session files were modified.
19+
- No sample launch code was modified.
20+
- No fallback/default data was added.
21+
22+
## Validation
23+
- PASS: read-only audit of all `samples/**/*.palette.json` files.
24+
- PASS: schema/contract validation of all 20 sample palette JSON files.
25+
- PASS: `git diff -- samples` produced no diff.
26+
- PASS: `git diff --check`
27+
- FAIL: `npm run test:workspace-v2` is unavailable because `package.json` does not define a `test:workspace-v2` script.
28+
- SKIPPED: full samples smoke test, by instruction.
29+
30+
## Manual Test
31+
1. Review the 20 `samples/**/*.palette.json` files if desired.
32+
2. Confirm no sample palette JSON diff exists for this PR.
33+
3. Confirm sample launch code was not modified.
34+
4. Full samples smoke test remains out of scope by instruction.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# BUILD_PR - PR_26124_074-sample-palette-json-audit-and-fix
2+
3+
## Purpose
4+
Perform one scoped data cleanup: audit and fix sample palette JSON files so their swatches match the current palette schema contract.
5+
6+
## Scope
7+
- `samples/**/*.palette.json`
8+
- Required PR workflow docs and review artifacts.
9+
10+
## Pattern Note
11+
The requested literal pattern `samples/**/palette.*.*.json` has no matches in this repository. The actual sample palette JSON files use `sample.<id>.palette.json`, so the executable target set is `samples/**/*.palette.json`.
12+
13+
## Implementation
14+
1. Enumerate `samples/**/*.palette.json`.
15+
2. Parse and rewrite only files requiring schema fixes.
16+
3. Preserve top-level palette metadata already allowed by `tools/schemas/tools/palette-browser.schema.json`.
17+
4. Normalize each swatch to:
18+
- `symbol`: one-character string,
19+
- `hex`: `#RRGGBB` or `#RRGGBBAA`,
20+
- `name`: non-empty string,
21+
- optional `tags`: lowercase non-empty strings.
22+
5. Remove extra swatch properties.
23+
6. Remove duplicate swatches within a palette by duplicate `name`, `hex`, or `symbol`, preserving the first occurrence.
24+
7. Keep JSON formatting stable and compact for primitive arrays where tags exist.
25+
26+
## Boundaries
27+
- Do not modify tools.
28+
- Do not modify workspace/toolState/session behavior.
29+
- Do not modify sample launch code.
30+
- Do not add fallback/default data.
31+
- Do not add dependencies.
32+
- Do not run the full samples smoke test.
33+
34+
## Validation
35+
- Syntax check every `samples/**/*.palette.json` file by parsing JSON.
36+
- Validate every `samples/**/*.palette.json` file against the current palette swatch contract.
37+
- Run `npm run test:workspace-v2`.
38+
- Run `git diff --check`.
39+
- Skip the full samples smoke test.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# PLAN_PR - PR_26124_074-sample-palette-json-audit-and-fix
2+
3+
## Goal
4+
Audit sample palette JSON files and fix schema violations against the current palette browser swatch contract.
5+
6+
## Scope
7+
- `samples/**/*.palette.json`
8+
- Required PR workflow docs and review artifacts.
9+
10+
## Pattern Note
11+
The requested literal pattern `samples/**/palette.*.*.json` does not match files in this repository. The sample palette files are named `sample.<id>.palette.json`, so this PR audits and fixes only `samples/**/*.palette.json`.
12+
13+
## Boundaries
14+
- Do not modify tools.
15+
- Do not modify workspace/toolState/session behavior.
16+
- Do not modify sample launch code.
17+
- Do not add fallback/default data.
18+
- Do not add dependencies.
19+
- Do not run the full samples smoke test.
20+
- Avoid broad refactor outside sample palette JSON.
21+
22+
## Implementation Plan
23+
1. Enumerate all `samples/**/*.palette.json` files.
24+
2. Parse each JSON file.
25+
3. Validate top-level palette document shape using the existing `tools/schemas/tools/palette-browser.schema.json` contract.
26+
4. For each swatch, keep only valid contract properties:
27+
- required `symbol`, `hex`, `name`;
28+
- optional `tags`.
29+
5. Normalize swatch tags to lowercase non-empty strings.
30+
6. Remove invalid/extra swatch properties.
31+
7. Detect duplicate swatches by `name`, `hex`, and `symbol` within each palette and preserve the first occurrence.
32+
8. Preserve intended palette content while making only schema corrections.
33+
34+
## Playwright
35+
- Default requested gate: `npm run test:workspace-v2`.
36+
- Expected pass behavior: Workspace V2 validation runs successfully if the script exists.
37+
- Expected fail behavior: the command reports that the script is unavailable if `package.json` does not define it.
38+
- No targeted Playwright impact is expected because this PR changes sample palette JSON data only.
39+
40+
## Manual Validation
41+
1. Open each changed `sample.<id>.palette.json` file.
42+
2. Confirm the file is valid JSON.
43+
3. Confirm each swatch has `symbol`, `hex`, and `name`.
44+
4. Confirm optional tags are lowercase arrays of strings.
45+
5. Confirm no sample launch code was modified.
46+
6. Full samples smoke test remains out of scope by instruction.

0 commit comments

Comments
 (0)