|
1 | 1 | # PR_26167_196-local-postgres-runtime-unblock |
2 | 2 |
|
3 | | -Status: BLOCKED |
| 3 | +Status: PASS |
4 | 4 |
|
5 | 5 | ## Branch Validation |
6 | 6 | - PASS - Current branch is `main`. |
7 | 7 | - PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before implementation. |
8 | 8 |
|
9 | 9 | ## Summary |
10 | | -- Added `npm run dev:local-postgres` to start a Docker-backed local Postgres container for `postgresql://postgres:postgres@127.0.0.1:5432/gamefoundry_dev`. |
11 | | -- Added `npm run validate:local-postgres-runtime` to load only `.env`, apply grouped DDL, seed server-side identity rows, save/read platform banner through the API, assert no Supabase product-data REST call, and exercise Game Workspace create/getActiveGame. |
12 | | -- Extended the direct Postgres client with a raw query method for setup/validation SQL. |
13 | | -- Kept platform settings out of tool snapshot persistence so Game Workspace saves do not overwrite banner-owned rows. |
| 10 | +- Runtime and validation now load `.env` only for this lane. |
| 11 | +- `scripts/validate-supabase-dev.mjs` validates the same `.env` database connection used by `npm run dev:local-api`. |
| 12 | +- Removed the stale Docker/`127.0.0.1:5432` local Postgres helper path. |
| 13 | +- Product data continues to use `GAMEFOUNDRY_DATABASE_URL`; Supabase URL/keys are used for Auth checks only. |
| 14 | +- Game Workspace persistence now saves only Game Workspace-owned tables during Game Workspace repository mutations. |
| 15 | +- Identity seed/bootstrap is idempotent against existing `roles.roleSlug` and remaps `user_roles.roleKey` to existing role keys. |
14 | 16 |
|
15 | 17 | ## Requirement Checklist |
16 | 18 | - PASS - Main branch only: confirmed `main`. |
17 | 19 | - PASS - Project instructions read first. |
18 | | -- PASS - Continued PR_26167_195 direct database URL product-data path. |
19 | | -- PASS - Added smallest local Postgres setup/run path: `npm run dev:local-postgres`. |
20 | | -- PASS - Did not reintroduce SQLite, mock-db, local-db, provider switching, or Supabase REST product-data writes. |
21 | | -- PASS - Supabase URL/keys remain auth-only for runtime Auth checks; product-data adapter uses `GAMEFOUNDRY_DATABASE_URL`. |
22 | | -- PASS - `platform_settings` banner API path remains owned by the configured database adapter. |
23 | | -- PASS - Game Workspace active-game browser logic already avoids `undefined.some`; server still rejects malformed `getActiveGame` payloads visibly. |
24 | | -- PASS - Runtime startup still loads only `.env`. |
25 | | -- PASS - No environment branching gate passed for active code. |
26 | | -- BLOCKED - Live local Postgres connection validation could not complete because nothing accepted connections at `127.0.0.1:5432`. |
27 | | -- BLOCKED - Live local banner save/read and Game Workspace create validation did not run because the database connection failed first. |
| 20 | +- PASS - Runtime loads `.env` only. |
| 21 | +- PASS - Validation loads `.env` only for `validate-supabase-dev` and local product-data validation. |
| 22 | +- PASS - `.env.local`, `.env.uat`, and `.env.prod` are not auto-loaded by the touched runtime/validation paths. |
| 23 | +- PASS - `.env.local` and `.env.uat` remain copy sources only. |
| 24 | +- PASS - `validate-supabase-dev.mjs` validates the same `.env` file used by `npm run dev:local-api`. |
| 25 | +- PASS - Database validation uses `GAMEFOUNDRY_DATABASE_URL` exactly from `.env`. |
| 26 | +- PASS - Safe database diagnostics include host, port, and database name without password/secret values. |
| 27 | +- PASS - Removed stale `127.0.0.1:5432` helper/check path and no touched path references `GAMEFOUNDRY_SUPABASE_DATABASE_URL`. |
| 28 | +- PASS - Supabase URL/keys remain for Auth checks only. |
| 29 | +- PASS - Product data remains on `GAMEFOUNDRY_DATABASE_URL`. |
| 30 | +- PASS - Platform banner read/write validated against local Postgres. |
| 31 | +- PASS - Supabase `platform_settings` was not updated by the banner save; validation saw zero Supabase REST table calls. |
| 32 | +- PASS - Game Workspace create path validated against local Postgres with no 500. |
| 33 | +- PASS - Browser code already guards active-game members before `.some()`, and the live API validation returned a valid `members` array. |
| 34 | +- PASS - No provider variables, SQLite, mock-db/local-db path, Supabase REST product-data writes, or environment branching were introduced. |
28 | 35 |
|
29 | | -## Local Postgres Evidence |
30 | | -- Added helper: `npm run dev:local-postgres`. |
31 | | -- Helper uses Docker container `gamefoundry-local-postgres`, image `postgres:16`, database `gamefoundry_dev`, and host port `127.0.0.1:5432`. |
32 | | -- Docker Desktop launch was requested, but Docker CLI readiness calls hung and timed out. |
33 | | -- `Test-NetConnection 127.0.0.1 -Port 5432`: `TcpTestSucceeded=False`. |
34 | | -- `npm run validate:local-postgres-runtime`: BLOCKED with `connect ECONNREFUSED 127.0.0.1:5432`. |
| 36 | +## Env Loading Evidence |
| 37 | +- PASS - `.env` contains the requested local database components: host `192.168.2.5`, port `55432`, database `gamefoundry_dev`, user `postgres`; password was verified but not printed. |
| 38 | +- PASS - `node .\scripts\validate-supabase-dev.mjs`: `Runtime .env validation load (4 key(s) loaded)`. |
| 39 | +- PASS - `npm run dev:local-api` startup output: `.env loaded for API runtime (4 key(s) applied).` |
| 40 | +- PASS - No touched runtime/validation path references `.env.local`, `.env.uat`, or `.env.prod`. |
| 41 | + |
| 42 | +## Database Connection Evidence |
| 43 | +- PASS - `Test-NetConnection 192.168.2.5 -Port 55432`: `TcpTestSucceeded=True`. |
| 44 | +- PASS - `node .\scripts\validate-supabase-dev.mjs`: `Database connection (host=192.168.2.5; port=55432; database=gamefoundry_dev)`. |
| 45 | +- PASS - `users`, `roles`, and `user_roles` table readiness were validated through `GAMEFOUNDRY_DATABASE_URL`. |
35 | 46 |
|
36 | 47 | ## Banner Evidence |
37 | | -- Static/unit evidence: `tests/dev-runtime/ProductDataDatabaseUrl.test.mjs` passed and proves `platform_settings` reads/writes call the configured Postgres client, not Supabase REST. |
38 | | -- Runtime guard added: `scripts/validate-local-postgres-runtime.mjs` asserts `Supabase platform_settings REST calls=0` after a banner save/read. |
39 | | -- BLOCKED - The live banner save/read path did not reach execution because local Postgres was unavailable. |
| 48 | +- PASS - `npm run validate:local-postgres-runtime` saved and read a platform banner through the API. |
| 49 | +- PASS - Local Postgres `platform_settings` rows observed during validation: `3`. |
| 50 | +- PASS - Validation cleanup restored prior banner rows after evidence capture. |
40 | 51 |
|
41 | 52 | ## Supabase Not Updated Evidence |
42 | | -- PASS - Product-data adapter no longer uses Supabase REST table writes. |
43 | | -- PASS - Local runtime validation script routes Supabase to an Auth-health-only fake endpoint and fails if `/rest/v1/platform_settings` is called. |
44 | | -- BLOCKED - Live zero-call assertion was not reached because local Postgres refused the connection before API validation began. |
| 53 | +- PASS - `npm run validate:local-postgres-runtime` routed Supabase to an Auth-health-only fake endpoint. |
| 54 | +- PASS - Supabase Auth health calls observed: `4`. |
| 55 | +- PASS - Supabase `/rest/v1/platform_settings` calls observed: `0`. |
45 | 56 |
|
46 | 57 | ## Game Workspace Evidence |
47 | | -- PASS - `toolbox/game-workspace/game-workspace.js` uses `activeGameMembers(activeGame)` before `.some()`, so missing/malformed active game data does not throw `undefined.some`. |
48 | | -- PASS - Server repository method validation still rejects malformed `getActiveGame` responses with a visible error. |
49 | | -- PASS - Tool snapshot persistence now excludes global/platform tables including `platform_settings`. |
50 | | -- BLOCKED - Live Game Workspace create/getActiveGame validation did not run because local Postgres was unavailable. |
| 58 | +- PASS - `npm run validate:local-postgres-runtime` created a new Game Workspace through the API and read it back with `getActiveGame`. |
| 59 | +- PASS - Repository used: `game-workspace-1`. |
| 60 | +- PASS - Local `game_workspace_games` validation rows observed: `1`. |
| 61 | +- PASS - Validation cleanup removed the PR196 Game Workspace row. |
| 62 | +- PASS - No HTTP 500 occurred after narrowing Game Workspace persistence to `game_workspace_*` tables. |
51 | 63 |
|
52 | 64 | ## Validation Lane Report |
53 | | -- PASS - `node --check scripts/start-local-postgres.mjs`. |
| 65 | +- PASS - `node --check scripts/validate-supabase-dev.mjs`. |
54 | 66 | - PASS - `node --check scripts/validate-local-postgres-runtime.mjs`. |
| 67 | +- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`. |
55 | 68 | - PASS - `node --check src/dev-runtime/persistence/postgres-connection-client.mjs`. |
56 | 69 | - PASS - `node --check src/dev-runtime/server/local-api-router.mjs`. |
57 | | -- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`. |
| 70 | +- PASS - `.env` database component check for `192.168.2.5:55432/gamefoundry_dev`. |
| 71 | +- PASS - `Test-NetConnection 192.168.2.5 -Port 55432`. |
| 72 | +- PASS - `npm run validate:local-postgres-runtime`. |
| 73 | +- PASS - `node .\scripts\validate-supabase-dev.mjs`. |
| 74 | +- PASS - `npm run dev:local-api` startup check. |
58 | 75 | - PASS - `npm run validate:browser-env-agnostic`. |
| 76 | +- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`. |
59 | 77 | - PASS - `git diff --check`. |
60 | | -- BLOCKED - `npm run dev:local-postgres` did not complete because Docker CLI readiness calls timed out. |
61 | | -- BLOCKED - `npm run validate:local-postgres-runtime` failed with `ECONNREFUSED 127.0.0.1:5432`. |
62 | 78 | - SKIP - Full samples smoke intentionally not run; not in scope. |
63 | 79 |
|
64 | 80 | ## Manual Validation Notes |
65 | | -- To unblock live validation, start Docker Desktop until `docker info` returns promptly, then run `npm run dev:local-postgres`. |
66 | | -- With Postgres listening, run `npm run validate:local-postgres-runtime`. |
67 | | -- The validation script restores banner rows and deletes its `PR196 Runtime Game <pid>` row after execution. |
68 | | -- No secrets were printed in this report. |
| 81 | +- Runtime API startup was checked on port `5596` to avoid conflicts; this does not change runtime env loading behavior. |
| 82 | +- The local runtime validation applies grouped DDL, seeds identity rows, validates banner and Game Workspace paths, then cleans up its banner/game validation records. |
| 83 | +- No secrets were printed in reports or command summaries. |
| 84 | +- Artifact: `tmp/PR_26167_196-local-postgres-runtime-unblock_delta.zip`. |
0 commit comments