|
| 1 | +# PR_26163_082-lazy-project-id-creation |
| 2 | + |
| 3 | +## Branch Validation |
| 4 | + |
| 5 | +- PASS: Current branch is `main`. |
| 6 | +- PASS: Expected branch is `main`. |
| 7 | + |
| 8 | +## Requirement Checklist |
| 9 | + |
| 10 | +- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before changes. |
| 11 | +- PASS: Assets no longer creates a project id during page load, session init, guest init, or tool launch. `toolbox/assets/assets.js` no longer calls the setup helper during normal launch. |
| 12 | +- PASS: Project Path remains empty/placeholder before project creation or upload. Initial UI text is `No project path yet` in `toolbox/assets/index.html`. |
| 13 | +- PASS: Authenticated upload resolves an existing current project id first through `ensureUploadProject()`. |
| 14 | +- PASS: Authenticated upload with no current project id creates exactly one project id at upload start. |
| 15 | +- PASS: `projects/<projectId>/` is created only when the first uploaded file is written. |
| 16 | +- PASS: Guest upload still blocks with `Uploads require a Game Foundry account.` plus `Sign In` and `Create Account` actions. |
| 17 | +- PASS: Guest upload creates no project id and no project folder. |
| 18 | +- PASS: Existing project id is reused for later uploads in the same authenticated session. |
| 19 | +- PASS: The old fallback project id `01K8M3K0EX7V5A3W9Q2Y6R4T1B` is not used by the active Assets project-id creation path. |
| 20 | +- PASS: `/projects/` path safety, duplicate blocking, delete-file behavior, and upload diagnostics remain covered by the targeted Assets tests. |
| 21 | +- PASS: `codex_review.diff` is generated as readable UTF-8 text. |
| 22 | + |
| 23 | +## Implementation Evidence |
| 24 | + |
| 25 | +- `toolbox/assets/assets.js:283` returns `No project path yet` when no project id exists. |
| 26 | +- `toolbox/assets/assets.js:1061` gates upload save through `saveUploadBatch`. |
| 27 | +- `toolbox/assets/assets.js:1062` blocks guest uploads before project creation. |
| 28 | +- `toolbox/assets/assets.js:1068` calls `repository.ensureUploadProject()` only after the upload action is authenticated and files are selected. |
| 29 | +- `toolbox/assets/index.html:60` initializes the Project Path display as `No project path yet`. |
| 30 | +- `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js:274` generates lazy project ids. |
| 31 | +- `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js:641` defines `ensureUploadProject()`. |
| 32 | +- `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js:642` blocks explicit guest sessions from creating upload project ids. |
| 33 | +- `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js:651` reuses an existing configured/owned project id before creating a new id. |
| 34 | +- `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js:662` creates a new upload project id only when needed. |
| 35 | +- `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js:1671` creates an upload project id for validated upload records only. |
| 36 | + |
| 37 | +## Lazy Project Id Evidence |
| 38 | + |
| 39 | +- PASS: New Assets page/tool launch does not create a project id. Playwright test `Assets upload writes to the project folder before creating a record and Image View renders the file` captures project folders before launch and confirms they are unchanged before upload. |
| 40 | +- PASS: Project Path before upload shows `Path: No project path yet`. |
| 41 | +- PASS: Authenticated upload with no current project id creates one generated id at upload start. Playwright test `Assets authenticated upload lazily creates one project id when no current project exists` verifies no folder exists on launch, then verifies uploaded files are written under the generated id. |
| 42 | +- PASS: Existing project id is reused for later uploads. The upload/write Playwright test uploads a second image and verifies the same project id is retained. |
| 43 | +- PASS: First file write creates the asset-type folder through the existing guarded write path. Targeted tests verify `projects/<projectId>/image/` exists only after the write succeeds. |
| 44 | + |
| 45 | +## Guest No-Project Evidence |
| 46 | + |
| 47 | +- PASS: Guest upload is blocked in UI before project creation. |
| 48 | +- PASS: Explicit guest sessions are also blocked in the mock repository. |
| 49 | +- PASS: Playwright test `Assets guest upload action shows account prompt and creates no record` verifies: |
| 50 | + - Project Path remains `Path: No project path yet`. |
| 51 | + - The account-required prompt appears. |
| 52 | + - No asset record is created. |
| 53 | + - Project folders are unchanged. |
| 54 | + |
| 55 | +## Search Evidence |
| 56 | + |
| 57 | +- PASS: Scoped active Assets search found no exact old fallback id: |
| 58 | + - Command: `rg -n "01K8M3K0EX7V5A3W9Q2Y6R4T1B|DEMO_ASSET_PROJECT_ID|Path: projects/" toolbox/assets src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js tests/playwright/tools/AssetToolMockRepository.spec.mjs` |
| 59 | + - Result: no matches. |
| 60 | +- PASS: Active Assets code has only the explicit setup helper definition remaining: |
| 61 | + - Command: `rg -n "makeReadyGameConfiguration\\(" toolbox/assets/assets.js src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js tests/playwright/tools/AssetToolMockRepository.spec.mjs` |
| 62 | + - Result: one definition in the repository file, no active page-launch call. |
| 63 | +- NOTE: A broader non-report search still finds the old id in `tests/playwright/tools/ObjectsTool.spec.mjs` as an Objects sprite fixture and in historical docs. Those are outside this PR's Assets lazy project creation path and do not create projects on session start. |
| 64 | + |
| 65 | +## Impacted Lanes |
| 66 | + |
| 67 | +- Assets tool runtime/UI. |
| 68 | +- Assets dev-runtime mock repository. |
| 69 | +- Assets Playwright coverage. |
| 70 | +- Workspace V2 contract lane, because it is explicitly required by this PR. |
| 71 | + |
| 72 | +## Skipped Lanes |
| 73 | + |
| 74 | +- Full samples smoke: SKIP by request. No sample JSON, runtime sample, or production game behavior was changed. |
| 75 | +- Engine runtime input lanes: SKIP because this PR only changes Assets project-id/upload behavior. |
| 76 | +- Account/User Controls lanes: SKIP because this PR does not change account profile behavior beyond preserving the existing guest upload prompt. |
| 77 | + |
| 78 | +## Validation Performed |
| 79 | + |
| 80 | +- PASS: `git branch --show-current` -> `main`. |
| 81 | +- PASS: `node --check toolbox/assets/assets.js`. |
| 82 | +- PASS: `node --check src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js`. |
| 83 | +- PASS: `node --check tests/playwright/tools/AssetToolMockRepository.spec.mjs`. |
| 84 | +- PASS: `git diff --check -- toolbox/assets/assets.js toolbox/assets/index.html src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js tests/playwright/tools/AssetToolMockRepository.spec.mjs docs_build/dev/reports/playwright_v8_coverage_report.txt` with only existing CRLF normalization warnings for touched files. |
| 85 | +- PASS: `npm run test:workspace-v2` -> 5 passed. |
| 86 | +- PASS: `npx playwright test tests/playwright/tools/AssetToolMockRepository.spec.mjs --workers=1 --reporter=list` -> 15 passed. |
| 87 | + |
| 88 | +## Playwright Result |
| 89 | + |
| 90 | +- PASS: Targeted Assets Playwright: 15 passed. |
| 91 | +- PASS: Workspace V2 lane: 5 passed. |
| 92 | + |
| 93 | +## V8 Coverage |
| 94 | + |
| 95 | +- PASS: `toolbox/assets/assets.js` collected by browser V8 coverage at 92%. |
| 96 | +- WARN: `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js` is Node/dev-runtime code and is not collected by browser V8 coverage. It is covered by the targeted repository and upload Playwright behaviors. |
| 97 | +- Report: `docs_build/dev/reports/playwright_v8_coverage_report.txt`. |
| 98 | + |
| 99 | +## Manual Validation Steps |
| 100 | + |
| 101 | +1. Launch `toolbox/assets/index.html` in a fresh authenticated session. |
| 102 | +2. Confirm the centered Project Path reads `Path: No project path yet`. |
| 103 | +3. Confirm no new folder appears under `projects/`. |
| 104 | +4. Select an Image upload file. |
| 105 | +5. Confirm upload auto-starts, one project id is created, and `projects/<projectId>/image/<filename>` is written. |
| 106 | +6. Upload a second Image and confirm it reuses the same project id. |
| 107 | +7. Launch as guest and select an upload file. |
| 108 | +8. Confirm the account-required prompt appears and no project id or project folder is created. |
| 109 | + |
| 110 | +## Samples Decision |
| 111 | + |
| 112 | +- SKIP: Full samples smoke was not run because the request explicitly says not to run full samples smoke and this PR does not change samples. |
0 commit comments