|
| 1 | +# PR_26163_079-assets-byte-accurate-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: Continued from PR_26163_078. |
| 13 | +- PASS: Replaced staged upload progress with byte-based progress. |
| 14 | +- PASS: Progress bar percentage is calculated as `bytesUploaded / totalBytes`. |
| 15 | +- PASS: Upload file processing now runs through `toolbox/assets/assets-upload-worker.js`. |
| 16 | +- PASS: Dev/test throttled uploads update incrementally per worker chunk. |
| 17 | +- PASS: Progress starts at 0 before first bytes upload. |
| 18 | +- PASS: Progress does not jump to 50% on start. |
| 19 | +- PASS: Progress reaches 100 only after selected bytes are processed and repository write succeeds. |
| 20 | +- PASS: Failed write after byte transfer shows FAIL and creates no asset record. |
| 21 | +- PASS: Batch progress uses summed uploaded bytes divided by summed selected bytes. |
| 22 | +- PASS: Inline upload progress remains below each upload-capable asset table. |
| 23 | +- PASS: `/projects/` directory validation and create-if-missing behavior are preserved from PR_26163_078. |
| 24 | +- PASS: Duplicate same folder/filename blocking is preserved. |
| 25 | +- PASS: `codex_review.diff` is UTF-8 readable. |
| 26 | +- PASS: Full samples smoke was not run. |
| 27 | + |
| 28 | +## Byte Progress Evidence |
| 29 | + |
| 30 | +- Playwright test `Assets worker upload progress is byte accurate and keeps the UI responsive` validates: |
| 31 | + - progress value starts at `0`; |
| 32 | + - bytes uploaded starts at `0 B`; |
| 33 | + - first chunk progress is greater than `0`, less than `50`, and not equal to `50`; |
| 34 | + - later chunk progress is greater than the first chunk value; |
| 35 | + - final successful upload reaches `100`. |
| 36 | +- Playwright test `Assets batch progress uses summed uploaded bytes across selected files` validates two equal 20-byte files reach `50` after the first file succeeds, then `100` when both writes succeed. |
| 37 | +- Playwright test `Assets upload write failure after byte transfer is visible and creates no asset record` validates bytes progress becomes greater than `0`, remains below `100`, shows FAIL, and asset count stays `0`. |
| 38 | + |
| 39 | +## UI Responsiveness Evidence |
| 40 | + |
| 41 | +- During throttled worker upload, Playwright toggles the Audio accordion and verifies its `open` state changes. |
| 42 | +- During throttled worker upload, Playwright scrolls the page and verifies `window.scrollY > 0`. |
| 43 | +- Progress fields continue rendering while the UI remains interactive: BPS, speed, ETA, elapsed, current file, and per-file status are asserted during/after throttled upload. |
| 44 | +- No cancel/stop upload control exists in the current Assets UI; no cancel behavior was added in this PR. |
| 45 | + |
| 46 | +## Worker / Background Execution Evidence |
| 47 | + |
| 48 | +- New worker file: `toolbox/assets/assets-upload-worker.js`. |
| 49 | +- Assets page creates the worker with `new Worker(UPLOAD_WORKER_URL, { type: "module" })`. |
| 50 | +- Playwright waits for the `worker` event and asserts the worker URL contains `toolbox/assets/assets-upload-worker.js`. |
| 51 | +- Inline upload diagnostics expose worker status (`Active`, `Write Pending`, `Complete`, `Failed`) for validation. |
| 52 | + |
| 53 | +## Throttled Upload Evidence |
| 54 | + |
| 55 | +- Dev/test throttling remains query-parameter controlled through `uploadProgressDelayMs`. |
| 56 | +- Added dev/test chunk-size control through `uploadChunkSizeBytes`. |
| 57 | +- Targeted tests use throttled uploads with small chunks to validate incremental progress without affecting production uploads. |
| 58 | + |
| 59 | +## Changed Files |
| 60 | + |
| 61 | +- `toolbox/assets/assets.js` |
| 62 | +- `toolbox/assets/assets-upload-worker.js` |
| 63 | +- `tests/playwright/tools/AssetToolMockRepository.spec.mjs` |
| 64 | +- `docs_build/dev/reports/playwright_v8_coverage_report.txt` |
| 65 | +- `docs_build/dev/reports/PR_26163_079-assets-byte-accurate-upload-progress.md` |
| 66 | +- `docs_build/dev/reports/codex_review.diff` |
| 67 | +- `docs_build/dev/reports/codex_changed_files.txt` |
| 68 | + |
| 69 | +## Impacted Lanes |
| 70 | + |
| 71 | +- runtime: Assets upload UI progress and worker-backed file processing. |
| 72 | +- integration: Assets upload path through server/mock repository remains exercised by Playwright. |
| 73 | +- recovery/UAT: targeted Assets Playwright coverage for throttled upload behavior and failure behavior. |
| 74 | + |
| 75 | +## Skipped Lanes |
| 76 | + |
| 77 | +- samples: SKIP. This PR is scoped to Toolbox Assets upload progress and does not change sample runtime contracts. |
| 78 | +- engine: SKIP. No engine input/render/game runtime files changed. |
| 79 | + |
| 80 | +## Validation Performed |
| 81 | + |
| 82 | +- PASS: `node --check toolbox/assets/assets.js` |
| 83 | +- PASS: `node --check toolbox/assets/assets-upload-worker.js` |
| 84 | +- PASS: `node --check tests/playwright/tools/AssetToolMockRepository.spec.mjs` |
| 85 | +- PASS: `git diff --check -- toolbox/assets/assets.js toolbox/assets/assets-upload-worker.js tests/playwright/tools/AssetToolMockRepository.spec.mjs` |
| 86 | +- PASS: `git diff --check -- .` |
| 87 | +- PASS: `npx playwright test tests/playwright/tools/AssetToolMockRepository.spec.mjs --workers=1 --reporter=list` |
| 88 | + - Result: 13 passed. |
| 89 | +- PASS: `npm run test:workspace-v2` |
| 90 | + - Result: workspace-contract lane passed, 5 Playwright tests passed. |
| 91 | + |
| 92 | +## Playwright Result |
| 93 | + |
| 94 | +- PASS: Targeted Assets Playwright suite passed 13/13. |
| 95 | +- PASS: `npm run test:workspace-v2` passed. |
| 96 | + |
| 97 | +## V8 Coverage |
| 98 | + |
| 99 | +- Coverage report: `docs_build/dev/reports/playwright_v8_coverage_report.txt` |
| 100 | +- PASS: `toolbox/assets/assets.js` collected browser V8 coverage: 93%. |
| 101 | +- WARN: `toolbox/assets/assets-upload-worker.js` is listed in the changed runtime JS coverage report, but Chromium page-level V8 coverage did not collect dedicated worker script coverage. Worker execution is still validated by Playwright worker-event assertions. |
| 102 | +- WARN: `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js` appears from the stacked HEAD changed-file coverage baseline and is Node-side repository code not collected by Chromium page coverage. |
| 103 | + |
| 104 | +## Manual Validation Steps |
| 105 | + |
| 106 | +1. Open `/toolbox/assets/index.html?uploadProgressDelayMs=180&uploadChunkSizeBytes=8` in local DB mode. |
| 107 | +2. Reset Asset Library. |
| 108 | +3. Add Images, choose a usage, and select a file. |
| 109 | +4. Confirm inline upload progress starts at `0%`, then increments by bytes instead of jumping to `50%`. |
| 110 | +5. Confirm BPS, speed, ETA, elapsed, current file, and bytes uploaded update while the upload is running. |
| 111 | +6. Toggle another asset accordion during upload and confirm it remains responsive. |
| 112 | +7. Confirm successful write reaches `100%` and creates one asset record. |
| 113 | +8. Repeat with write support disabled and confirm FAIL appears, progress remains below `100%`, and no record is created. |
| 114 | + |
| 115 | +## Samples Validation |
| 116 | + |
| 117 | +- Full samples smoke: SKIP. |
| 118 | +- Reason: requested skip, and this PR is limited to Assets upload progress behavior. |
0 commit comments