|
| 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. |
0 commit comments