Skip to content

Commit fa669c9

Browse files
committed
Add Sprites library CRUD shell
1 parent 73753c8 commit fa669c9

11 files changed

Lines changed: 1322 additions & 2682 deletions

assets/toolbox/sprites/js/index.js

Lines changed: 306 additions & 8 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# PR_26177_CHARLIE_012 Branch Validation
2+
3+
Status: PASS
4+
5+
## Checks
6+
7+
- PASS: `main` was checked and synced to `origin/main` before continuing.
8+
- PASS: `main` worktree was clean before continuing.
9+
- PASS: PR012 was created as a stacked branch from `PR_26177_CHARLIE_011-sprites-tool-shell`.
10+
- PASS: Stacking is required because CRUD depends on the PR011 shell and avoids duplicating PR011 in a separate main-based branch.
11+
- PASS: Current work branch is `PR_26177_CHARLIE_012-sprites-library-crud`.
12+
- PASS: Branch contains only the Sprites library CRUD PR scope relative to PR011.
13+
- PASS: No merge was performed.
14+
- PASS: No `start_of_day` path is changed.
15+
16+
## Notes
17+
18+
The Sprites API/database foundation is still provided by `PR_26177_CHARLIE_010-sprites-api-db-foundation`. This PR validates browser CRUD behavior against mocked API responses matching that contract.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# PR_26177_CHARLIE_012 Manual Validation Notes
2+
3+
Status: PASS
4+
5+
## Manual Review
6+
7+
- Verified Add Sprite opens an editable row without generating a sprite key in the browser.
8+
- Verified Save requires a sprite name.
9+
- Verified Save requires an explicit valid status.
10+
- Verified category input is normalized before API submission.
11+
- Verified create and update requests use the Sprites API POST contract.
12+
- Verified archive uses the API archive endpoint.
13+
- Verified delete uses the API delete endpoint only when the record has no usage references.
14+
- Verified referenced records display a disabled delete action with archive as the available safe action.
15+
- Verified 401 write response redirects to `account/sign-in.html`.
16+
- Verified no color definitions or reusable Palette/Colors records are created by Sprites.
17+
18+
## Manual Limitation
19+
20+
The live API/database foundation remains in PR010. This PR uses mocked API responses in Playwright to validate the UI contract until PR010 is merged.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# PR_26177_CHARLIE_012 Requirements Checklist
2+
3+
Status: PASS
4+
5+
- PASS: Implemented API-backed sprite library table controls.
6+
- PASS: Added create flow.
7+
- PASS: Added edit/update flow.
8+
- PASS: Added archive flow.
9+
- PASS: Added delete flow.
10+
- PASS: Delete is blocked for referenced records using API-provided usage count.
11+
- PASS: Archive remains available as the safer referenced-record action.
12+
- PASS: Name is required before save.
13+
- PASS: Status must be one of the API contract values: `draft`, `ready`, `published`, `archived`.
14+
- PASS: Category is optional and normalized.
15+
- PASS: No silent default status is applied for new records.
16+
- PASS: Guest save attempts redirect to `account/sign-in.html`.
17+
- PASS: Browser does not generate authoritative sprite keys.
18+
- PASS: API/server remains responsible for key and audit fields.
19+
- PASS: No Sprite-owned reusable color data was added.
20+
- PASS: No page-local reusable Palette/Colors arrays were added.
21+
- PASS: No browser storage product-data source of truth was added.
22+
- PASS: No MEM DB, local-mem, fake-login, or silent fallback was introduced.
23+
- PASS: Targeted Playwright coverage passed.
24+
- PASS: Required report artifacts were created.
25+
- PASS: Repo-structured ZIP artifact was created under `tmp/`.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# PR_26177_CHARLIE_012 Validation Lane
2+
3+
Status: PASS
4+
5+
## Commands
6+
7+
```powershell
8+
git -c http.sslBackend=schannel pull --ff-only origin main
9+
git rev-list --left-right --count origin/main...HEAD
10+
```
11+
12+
Result: PASS, `main` was synced at `0 0` before the stacked branch was created.
13+
14+
```powershell
15+
rg -n "<style|style=|onclick=|onchange=|oninput=|onsubmit=|<script>" toolbox/sprites/index.html assets/toolbox/sprites/js/index.js tests/playwright/tools/SpritesToolShell.spec.mjs
16+
```
17+
18+
Result: PASS, no matches.
19+
20+
```powershell
21+
rg -n "localStorage|sessionStorage|indexedDB|imageDataUrl|MEM DB|local-mem|fake-login|silent fallback" toolbox/sprites/index.html assets/toolbox/sprites/js/index.js tests/playwright/tools/SpritesToolShell.spec.mjs
22+
```
23+
24+
Result: PASS, no matches.
25+
26+
```powershell
27+
git diff --check
28+
```
29+
30+
Result: PASS. Git reported only repository line-ending warnings for changed HTML/test files.
31+
32+
```powershell
33+
node ./node_modules/@playwright/test/cli.js test tests/playwright/tools/SpritesToolShell.spec.mjs --project=playwright --workers=1 --reporter=list
34+
```
35+
36+
Result: PASS, 6 passed.
37+
38+
## Playwright Coverage
39+
40+
Targeted Playwright coverage updated `docs_build/dev/reports/playwright_v8_coverage_report.txt` for the Sprites browser module.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# PR_26177_CHARLIE_012-sprites-library-crud
2+
3+
Team: Charlie
4+
5+
Status: PASS
6+
7+
## Scope
8+
9+
Extended the Sprites tool shell with API-backed library CRUD controls. The browser still does not own authoritative data: all create, update, archive, and delete actions call the Sprites API contract.
10+
11+
## Changed Files
12+
13+
- `toolbox/sprites/index.html`
14+
- `assets/toolbox/sprites/js/index.js`
15+
- `tests/playwright/tools/SpritesToolShell.spec.mjs`
16+
- `docs_build/dev/reports/playwright_v8_coverage_report.txt`
17+
- `docs_build/dev/reports/codex_review.diff`
18+
- `docs_build/dev/reports/codex_changed_files.txt`
19+
- `docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud.md`
20+
- `docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-branch-validation.md`
21+
- `docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-requirements-checklist.md`
22+
- `docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-validation-lane.md`
23+
- `docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-manual-validation-notes.md`
24+
25+
## Implementation Notes
26+
27+
- Added Add/Edit/Save/Cancel controls for sprite records.
28+
- Added required `name` validation and API-contract status validation.
29+
- Added category normalization by trimming and collapsing internal whitespace.
30+
- Added archive action through `/api/sprites/records/:key/archive`.
31+
- Added delete action through `/api/sprites/records/:key/delete`.
32+
- Delete is disabled when the API-provided usage count indicates references; archive remains the safer action.
33+
- Guest write attempts redirect to `account/sign-in.html` when the API returns 401 or 403.
34+
- Create requests do not include browser-generated authoritative keys.
35+
- Sprites still does not define reusable colors or duplicate Palette/Colors records.
36+
37+
## Stack Note
38+
39+
This PR is stacked on `PR_26177_CHARLIE_011-sprites-tool-shell` because the CRUD work depends on the shell structure. Project Instructions allow stacked sequential PRs when dependency order requires it. Opening this from `main` would duplicate PR011 shell work and violate one-purpose scope.
40+
41+
## Validation
42+
43+
- PASS: `git diff --check`
44+
- PASS: inline CSS/script/handler scan for Sprites files found no matches.
45+
- PASS: browser storage and forbidden local data pattern scan found no matches.
46+
- PASS: no `start_of_day` files changed.
47+
- PASS: `node ./node_modules/@playwright/test/cli.js test tests/playwright/tools/SpritesToolShell.spec.mjs --project=playwright --workers=1 --reporter=list`
48+
49+
## ZIP Artifact
50+
51+
- `tmp/PR_26177_CHARLIE_012-sprites-library-crud_delta.zip`
Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
# git status --short
2-
M docs_build/dev/reports/codex_changed_files.txt
3-
M docs_build/dev/reports/codex_review.diff
2+
M assets/toolbox/sprites/js/index.js
43
M docs_build/dev/reports/playwright_v8_coverage_report.txt
4+
M tests/playwright/tools/SpritesToolShell.spec.mjs
55
M toolbox/sprites/index.html
6-
?? assets/toolbox/sprites/
7-
?? docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell-branch-validation.md
8-
?? docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell-manual-validation-notes.md
9-
?? docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell-requirements-checklist.md
10-
?? docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell-validation-lane.md
11-
?? docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell.md
12-
?? tests/playwright/tools/SpritesToolShell.spec.mjs
6+
?? docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-branch-validation.md
7+
?? docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-manual-validation-notes.md
8+
?? docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-requirements-checklist.md
9+
?? docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-validation-lane.md
10+
?? docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud.md
1311

