Skip to content

Commit 33dad3f

Browse files
committed
Fix runtime env loading and Game Workspace create path - PR_26167_194-env-runtime-real-fix
1 parent 2b7c4ba commit 33dad3f

7 files changed

Lines changed: 316 additions & 328 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# PR_26167_194-env-runtime-real-fix
2+
3+
## Branch Validation
4+
- PASS - Current branch is `main`.
5+
- PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before changes.
6+
7+
## Actual Runtime/Config Files Reviewed or Changed
8+
- Changed runtime JS: `toolbox/game-workspace/game-workspace.js`
9+
- Changed targeted Playwright validation: `tests/playwright/tools/GameWorkspaceMockRepository.spec.mjs`
10+
- Generated/updated reports: `docs_build/dev/reports/playwright_v8_coverage_report.txt`, `docs_build/dev/reports/coverage_changed_js_guardrail.txt`, this PR report.
11+
- Runtime/config files inspected and validated without tracked changes in this PR: `scripts/start-local-api-server.mjs`, `scripts/validate-supabase-dev.mjs`, `scripts/apply-supabase-dev-ddl.mjs`, `src/dev-runtime/auth/provider-contract-stubs.mjs`, `.gitignore`, `.env.example`.
12+
- Ignored local copy-source/runtime files updated but not tracked or packaged: `.env`, `.env.local`, `.env.uat`.
13+
14+
## Requirement Checklist
15+
- PASS - Main branch only; branch guard confirmed `main`.
16+
- PASS - Runtime startup loads only `.env`: `npm run dev:local-api` reported `.env loaded for API runtime (4 key(s) applied).`
17+
- PASS - Runtime does not auto-load `.env.local`, `.env.uat`, or `.env.prod`: with `.env` temporarily absent, `npm run dev:local-api` reported `.env was not found for API runtime.`
18+
- PASS - Tests/validation explicitly load `.env.local` only where allowed: `npm run validate:supabase-dev` reported `Explicit .env.local DEV validation load`.
19+
- PASS - Active runtime/database config uses `GAMEFOUNDRY_DATABASE_URL`; active runtime search found the key in startup, validation, DDL apply, and runtime auth contract code.
20+
- PASS - Retired active runtime dependencies are absent from startup/runtime code: `GAMEFOUNDRY_AUTH_PROVIDER`, `GAMEFOUNDRY_DB_PROVIDER`, and `GAMEFOUNDRY_SUPABASE_DATABASE_URL` appear only in the environment-agnostic validation gate's rejection patterns.
21+
- PASS - `.env.local` and `.env.uat` exist as ignored local files with required keys and no forbidden keys. Values were not printed.
22+
- PASS - `.env` and `.env.*` remain ignored, with safe examples trackable through `.env.example`.
23+
- PASS - Game Workspace active-game handling no longer uses raw malformed payloads in action handlers; delete, purpose, status, and role updates now normalize active-game responses before reading fields.
24+
- PASS - Game Workspace create flow works through the targeted Playwright lane.
25+
- PASS - Malformed successful `getActiveGame` payloads now show visible diagnostics without browser throw.
26+
- PASS - No DEV/UAT/PROD branching across active app/server/API/DB code according to `npm run validate:browser-env-agnostic`.
27+
- PASS - No local-db/mock-db/SQLite fallback introduced.
28+
- PASS - No silent fallback introduced; malformed active-game payloads show actionable status text.
29+
30+
## Env Loading Evidence
31+
- PASS - `.env` present:
32+
- `GameFoundry API runtime server running at http://127.0.0.1:5594/account/sign-in.html`
33+
- `.env loaded for API runtime (4 key(s) applied).`
34+
- `Configured auth connection: configured.`
35+
- `Configured database connection: configured.`
36+
- PASS - `.env` temporarily absent while `.env.local` still existed:
37+
- `GameFoundry API runtime server running at http://127.0.0.1:5595/account/sign-in.html`
38+
- `.env was not found for API runtime.`
39+
- `Configured auth connection: missing GAMEFOUNDRY_SUPABASE_URL, GAMEFOUNDRY_SUPABASE_ANON_KEY.`
40+
- `Configured database connection: missing GAMEFOUNDRY_SUPABASE_URL, GAMEFOUNDRY_SUPABASE_SERVICE_ROLE_KEY, GAMEFOUNDRY_DATABASE_URL.`
41+
42+
## GAMEFOUNDRY_DATABASE_URL Evidence
43+
- PASS - `.env.example` contains `GAMEFOUNDRY_DATABASE_URL=`.
44+
- PASS - `scripts/start-local-api-server.mjs` requires `GAMEFOUNDRY_DATABASE_URL` for the configured database connection.
45+
- PASS - `scripts/validate-supabase-dev.mjs` validates `GAMEFOUNDRY_DATABASE_URL`.
46+
- PASS - `scripts/apply-supabase-dev-ddl.mjs` reads `GAMEFOUNDRY_DATABASE_URL`.
47+
- PASS - `src/dev-runtime/auth/provider-contract-stubs.mjs` reports database readiness using `GAMEFOUNDRY_DATABASE_URL`.
48+
49+
## Game Workspace Create Evidence
50+
- PASS - Targeted Playwright: `Game Workspace creates, opens, and deletes mock games`.
51+
- PASS - Targeted Playwright: `Game Workspace shows active-game API diagnostics without throwing`.
52+
- PASS - Targeted Playwright: `Game Workspace reports malformed active-game payloads without throwing`.
53+
- PASS - Result: `3 passed`.
54+
55+
## Validation Lane Report
56+
- PASS - `node --check toolbox/game-workspace/game-workspace.js`
57+
- PASS - `node --check tests/playwright/tools/GameWorkspaceMockRepository.spec.mjs`
58+
- PASS - `node --check scripts/start-local-api-server.mjs`
59+
- PASS - `node --check scripts/validate-supabase-dev.mjs`
60+
- PASS - `npm run validate:supabase-dev`
61+
- WARN noted by validator: direct database socket TLS self-signed certificate advisory; REST/API identity readiness passed.
62+
- PASS - `npm run dev:local-api` runtime proof with `.env` present and `.env` absent.
63+
- PASS - `npx playwright test tests/playwright/tools/GameWorkspaceMockRepository.spec.mjs --grep "Game Workspace creates, opens, and deletes mock games|Game Workspace shows active-game API diagnostics without throwing|Game Workspace reports malformed active-game payloads without throwing" --workers=1 --reporter=list`
64+
- PASS - `npm run validate:browser-env-agnostic`
65+
- SKIP - Full samples smoke was not run because samples were not in this PR scope.
66+
67+
## Manual Validation Notes
68+
- Confirmed local ignored `.env`, `.env.local`, and `.env.uat` contain required key names and no forbidden provider/old database key names without exposing values.
69+
- Confirmed runtime output does not mention `.env.local`, `.env.uat`, `.env.prod`, provider selection, or local DB selection.
70+
- Confirmed Playwright-generated `tmp/test-results` was removed after validation; the final repo `tmp` artifact for this BUILD is the delta ZIP only.
71+
72+
## Playwright V8 Coverage
73+
- PASS - Runtime JS coverage report generated at `docs_build/dev/reports/playwright_v8_coverage_report.txt`.
74+
- PASS - Changed runtime JS `toolbox/game-workspace/game-workspace.js` was covered at 89% function coverage in the generated report.
Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
# git status --short
2-
D .env
3-
D .env.uat
4-
M .gitignore
5-
M docs_build/dev/reports/codex_changed_files.txt
6-
M docs_build/dev/reports/codex_review.diff
7-
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
8-
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
2+
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
93
M docs_build/dev/reports/playwright_v8_coverage_report.txt
10-
M scripts/validate-browser-env-agnostic.mjs
11-
?? docs_build/dev/reports/PR_26167_193-env-runtime-single-file-and-generic-db-url-redo.md
4+
M tests/playwright/tools/GameWorkspaceMockRepository.spec.mjs
5+
M toolbox/game-workspace/game-workspace.js
6+
?? docs_build/dev/reports/PR_26167_194-env-runtime-real-fix.md
127

