Skip to content

Commit 19a0289

Browse files
committed
Add inline asset upload progress with project directory validation - PR_26163_078-assets-inline-upload-progress
1 parent 298a826 commit 19a0289

7 files changed

Lines changed: 2555 additions & 453 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# PR_26163_078-assets-inline-upload-progress
2+
3+
## Branch Validation
4+
5+
- Current branch: `main`
6+
- Expected branch: `main`
7+
- Branch validation: PASS
8+
9+
## Requirement Checklist
10+
11+
- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before changes.
12+
- PASS: Added upload directory validation before file writes in `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js`.
13+
- PASS: Upload path resolution now validates project id, asset type folder, target directory, and target file path under `projects/<projectId>/<asset-type>/`.
14+
- PASS: Missing target directories under `projects/<projectId>/<asset-type>/` are created before file write.
15+
- PASS: Directory creation/validation failures return visible FAIL diagnostics and do not create asset records.
16+
- PASS: Path traversal or resolved paths outside the current project asset folder fail before write.
17+
- PASS: Upload diagnostics include target directory and directory result/status.
18+
- PASS: Inline upload progress remains under upload-capable asset accordion tables.
19+
- PASS: Sprite, Vector, and Palette References remain reference-only for MVP.
20+
- PASS: `codex_review.diff` generation path is preserved as UTF-8 readable text.
21+
- PASS: Full samples smoke was not run.
22+
23+
## Directory Validation Evidence
24+
25+
- Created directory evidence: Playwright validates upload creates `projects/01K8M3K0EX7V5A3W9Q2Y6R4T1B/image/` when missing, then writes `write-view-image.png`.
26+
- Existing directory evidence: duplicate upload validation shows `Directory exists: projects/01K8M3K0EX7V5A3W9Q2Y6R4T1B/image.` and blocks the duplicate record.
27+
- Failed directory evidence: targeted escape-path validation shows `target path must stay under /projects/<projectId>/`, `Write result: FAIL: Directory validation`, and `Directory status: failed`.
28+
- Asset record creation evidence: tests verify record count stays `0` when directory validation fails and increases only after a successful directory validation plus file write.
29+
30+
## Project Path Evidence
31+
32+
- Stored upload path remains full project-relative path: `projects/<projectId>/image/<filename>`.
33+
- Preview display remains asset-type-relative in tables: `image/<filename>`.
34+
- Physical file write validation checked `projects/01K8M3K0EX7V5A3W9Q2Y6R4T1B/image/write-view-image.png` exists and contains the selected bytes.
35+
36+
## Upload Progress Evidence
37+
38+
- Inline progress is rendered under the Images asset table through `data-asset-tool-inline-upload-progress`.
39+
- Playwright validates current file, file count, bytes uploaded, total bytes, BPS, speed, ETA, elapsed, per-file OK rows, and batch summary in the inline progress panel.
40+
- The existing inspector upload dialog remains intact and mirrors the same upload progress information.
41+
42+
## Changed Files
43+
44+
- `toolbox/assets/assets.js`
45+
- `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js`
46+
- `tests/playwright/tools/AssetToolMockRepository.spec.mjs`
47+
- `docs_build/dev/reports/playwright_v8_coverage_report.txt`
48+
- `docs_build/dev/reports/PR_26163_078-assets-inline-upload-progress.md`
49+
- `docs_build/dev/reports/codex_review.diff`
50+
- `docs_build/dev/reports/codex_changed_files.txt`
51+
52+
## Impacted Lanes
53+
54+
- runtime: Assets tool browser upload UI and inline progress rendering.
55+
- integration: Assets tool API/mock repository upload persistence path.
56+
- recovery/UAT: targeted Playwright coverage for upload directory validation and progress diagnostics.
57+
58+
## Skipped Lanes
59+
60+
- samples: SKIP. This PR changes the Assets tool upload UI and mock repository write validation only; no sample runtime JSON or sample smoke surface changed.
61+
- engine: SKIP. No `src/engine/input`, render, or game runtime behavior changed.
62+
63+
## Validation Performed
64+
65+
- PASS: `node --check toolbox/assets/assets.js`
66+
- PASS: `node --check src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js`
67+
- PASS: `node --check tests/playwright/tools/AssetToolMockRepository.spec.mjs`
68+
- PASS: `git diff --check -- toolbox/assets/assets.js src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js tests/playwright/tools/AssetToolMockRepository.spec.mjs`
69+
- PASS: `git diff --check -- .`
70+
- PASS: `npx playwright test tests/playwright/tools/AssetToolMockRepository.spec.mjs --workers=1 --reporter=list`
71+
- Result: 11 passed.
72+
- PASS: `npm run test:workspace-v2`
73+
- Result: workspace-contract lane passed, 5 Playwright tests passed.
74+
75+
## Playwright Result
76+
77+
- PASS: Targeted Assets Playwright suite passed 11/11.
78+
- PASS: `npm run test:workspace-v2` passed.
79+
80+
## V8 Coverage
81+
82+
- Coverage report: `docs_build/dev/reports/playwright_v8_coverage_report.txt`
83+
- PASS: `toolbox/assets/assets.js` collected browser V8 coverage: 96%.
84+
- WARN: `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js` is Node-side repository code and is listed as not collected by Chromium V8 browser coverage. Behavior is covered by targeted Playwright through the server API plus direct repository assertions.
85+
86+
## Manual Validation Steps
87+
88+
1. Open `/toolbox/assets/index.html` in local DB mode.
89+
2. Reset Asset Library.
90+
3. Add Images and select an image file.
91+
4. Confirm inline upload progress appears under the Images table and inspector upload diagnostics also update.
92+
5. Confirm diagnostics show project id, target directory, directory result/status, target file path, write result, and view path.
93+
6. Confirm the uploaded file exists under `projects/<projectId>/image/`.
94+
7. Attempt a duplicate filename and confirm upload fails without adding a duplicate record.
95+
96+
## Samples Validation
97+
98+
- Full samples smoke: SKIP.
99+
- Reason: requested skip, and this PR is scoped to Assets tool upload validation and mock repository file writes.
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# git status --short
2-
M docs_build/dev/reports/playwright_v8_coverage_report.txt
2+
M docs_build/dev/reports/codex_changed_files.txt
3+
M docs_build/dev/reports/codex_review.diff
4+
M docs_build/dev/reports/playwright_v8_coverage_report.txt
35
M src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js
46
M tests/playwright/tools/AssetToolMockRepository.spec.mjs
57
M toolbox/assets/assets.js
6-
?? docs_build/dev/reports/PR_26163_077-assets-upload-ux-and-duplicate-guard.md
8+
?? docs_build/dev/reports/PR_26163_078-assets-inline-upload-progress.md
79

810
# git ls-files --others --exclude-standard
9-
docs_build/dev/reports/PR_26163_077-assets-upload-ux-and-duplicate-guard.md
11+
docs_build/dev/reports/PR_26163_078-assets-inline-upload-progress.md
1012

1113
# git diff --stat
12-
.../dev/reports/playwright_v8_coverage_report.txt | 8 +-
13-
.../tool-repositories/assets-mock-repository.js | 31 ++++--
14-
.../tools/AssetToolMockRepository.spec.mjs | 109 +++++++++++++++++----
15-
toolbox/assets/assets.js | 51 +++++++---
16-
4 files changed, 153 insertions(+), 46 deletions(-)
14+
docs_build/dev/reports/codex_changed_files.txt | 14 +-
15+
docs_build/dev/reports/codex_review.diff | 1160 +++++++++++++-------
16+
.../dev/reports/playwright_v8_coverage_report.txt | 6 +-
17+
.../tool-repositories/assets-mock-repository.js | 198 +++-
18+
.../tools/AssetToolMockRepository.spec.mjs | 61 +
19+
toolbox/assets/assets.js | 177 ++-
20+
6 files changed, 1162 insertions(+), 454 deletions(-)

0 commit comments

Comments
 (0)