1412
# git ls-files --others --exclude-standard
15-
assets/toolbox/sprites/js/index.js
16-
docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell-branch-validation.md
17-
docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell-manual-validation-notes.md
18-
docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell-requirements-checklist.md
19-
docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell-validation-lane.md
20-
docs_build/dev/reports/PR_26177_CHARLIE_011-sprites-tool-shell.md
21-
tests/playwright/tools/SpritesToolShell.spec.mjs
13+
docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-branch-validation.md
14+
docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-manual-validation-notes.md
15+
docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-requirements-checklist.md
16+
docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud-validation-lane.md
17+
docs_build/dev/reports/PR_26177_CHARLIE_012-sprites-library-crud.md
2218

2319
# git diff --stat
24-
docs_build/dev/reports/codex_changed_files.txt | 40 +-
25-
docs_build/dev/reports/codex_review.diff | 2052 +++++++-------------
26-
.../dev/reports/playwright_v8_coverage_report.txt | 15 +-
27-
toolbox/sprites/index.html | 74 +-
28-
4 files changed, 770 insertions(+), 1411 deletions(-)
20+
assets/toolbox/sprites/js/index.js | 314 ++++++++++++++++++++-
21+
.../dev/reports/playwright_v8_coverage_report.txt | 10 +-
22+
tests/playwright/tools/SpritesToolShell.spec.mjs | 148 ++++++++++
23+
toolbox/sprites/index.html | 6 +-
24+
4 files changed, 465 insertions(+), 13 deletions(-)

0 commit comments

Comments
 (0)