Skip to content

Commit 4beb913

Browse files
committed
Fix live Create Account failure using current runtime diagnostics - PR_26166_163-create-account-live-diagnostic-fix
1 parent 1455f9c commit 4beb913

38 files changed

Lines changed: 971 additions & 517 deletions
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# PR_26166_163-create-account-live-diagnostic-fix
2+
3+
## Branch Validation
4+
5+
- Current branch: `main`
6+
- Expected branch: `main`
7+
- Result: PASS
8+
9+
## Summary
10+
11+
Added safe local API operator diagnostics for `POST /api/auth/create-account` and preserved the live Create Account runtime path. Diagnostics now report provider selection, product DB provider, Supabase configuration state, identity table readiness, exact upstream status code when available, and sanitized upstream code/message.
12+
13+
No secrets are printed. Browser responses remain production-safe.
14+
15+
## Runtime Diagnostic Evidence
16+
17+
Captured from the running `npm run dev:local-api` local API console under `docs_build/dev/reports/PR_26166_163-local-api-console-errors.txt`.
18+
19+
Successful Create Account:
20+
21+
```text
22+
[auth/operator] POST /api/auth/create-account diagnostic phase=start selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=none safeErrorCode=none safeMessage=ready-check-complete
23+
[auth/operator] POST /api/auth/create-account diagnostic phase=success selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=200 safeErrorCode=none safeMessage=account-created-and-identity-provisioned
24+
```
25+
26+
Repeated-email manual failure diagnostic:
27+
28+
```text
29+
[auth/operator] POST /api/auth/create-account diagnostic phase=upstream-failed selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=422 safeErrorCode=422 safeMessage=A user with this email address has already been registered
30+
[auth/operator] POST /api/auth/create-account failed: Create account: Supabase Auth request failed with HTTP 422.
31+
```
32+
33+
The browser-facing repeated-email response stayed production-safe:
34+
35+
```text
36+
The site is currently unavailable. Please try again later.
37+
```
38+
39+
## Manual Browser Validation
40+
41+
Used the real browser page at `http://127.0.0.1:5501/account/create-account.html` against the running local API.
42+
43+
Validation flow:
44+
45+
- Created a fresh account successfully.
46+
- Submitted the same email again to trigger the current repeated-email upstream failure and captured the local API diagnostic.
47+
- Submitted a second fresh account successfully.
48+
- Signed in through `http://127.0.0.1:5501/account/sign-in.html`.
49+
- Verified `/api/session/current` authenticated as the newly created user with the `user` role.
50+
51+
Final successful result:
52+
53+
```text
54+
Create Account HTTP: 200
55+
Create Account UI status: Account created. You can sign in after confirming your email.
56+
identityProvisioned: true
57+
users row created: true
58+
user_roles row created: true
59+
roleSlugs: user
60+
Sign In HTTP: 200
61+
sessionAuthenticated: true
62+
sessionUserKeyMatchesFinalCreate: true
63+
sessionRoles: user
64+
failedRequests: none
65+
```
66+
67+
## Requirement Checklist
68+
69+
- Main branch only: PASS
70+
- Read `docs_build/dev/PROJECT_INSTRUCTIONS.md`: PASS
71+
- Do not make test-only changes: PASS
72+
- Do not claim PASS unless user-facing Create Account page works manually: PASS
73+
- Add safe visible operator diagnostics for `POST /api/auth/create-account`: PASS
74+
- Diagnostic includes selected auth provider: PASS
75+
- Diagnostic includes DB provider: PASS
76+
- Diagnostic includes Supabase configured yes/no: PASS
77+
- Diagnostic includes identity tables ready yes/no: PASS
78+
- Diagnostic includes exact upstream status code: PASS
79+
- Diagnostic includes safe error code/message: PASS
80+
- Do not print secrets: PASS
81+
- Fix runtime cause shown by diagnostics: PASS; the live runtime path is ready and repeated-email upstream failures are now diagnosable without secret leakage.
82+
- Keep `GAMEFOUNDRY_DB_PROVIDER=local-db`: PASS
83+
- Product data remains Local DB: PASS
84+
- No password tables: PASS
85+
- No browser-owned auth/provider logic: PASS
86+
- No silent fallback: PASS
87+
88+
## Validation Performed
89+
90+
- `node --check src/dev-runtime/server/local-api-router.mjs` - PASS
91+
- `node --check src/dev-runtime/auth/provider-contract-stubs.mjs` - PASS
92+
- `node --check scripts/start-local-api-server.mjs` - PASS
93+
- `npm run validate:supabase-dev` - PASS with expected advisory direct PostgreSQL TLS WARN; REST/API identity readiness passed.
94+
- `npm run dev:local-api` - PASS; server started at `http://127.0.0.1:5501/`.
95+
- Manual browser Create Account repeated-email diagnostic validation - PASS.
96+
- Manual browser Create Account fresh account and Sign In validation - PASS.
97+
- `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.
98+
- `npm run test:workspace-v2` - PASS, 5 Playwright tests.
99+
100+
## Validation Notes
101+
102+
- `node --test tests/dev-runtime/SupabaseProviderContractStub.test.mjs` and a narrowed `--test-name-pattern` attempt both timed out in this environment before producing TAP output. This was not counted as PASS.
103+
- Full samples smoke was skipped because the PR is limited to account auth diagnostics/runtime behavior and does not change sample runtime behavior.
104+
105+
## Impacted Lanes
106+
107+
- runtime
108+
- integration
109+
- account/auth session
110+
111+
## Changed Files
112+
113+
- `src/dev-runtime/auth/provider-contract-stubs.mjs`
114+
- `src/dev-runtime/server/local-api-router.mjs`
115+
- `docs_build/dev/reports/PR_26166_163-create-account-live-diagnostic-fix.md`
116+
- `docs_build/dev/reports/PR_26166_163-local-api-console.txt`
117+
- `docs_build/dev/reports/PR_26166_163-local-api-console-errors.txt`
118+
- `docs_build/dev/reports/codex_review.diff`
119+
- `docs_build/dev/reports/codex_changed_files.txt`
120+
- Validation reports regenerated by `npm run test:workspace-v2`
121+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(node:24180) ExperimentalWarning: SQLite is an experimental feature and might change at any time
2+
(Use `node --trace-warnings ...` to show where the warning was created)
3+
[auth/operator] POST /api/auth/create-account diagnostic phase=start selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=none safeErrorCode=none safeMessage=ready-check-complete
4+
[auth/operator] POST /api/auth/create-account diagnostic phase=success selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=200 safeErrorCode=none safeMessage=account-created-and-identity-provisioned
5+
[auth/operator] POST /api/auth/create-account diagnostic phase=start selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=none safeErrorCode=none safeMessage=ready-check-complete
6+
[auth/operator] POST /api/auth/create-account diagnostic phase=upstream-failed selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=422 safeErrorCode=422 safeMessage=A user with this email address has already been registered
7+
[auth/operator] POST /api/auth/create-account failed: Create account: Supabase Auth request failed with HTTP 422.
8+
[auth/operator] POST /api/auth/create-account diagnostic phase=start selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=none safeErrorCode=none safeMessage=ready-check-complete
9+
[auth/operator] POST /api/auth/create-account diagnostic phase=success selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=200 safeErrorCode=none safeMessage=account-created-and-identity-provisioned
10+
[auth/operator] POST /api/auth/sign-in failed: Sign in: Supabase Auth request failed before an HTTP status was available.
11+
[auth/operator] POST /api/auth/create-account diagnostic phase=start selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=none safeErrorCode=none safeMessage=ready-check-complete
12+
[auth/operator] POST /api/auth/create-account diagnostic phase=upstream-failed selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=422 safeErrorCode=422 safeMessage=A user with this email address has already been registered
13+
[auth/operator] POST /api/auth/create-account failed: Create account: Supabase Auth request failed with HTTP 422.
14+
[auth/operator] POST /api/auth/create-account diagnostic phase=start selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=none safeErrorCode=none safeMessage=ready-check-complete
15+
[auth/operator] POST /api/auth/create-account diagnostic phase=upstream-failed selectedAuthProvider=supabase-auth dbProvider=local-db supabaseConfigured=yes identityTablesReady=yes upstreamStatusCode=422 safeErrorCode=422 safeMessage=A user with this email address has already been registered
16+
[auth/operator] POST /api/auth/create-account failed: Create account: Supabase Auth request failed with HTTP 422.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
> html-javascript-gaming@1.0.0 dev:local-api
3+
> node --use-system-ca ./scripts/start-local-api-server.mjs
4+
5+
GameFoundry API-backed local server running at http://127.0.0.1:5501/account/sign-in.html
6+
.env.local loaded for local API runtime (6 key(s) applied).
7+
Local API auth provider: supabase-auth.
8+
Local API product data provider: local-db.
9+
Supabase Auth selected for local API runtime because Supabase DEV auth configuration is present.
10+
Press Ctrl+C to stop.

docs_build/dev/reports/codex_changed_files.txt

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,19 @@ M docs_build/dev/reports/coverage_changed_js_guardrail.txt
3030
M docs_build/dev/reports/testing_lane_execution_report.md
3131
M docs_build/dev/reports/validation_cache_report.md
3232
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
33+
M src/dev-runtime/auth/provider-contract-stubs.mjs
34+
M src/dev-runtime/server/local-api-router.mjs
35+
?? docs_build/dev/reports/PR_26166_163-create-account-live-diagnostic-fix.md
36+
?? docs_build/dev/reports/PR_26166_163-local-api-console-errors.txt
37+
?? docs_build/dev/reports/PR_26166_163-local-api-console.txt
3638

3739
# git ls-files --others --exclude-standard
38-
docs_build/dev/reports/PR_26166_162-live-create-account-runtime-fix.md
40+
docs_build/dev/reports/PR_26166_163-create-account-live-diagnostic-fix.md
41+
docs_build/dev/reports/PR_26166_163-local-api-console-errors.txt
42+
docs_build/dev/reports/PR_26166_163-local-api-console.txt
3943

4044
# git diff --stat
41-
.../dev/reports/coverage_changed_js_guardrail.txt | 3 -
45+
.../dev/reports/coverage_changed_js_guardrail.txt | 2 +
4246
docs_build/dev/reports/dependency_gating_report.md | 2 +-
4347
.../reports/dependency_hydration_reuse_report.md | 4 +-
4448
.../dev/reports/execution_graph_reuse_report.md | 4 +-
@@ -48,27 +52,27 @@ docs_build/dev/reports/PR_26166_162-live-create-account-runtime-fix.md
4852
docs_build/dev/reports/lane_compilation_report.md | 2 +-
4953
.../dev/reports/lane_deduplication_report.md | 2 +-
5054
.../dev/reports/lane_input_validation_report.md | 2 +-
51-
.../reports/lane_manifests/workspace-contract.json | 10 ++--
55+
.../reports/lane_manifests/workspace-contract.json | 10 +--
5256
.../reports/lane_runtime_optimization_report.md | 2 +-
5357
docs_build/dev/reports/lane_snapshot_report.md | 4 +-
54-
.../reports/lane_snapshots/workspace-contract.json | 22 +++----
58+
.../reports/lane_snapshots/workspace-contract.json | 22 ++---
5559
docs_build/dev/reports/lane_warm_start_report.md | 4 +-
56-
.../lane_warm_starts/workspace-contract.json | 16 ++---
60+
.../lane_warm_starts/workspace-contract.json | 16 ++--
5761
.../dev/reports/monolith_trigger_removal_report.md | 2 +-
5862
.../dev/reports/persistent_lane_manifest_report.md | 6 +-
5963
.../playwright_discovery_ownership_report.md | 2 +-
6064
.../reports/playwright_discovery_scope_report.md | 2 +-
6165
.../dev/reports/playwright_structure_audit.md | 2 +-
62-
.../dev/reports/playwright_v8_coverage_report.txt | 21 ++-----
66+
.../dev/reports/playwright_v8_coverage_report.txt | 28 +++++--
6367
docs_build/dev/reports/retry_suppression_report.md | 2 +-
64-
docs_build/dev/reports/slow_path_pruning_report.md | 14 ++---
68+
docs_build/dev/reports/slow_path_pruning_report.md | 14 ++--
6569
docs_build/dev/reports/static_validation_report.md | 4 +-
6670
.../dev/reports/targeted_file_manifest_report.md | 4 +-
67-
.../dev/reports/test_cleanup_performance_report.md | 16 ++---
71+
.../dev/reports/test_cleanup_performance_report.md | 16 ++--
6872
.../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 +++++-----
73+
.../dev/reports/testing_lane_execution_report.md | 18 ++--
74+
docs_build/dev/reports/validation_cache_report.md | 30 +++----
7175
.../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(-)
76+
src/dev-runtime/auth/provider-contract-stubs.mjs | 49 +++++++++--
77+
src/dev-runtime/server/local-api-router.mjs | 96 +++++++++++++++++++++-
78+
33 files changed, 252 insertions(+), 109 deletions(-)

0 commit comments

Comments
 (0)