Skip to content

Commit 1455f9c

Browse files
committed
Fix live browser Create Account runtime failure with operator diagnostic evidence - PR_26166_162-live-create-account-runtime-fix
1 parent a0949bf commit 1455f9c

36 files changed

Lines changed: 1268 additions & 982 deletions
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# PR_26166_162-live-create-account-runtime-fix
2+
3+
## Branch Validation
4+
5+
- Current branch: `main`
6+
- Expected branch: `main`
7+
- Result: PASS
8+
9+
## Summary
10+
11+
Fixed the manual Create Account runtime failure by making `npm run dev:local-api` load `.env.local`, use Node system CA certificates, and select Supabase Auth for the local API when DEV Supabase Auth configuration is present. Product data remains on `GAMEFOUNDRY_DB_PROVIDER=local-db`.
12+
13+
## Actual Failing Diagnostic
14+
15+
Reproduced by POSTing through the running local API before the provider-selection fix:
16+
17+
```text
18+
[auth/operator] POST /api/auth/create-account failed: Create account: Supabase Auth is not ready. Supabase Auth configuration is present, but selected auth provider is local-db. Set GAMEFOUNDRY_AUTH_PROVIDER=supabase-auth to activate external account authentication while keeping GAMEFOUNDRY_DB_PROVIDER=local-db for product data.
19+
```
20+
21+
Root cause: `npm run dev:local-api` did not load `.env.local`, did not use the same system CA behavior as `validate:supabase-dev`, and the local `.env.local` selected `GAMEFOUNDRY_AUTH_PROVIDER=local-db`. The Create Account backend never reached the ready Supabase Auth path.
22+
23+
## Fix Evidence
24+
25+
- `package.json`: `dev:local-api` now starts Node with `--use-system-ca`.
26+
- `scripts/start-local-api-server.mjs`: loads `.env.local` without printing secret values.
27+
- `scripts/start-local-api-server.mjs`: selects `supabase-auth` for the local API when Supabase DEV auth config is present.
28+
- `scripts/start-local-api-server.mjs`: keeps product data provider as `local-db`.
29+
- No `.env.local` changes.
30+
- No password tables.
31+
- No browser-owned auth/provider logic.
32+
- No silent fallback to Local DB auth.
33+
34+
Post-fix `/api/auth/status` evidence:
35+
36+
```text
37+
authProviderId: supabase-auth
38+
databaseProviderId: local-db
39+
ready: true
40+
selected: true
41+
configured: true
42+
identityTablesReady: true
43+
message: Account service is available.
44+
```
45+
46+
## Manual Browser Validation
47+
48+
Used Playwright to drive the real browser pages on the running local API:
49+
50+
- Opened `http://127.0.0.1:5501/account/create-account.html`.
51+
- Submitted the visible Create Account form.
52+
- Captured `POST /api/auth/create-account` response.
53+
- Opened `http://127.0.0.1:5501/account/sign-in.html`.
54+
- Submitted the visible Sign In form.
55+
- Queried `/api/session/current` after sign-in.
56+
57+
Result:
58+
59+
```text
60+
Create Account HTTP: 200
61+
Create Account UI status: Account created. You can sign in after confirming your email.
62+
identityProvisioned: true
63+
users row created: true
64+
user_roles row created: true
65+
roleSlugs: user
66+
Sign In HTTP: 200
67+
sessionAuthenticated: true
68+
sessionUserKeyMatchesCreatedUser: true
69+
sessionRoles: user
70+
failedRequests: none
71+
```
72+
73+
## Requirement Checklist
74+
75+
- Main branch only: PASS
76+
- Read `docs_build/dev/PROJECT_INSTRUCTIONS.md`: PASS
77+
- Do not make test-only changes: PASS
78+
- Reproduce manual failure through Create Account runtime path: PASS
79+
- Capture server-side `[auth/operator]` diagnostic: PASS
80+
- Fix runtime cause: PASS
81+
- Keep `GAMEFOUNDRY_DB_PROVIDER=local-db`: PASS
82+
- No secrets or `.env.local` commits: PASS
83+
- No password tables: PASS
84+
- No browser-owned auth/provider logic: PASS
85+
- No silent fallback: PASS
86+
- Manual browser Create Account succeeds before reporting PASS: PASS
87+
- Validate account created, users row, user_roles row, and sign-in works: PASS
88+
89+
## Validation Performed
90+
91+
- `node --check scripts/start-local-api-server.mjs` - PASS
92+
- `node --check src/dev-runtime/server/local-api-router.mjs` - PASS
93+
- `npm run validate:supabase-dev` - PASS with expected advisory direct PostgreSQL TLS WARN; REST/API identity checks passed.
94+
- `npm run dev:local-api` - PASS, server running at `http://127.0.0.1:5501/`.
95+
- Real browser Create Account and Sign In validation - PASS.
96+
- `node --test tests/dev-runtime/SupabaseProviderContractStub.test.mjs` - PASS, 28 tests.
97+
- `npm run test:workspace-v2` - PASS, 5 Playwright tests.
98+
- `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs --project=playwright --workers=1 --reporter=list --grep "Configured account auth actions|Create Account shows generic"` - PASS, 2 tests.
99+
100+
## Validation Notes
101+
102+
- Attempted full `LoginSessionMode.spec.mjs`; it exceeded the command timeout before producing useful output. Re-ran the relevant Create Account and external auth tests by grep and they passed.
103+
- Full samples smoke was skipped because the PR only affects auth/local API startup and account flow validation, not sample runtime behavior.
104+
105+
## Impacted Lanes
106+
107+
- runtime
108+
- integration
109+
- account/auth session
110+
111+
## Changed Files
112+
113+
- `package.json`
114+
- `scripts/start-local-api-server.mjs`
115+
- Validation reports under `docs_build/dev/reports/`
116+
- `docs_build/dev/reports/PR_26166_162-live-create-account-runtime-fix.md`
117+
- `docs_build/dev/reports/codex_review.diff`
118+
- `docs_build/dev/reports/codex_changed_files.txt`
119+
Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,74 @@
11
# git status --short
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/coverage_changed_js_guardrail.txt
2+
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
3+
M docs_build/dev/reports/dependency_gating_report.md
4+
M docs_build/dev/reports/dependency_hydration_reuse_report.md
5+
M docs_build/dev/reports/execution_graph_reuse_report.md
6+
M docs_build/dev/reports/failure_fingerprint_report.md
7+
M docs_build/dev/reports/filesystem_scan_reduction_report.md
8+
M docs_build/dev/reports/incremental_validation_report.md
9+
M docs_build/dev/reports/lane_compilation_report.md
10+
M docs_build/dev/reports/lane_deduplication_report.md
11+
M docs_build/dev/reports/lane_input_validation_report.md
12+
M docs_build/dev/reports/lane_manifests/workspace-contract.json
13+
M docs_build/dev/reports/lane_runtime_optimization_report.md
14+
M docs_build/dev/reports/lane_snapshot_report.md
15+
M docs_build/dev/reports/lane_snapshots/workspace-contract.json
16+
M docs_build/dev/reports/lane_warm_start_report.md
17+
M docs_build/dev/reports/lane_warm_starts/workspace-contract.json
18+
M docs_build/dev/reports/monolith_trigger_removal_report.md
19+
M docs_build/dev/reports/persistent_lane_manifest_report.md
20+
M docs_build/dev/reports/playwright_discovery_ownership_report.md
21+
M docs_build/dev/reports/playwright_discovery_scope_report.md
22+
M docs_build/dev/reports/playwright_structure_audit.md
523
M docs_build/dev/reports/playwright_v8_coverage_report.txt
6-
M src/dev-runtime/server/local-api-router.mjs
7-
M tests/dev-runtime/SupabaseProviderContractStub.test.mjs
8-
M tests/playwright/tools/LoginSessionMode.spec.mjs
9-
?? docs_build/dev/reports/PR_26166_161-create-account-defect-fix.md
24+
M docs_build/dev/reports/retry_suppression_report.md
25+
M docs_build/dev/reports/slow_path_pruning_report.md
26+
M docs_build/dev/reports/static_validation_report.md
27+
M docs_build/dev/reports/targeted_file_manifest_report.md
28+
M docs_build/dev/reports/test_cleanup_performance_report.md
29+
M docs_build/dev/reports/test_cleanup_routing_report.md
30+
M docs_build/dev/reports/testing_lane_execution_report.md
31+
M docs_build/dev/reports/validation_cache_report.md
32+
M docs_build/dev/reports/zero_browser_preflight_report.md
33+
M package.json
34+
M scripts/start-local-api-server.mjs
35+
?? docs_build/dev/reports/PR_26166_162-live-create-account-runtime-fix.md
1036