13-
# git diff --cached --stat
14-
.env | 4 ----
15-
.env.uat | 9 ---------
16-
.gitignore | 5 ++++-
17-
3 files changed, 4 insertions(+), 14 deletions(-)
8+
# git ls-files --others --exclude-standard
9+
docs_build/dev/reports/PR_26167_194-env-runtime-real-fix.md
1810

1911
# git diff --stat
20-
docs_build/dev/reports/codex_changed_files.txt | 41 +-
21-
docs_build/dev/reports/codex_review.diff | 728 ++++++++-------------
22-
.../dev/reports/coverage_changed_js_guardrail.txt | 4 +-
23-
.../environment_agnostic_browser_gate_report.md | 52 +-
24-
.../dev/reports/playwright_v8_coverage_report.txt | 11 +-
25-
scripts/validate-browser-env-agnostic.mjs | 72 +-
26-
6 files changed, 422 insertions(+), 486 deletions(-)
27-
28-
# git ls-files --others --exclude-standard
29-
docs_build/dev/reports/PR_26167_193-env-runtime-single-file-and-generic-db-url-redo.md
12+
.../dev/reports/coverage_changed_js_guardrail.txt | 4 +--
13+
.../dev/reports/playwright_v8_coverage_report.txt | 10 ++++---
14+
.../tools/GameWorkspaceMockRepository.spec.mjs | 33 ++++++++++++++++++++++
15+
toolbox/game-workspace/game-workspace.js | 8 +++---
16+
4 files changed, 45 insertions(+), 10 deletions(-)

0 commit comments

Comments
 (0)