Skip to content

Commit 9019482

Browse files
committed
Create project ids only on project creation or authenticated upload - PR_26163_082-lazy-project-id-creation
1 parent 0f2d6ac commit 9019482

35 files changed

Lines changed: 1353 additions & 1158 deletions
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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.

docs_build/dev/reports/codex_changed_files.txt

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,44 +27,46 @@ M docs_build/dev/reports/coverage_changed_js_guardrail.txt
2727
M docs_build/dev/reports/testing_lane_execution_report.md
2828
M docs_build/dev/reports/validation_cache_report.md
2929
M docs_build/dev/reports/zero_browser_preflight_report.md
30+
M src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js
3031
M tests/playwright/tools/AssetToolMockRepository.spec.mjs
3132
M toolbox/assets/assets.js
3233
M toolbox/assets/index.html
33-
?? docs_build/dev/reports/PR_26163_081-assets-upload-progress-auto-hide.md
34+
?? docs_build/dev/reports/PR_26163_082-lazy-project-id-creation.md
3435

3536
# git ls-files --others --exclude-standard
36-
docs_build/dev/reports/PR_26163_081-assets-upload-progress-auto-hide.md
37+
docs_build/dev/reports/PR_26163_082-lazy-project-id-creation.md
3738

3839
# git diff --stat
39-
.../dev/reports/coverage_changed_js_guardrail.txt | 4 +-
40-
docs_build/dev/reports/dependency_gating_report.md | 2 +-
41-
.../reports/dependency_hydration_reuse_report.md | 12 ++--
42-
.../dev/reports/execution_graph_reuse_report.md | 16 ++---
43-
.../dev/reports/failure_fingerprint_report.md | 2 +-
44-
.../reports/filesystem_scan_reduction_report.md | 2 +-
45-
.../dev/reports/incremental_validation_report.md | 14 ++--
46-
docs_build/dev/reports/lane_compilation_report.md | 2 +-
47-
.../dev/reports/lane_deduplication_report.md | 2 +-
48-
.../dev/reports/lane_input_validation_report.md | 2 +-
49-
.../reports/lane_runtime_optimization_report.md | 14 ++--
50-
docs_build/dev/reports/lane_snapshot_report.md | 12 ++--
51-
docs_build/dev/reports/lane_warm_start_report.md | 12 ++--
52-
.../dev/reports/monolith_trigger_removal_report.md | 2 +-
53-
.../dev/reports/persistent_lane_manifest_report.md | 12 ++--
54-
.../playwright_discovery_ownership_report.md | 2 +-
55-
.../reports/playwright_discovery_scope_report.md | 2 +-
56-
.../dev/reports/playwright_structure_audit.md | 2 +-
57-
.../dev/reports/playwright_v8_coverage_report.txt | 7 +-
58-
docs_build/dev/reports/retry_suppression_report.md | 2 +-
59-
docs_build/dev/reports/slow_path_pruning_report.md | 16 ++---
60-
docs_build/dev/reports/static_validation_report.md | 10 +--
61-
.../dev/reports/targeted_file_manifest_report.md | 8 +--
62-
.../dev/reports/test_cleanup_performance_report.md | 22 +++---
63-
.../dev/reports/test_cleanup_routing_report.md | 2 +-
64-
.../dev/reports/testing_lane_execution_report.md | 52 +++++++-------
65-
docs_build/dev/reports/validation_cache_report.md | 30 ++++----
66-
.../dev/reports/zero_browser_preflight_report.md | 10 +--
67-
.../tools/AssetToolMockRepository.spec.mjs | 77 ++++++++++++--------
68-
toolbox/assets/assets.js | 83 ++++++++++++++++++++--
69-
toolbox/assets/index.html | 76 +++++++++++---------
70-
31 files changed, 305 insertions(+), 206 deletions(-)
40+
.../dev/reports/coverage_changed_js_guardrail.txt | 2 +-
41+
docs_build/dev/reports/dependency_gating_report.md | 2 +-
42+
.../reports/dependency_hydration_reuse_report.md | 2 +-
43+
.../dev/reports/execution_graph_reuse_report.md | 2 +-
44+
.../dev/reports/failure_fingerprint_report.md | 2 +-
45+
.../reports/filesystem_scan_reduction_report.md | 2 +-
46+
.../dev/reports/incremental_validation_report.md | 2 +-
47+
docs_build/dev/reports/lane_compilation_report.md | 2 +-
48+
.../dev/reports/lane_deduplication_report.md | 2 +-
49+
.../dev/reports/lane_input_validation_report.md | 2 +-
50+
.../reports/lane_runtime_optimization_report.md | 2 +-
51+
docs_build/dev/reports/lane_snapshot_report.md | 2 +-
52+
docs_build/dev/reports/lane_warm_start_report.md | 2 +-
53+
.../dev/reports/monolith_trigger_removal_report.md | 2 +-
54+
.../dev/reports/persistent_lane_manifest_report.md | 2 +-
55+
.../playwright_discovery_ownership_report.md | 2 +-
56+
.../reports/playwright_discovery_scope_report.md | 2 +-
57+
.../dev/reports/playwright_structure_audit.md | 2 +-
58+
.../dev/reports/playwright_v8_coverage_report.txt | 8 +-
59+
docs_build/dev/reports/retry_suppression_report.md | 2 +-
60+
docs_build/dev/reports/slow_path_pruning_report.md | 12 +-
61+
docs_build/dev/reports/static_validation_report.md | 2 +-
62+
.../dev/reports/targeted_file_manifest_report.md | 2 +-
63+
.../dev/reports/test_cleanup_performance_report.md | 14 +-
64+
.../dev/reports/test_cleanup_routing_report.md | 2 +-
65+
.../dev/reports/testing_lane_execution_report.md | 16 +-
66+
docs_build/dev/reports/validation_cache_report.md | 2 +-
67+
.../dev/reports/zero_browser_preflight_report.md | 2 +-
68+
.../tool-repositories/assets-mock-repository.js | 118 +++++++++++---
69+
.../tools/AssetToolMockRepository.spec.mjs | 177 ++++++++++++++-------
70+
toolbox/assets/assets.js | 12 +-
71+
toolbox/assets/index.html | 2 +-
72+
32 files changed, 274 insertions(+), 133 deletions(-)

0 commit comments

Comments
 (0)