1137
# git ls-files --others --exclude-standard
12-
docs_build/dev/reports/PR_26166_161-create-account-defect-fix.md
38+
docs_build/dev/reports/PR_26166_162-live-create-account-runtime-fix.md
1339

1440
# git diff --stat
15-
docs_build/dev/reports/codex_changed_files.txt | 38 +-
16-
docs_build/dev/reports/codex_review.diff | 851 +++++++++++++--------
17-
.../dev/reports/coverage_changed_js_guardrail.txt | 10 +-
18-
.../dev/reports/playwright_v8_coverage_report.txt | 35 +-
19-
src/dev-runtime/server/local-api-router.mjs | 52 +-
20-
.../SupabaseProviderContractStub.test.mjs | 108 +++
21-
tests/playwright/tools/LoginSessionMode.spec.mjs | 80 ++
22-
7 files changed, 778 insertions(+), 396 deletions(-)
41+
.../dev/reports/coverage_changed_js_guardrail.txt | 3 -
42+
docs_build/dev/reports/dependency_gating_report.md | 2 +-
43+
.../reports/dependency_hydration_reuse_report.md | 4 +-
44+
.../dev/reports/execution_graph_reuse_report.md | 4 +-
45+
.../dev/reports/failure_fingerprint_report.md | 2 +-
46+
.../reports/filesystem_scan_reduction_report.md | 2 +-
47+
.../dev/reports/incremental_validation_report.md | 2 +-
48+
docs_build/dev/reports/lane_compilation_report.md | 2 +-
49+
.../dev/reports/lane_deduplication_report.md | 2 +-
50+
.../dev/reports/lane_input_validation_report.md | 2 +-
51+
.../reports/lane_manifests/workspace-contract.json | 10 ++--
52+
.../reports/lane_runtime_optimization_report.md | 2 +-
53+
docs_build/dev/reports/lane_snapshot_report.md | 4 +-
54+
.../reports/lane_snapshots/workspace-contract.json | 22 +++----
55+
docs_build/dev/reports/lane_warm_start_report.md | 4 +-
56+
.../lane_warm_starts/workspace-contract.json | 16 ++---
57+
.../dev/reports/monolith_trigger_removal_report.md | 2 +-
58+
.../dev/reports/persistent_lane_manifest_report.md | 6 +-
59+
.../playwright_discovery_ownership_report.md | 2 +-
60+
.../reports/playwright_discovery_scope_report.md | 2 +-
61+
.../dev/reports/playwright_structure_audit.md | 2 +-
62+
.../dev/reports/playwright_v8_coverage_report.txt | 21 ++-----
63+
docs_build/dev/reports/retry_suppression_report.md | 2 +-
64+
docs_build/dev/reports/slow_path_pruning_report.md | 14 ++---
65+
docs_build/dev/reports/static_validation_report.md | 4 +-
66+
.../dev/reports/targeted_file_manifest_report.md | 4 +-
67+
.../dev/reports/test_cleanup_performance_report.md | 16 ++---
68+
.../dev/reports/test_cleanup_routing_report.md | 2 +-
69+
.../dev/reports/testing_lane_execution_report.md | 18 +++---
70+
docs_build/dev/reports/validation_cache_report.md | 30 +++++-----
71+
.../dev/reports/zero_browser_preflight_report.md | 2 +-
72+
package.json | 2 +-
73+
scripts/start-local-api-server.mjs | 70 ++++++++++++++++++++++
74+
33 files changed, 168 insertions(+), 114 deletions(-)

0 commit comments

Comments
 (0)