|
| 1 | +# PR_26163_077-assets-upload-ux-and-duplicate-guard |
| 2 | + |
| 3 | +## Branch Validation |
| 4 | +- PASS - Current branch: `main` |
| 5 | +- PASS - Expected branch: `main` |
| 6 | + |
| 7 | +## Requirement Checklist |
| 8 | +- PASS - Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before implementation. |
| 9 | +- PASS - Improved upload progress visibility with a local/dev-only delay hook. Evidence: `toolbox/assets/assets.js` uses `uploadProgressDelayMs` only on local/dev hosts; production hosts get `0` simulated delay. |
| 10 | +- PASS - Progress still reflects selected files and final write results. Evidence: Playwright verifies bytes/BPS/speed/ETA/elapsed render during upload, no OK status appears before final write status, and final rows include OK/FAIL/SKIP outcomes. |
| 11 | +- PASS - Duplicate project folder/path uploads are blocked before write. Evidence: repository checks `existsSync(resolved.absolutePath)` before `writeFileSync`. |
| 12 | +- PASS - Duplicate blocked upload creates no extra asset record. Evidence: Playwright uploads `duplicate-path.png`, retries the same file, sees FAIL, and count remains `1`. |
| 13 | +- PASS - Saved asset edit allows Usage and Tags only. Evidence: Playwright changes Usage to `Icon`, adds tag `Rare`, and saves. |
| 14 | +- PASS - Saved asset edit does not allow Source/File/Filename/Path/Asset Type changes. Evidence: saved edit row has no Source select, Upload File input, Reference select, Asset Type field, or project path edit surface; repository malicious-update test preserves the original file/type/path. |
| 15 | +- PASS - File picker text uses `No file chosen` initially and no longer shows `No file selected`. Evidence: Playwright checks the add row text. |
| 16 | +- PASS - File picker shows selected filenames after selection. Evidence: Playwright checks `batch-image-a.png, batch-image-b.png`. |
| 17 | +- PASS - Auto-start upload on file selection is preserved. Evidence: tests set files and assert rows/logs without clicking Save. |
| 18 | +- PASS - Images, Audio, and Fonts remain upload-capable. Evidence: targeted Playwright uploads each type. |
| 19 | +- PASS - Data and Vector Add buttons remain Planned/disabled from PR_076. Evidence: source-control Playwright checks both disabled buttons with Planned title. |
| 20 | +- PASS - Sprites and Palette References remain reference-only. Evidence: targeted Playwright verifies no upload file input. |
| 21 | +- PASS - Guest upload prompt behavior is preserved. Evidence: guest test still shows `Uploads require a Game Foundry account.` with `Sign In` and `Create Account`, and creates no record. |
| 22 | +- PASS - Owner-scoped records are preserved. Evidence: existing user1/user2 owner-scope Playwright still passes. |
| 23 | +- PASS - `codex_review.diff` is generated as readable UTF-8 text. Evidence: artifact writer uses UTF-8 and the Playwright UTF-8 check passes. |
| 24 | + |
| 25 | +## Upload Progress Evidence |
| 26 | +- PASS - `?uploadProgressDelayMs=250` is used in targeted Playwright as a local/dev validation hook. |
| 27 | +- PASS - Upload dialog shows current file, file count, bytes uploaded, total bytes, BPS, speed, ETA, elapsed time, phase, per-file statuses, and batch summary. |
| 28 | +- PASS - During upload, phase is `Uploading`, progress fields are non-zero/visible, and OK rows are absent before the final write result. |
| 29 | +- PASS - Completion shows final OK/WARN/FAIL/SKIP rows and batch summary. |
| 30 | + |
| 31 | +## Duplicate-Block Evidence |
| 32 | +- PASS - First `duplicate-path.png` upload writes `projects/01K8M3K0EX7V5A3W9Q2Y6R4T1B/image/duplicate-path.png`. |
| 33 | +- PASS - Second upload of the same filename fails with `already exists`. |
| 34 | +- PASS - Count remains `1`; no duplicate asset row is created. |
| 35 | + |
| 36 | +## Saved-Edit Lock Evidence |
| 37 | +- PASS - Saved upload edit row displays Source/File as text and only exposes Usage, Tags, Save, and Cancel controls. |
| 38 | +- PASS - Repository update ignores attempted changes to asset type, source, replacement file, filename, name, and path for an existing record. |
| 39 | +- PASS - Usage and Tags changes persist. |
| 40 | + |
| 41 | +## Changed Files |
| 42 | +- `toolbox/assets/assets.js` |
| 43 | +- `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js` |
| 44 | +- `tests/playwright/tools/AssetToolMockRepository.spec.mjs` |
| 45 | +- `docs_build/dev/reports/playwright_v8_coverage_report.txt` |
| 46 | +- `docs_build/dev/reports/PR_26163_077-assets-upload-ux-and-duplicate-guard.md` |
| 47 | +- `docs_build/dev/reports/codex_review.diff` |
| 48 | +- `docs_build/dev/reports/codex_changed_files.txt` |
| 49 | + |
| 50 | +## Impacted Lanes |
| 51 | +- Assets tool runtime lane. |
| 52 | +- Assets mock repository/dev-runtime upload persistence lane. |
| 53 | +- Targeted Assets Playwright lane. |
| 54 | +- Workspace V2 contract lane. |
| 55 | + |
| 56 | +## Skipped Lanes |
| 57 | +- Full samples smoke: SKIP - explicitly out of scope; no sample runtime behavior changed. |
| 58 | +- Production auth/account system: SKIP - guest upload blocking remains the existing UI/session prompt behavior. |
| 59 | +- Unrelated toolbox tools: SKIP - scope is limited to Assets upload UX and duplicate guards. |
| 60 | + |
| 61 | +## Validation Performed |
| 62 | +- PASS - `node --check toolbox/assets/assets.js` |
| 63 | +- PASS - `node --check src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js` |
| 64 | +- PASS - `node --check tests/playwright/tools/AssetToolMockRepository.spec.mjs` |
| 65 | +- PASS - `git diff --check -- toolbox/assets/assets.js src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js tests/playwright/tools/AssetToolMockRepository.spec.mjs` |
| 66 | +- PASS - `npx playwright test tests/playwright/tools/AssetToolMockRepository.spec.mjs --workers=1 --reporter=list` -> 10 passed |
| 67 | +- PASS - `npm run test:workspace-v2` -> 5 passed in workspace-contract lane |
| 68 | + |
| 69 | +## Playwright Result |
| 70 | +- PASS - Targeted Assets Playwright: 10 passed. |
| 71 | +- PASS - Workspace V2: 5 passed. |
| 72 | + |
| 73 | +## V8 Coverage |
| 74 | +- PASS/WARN - `docs_build/dev/reports/playwright_v8_coverage_report.txt` refreshed from targeted Assets Playwright. |
| 75 | +- PASS - Browser runtime `toolbox/assets/assets.js`: 96% advisory V8 coverage. |
| 76 | +- WARN - Node-side repository file is not collected by browser V8 coverage; duplicate/edit-lock behavior is covered by targeted Playwright and syntax checks. |
| 77 | + |
| 78 | +## Manual Validation Steps |
| 79 | +1. Open `toolbox/assets/index.html?uploadProgressDelayMs=250` through the local API-backed server. |
| 80 | +2. Add Images and select multiple image files. |
| 81 | +3. Confirm upload diagnostics update while upload is running and do not show OK before final write status. |
| 82 | +4. Upload an Image file, then try uploading the same filename again for the same project. |
| 83 | +5. Confirm visible FAIL/WARN duplicate messaging and no additional asset row. |
| 84 | +6. Edit the saved asset and confirm only Usage and Tags are editable. |
| 85 | +7. Confirm the saved edit row does not allow Source/File/Filename/Path/Asset Type changes. |
| 86 | +8. Open as guest and confirm upload action prompts for a Game Foundry account without creating a record. |
| 87 | + |
| 88 | +## Samples Decision |
| 89 | +- SKIP - Full samples smoke was not run because the request explicitly said not to run it and this PR is scoped to Assets upload UX/repository behavior. |
0 commit comments