Skip to content

Commit db3286b

Browse files
committed
Support local Postgres DDL apply from database URL - PR_26167_197-ddl-apply-supports-local-postgres
1 parent 55e52d2 commit db3286b

6 files changed

Lines changed: 443 additions & 1081 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Configure the runtime auth and database connections here.
44
# Missing connection configuration reports diagnostics instead of falling back.
55

6+
GAMEFOUNDRY_DATABASE_SSL=require
7+
68
# Browser-safe account connection configuration.
79
# Leave values empty in this example; local values belong in user-managed copy files.
810
GAMEFOUNDRY_SUPABASE_URL=
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# PR_26167_197-ddl-apply-supports-local-postgres
2+
3+
Status: PASS
4+
5+
## Branch Validation
6+
- PASS: Current branch is `main`.
7+
- Expected branch: `main`.
8+
9+
## Summary
10+
- Updated `scripts/apply-supabase-dev-ddl.mjs` to load `.env`, use `GAMEFOUNDRY_DATABASE_URL`, and reuse the shared Postgres connection client.
11+
- Removed the script-local TLS-only PostgreSQL client and Supabase REST grant behavior from DDL apply.
12+
- Updated `scripts/validate-local-postgres-runtime.mjs` so local runtime validation accepts the configured local/private Postgres endpoint from `.env` instead of a hardcoded port.
13+
14+
## Requirement Checklist
15+
- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before execution.
16+
- PASS: Hard-stopped check passed on `main`.
17+
- PASS: DDL apply loads `.env`; output: `.env loaded for DDL apply (5 key(s) applied)`.
18+
- PASS: DDL apply uses `GAMEFOUNDRY_DATABASE_URL` as the only DDL database connection source.
19+
- PASS: DDL apply supports local plain TCP; output: `plain TCP (sslmode=disable)`.
20+
- PASS: DDL apply supports TLS-capable targets through URL `sslmode` and target capability handling in the shared Postgres client.
21+
- PASS: Did not reintroduce `GAMEFOUNDRY_SUPABASE_DATABASE_URL`.
22+
- PASS: Did not reintroduce provider variables.
23+
- PASS: Did not add environment-name branching.
24+
- PASS: Applied grouped GFS DDL to local Postgres: 15 DDL files applied.
25+
- PASS: Required identity tables validated: `users`, `roles`, `user_roles`.
26+
- PASS: `platform_settings` banner save/read validated through API against local Postgres.
27+
- PASS: Game Workspace create/getActiveGame validated with no 500 and no `undefined.some` error.
28+
- PASS: No SQLite/local-db/mock-db fallback added.
29+
30+
## Env Load Evidence
31+
- `node .\scripts\apply-supabase-dev-ddl.mjs`
32+
- PASS: `.env loaded for DDL apply (5 key(s) applied)`.
33+
- PASS: Database diagnostic printed only safe context: `host=192.168.2.5; port=55431; database=gamefoundry_dev`.
34+
35+
## Local Postgres Non-TLS DDL Evidence
36+
- PASS: DDL apply selected `plain TCP (sslmode=disable)` from `GAMEFOUNDRY_DATABASE_URL`.
37+
- PASS: Applied 15 grouped GFS DDL files through `GAMEFOUNDRY_DATABASE_URL`.
38+
39+
## Table Validation Evidence
40+
- PASS: `node .\scripts\validate-supabase-dev.mjs`
41+
- PASS: Database connection: `host=192.168.2.5; port=55431; database=gamefoundry_dev`.
42+
- PASS: `users table`.
43+
- PASS: `roles table`.
44+
- PASS: `user_roles table`.
45+
46+
## Validation Lane Report
47+
- PASS: `node --check scripts\apply-supabase-dev-ddl.mjs`.
48+
- PASS: `node --check scripts\validate-local-postgres-runtime.mjs`.
49+
- PASS: `node .\scripts\apply-supabase-dev-ddl.mjs`.
50+
- PASS: `node .\scripts\validate-supabase-dev.mjs`.
51+
- PASS: `npm run dev:local-api`; runtime printed `.env loaded for API runtime (5 key(s) applied)` and configured auth/database connections.
52+
- PASS: `npm run validate:local-postgres-runtime`.
53+
- PASS: Forbidden-marker scan for old env/provider/TLS-only/local-db/mock-db markers in changed scripts.
54+
- PASS: `git diff --check -- scripts\apply-supabase-dev-ddl.mjs scripts\validate-local-postgres-runtime.mjs`.
55+
- SKIP: Full samples smoke; PR scope is DDL apply/local product-data validation only.
56+
57+
## Manual Validation Notes
58+
- Platform banner was saved and read through the API; local `platform_settings` banner rows observed: 3.
59+
- Supabase product-data REST calls observed during validation: 0.
60+
- Game Workspace create/getActiveGame used repository `game-workspace-1`; local game rows observed: 1.
61+
- Validation cleanup restored banner rows and removed PR197 Game Workspace rows.
62+
- Initial local runtime validator run failed on stale hardcoded port `55432`; the validation harness was corrected to accept configured local/private `GAMEFOUNDRY_DATABASE_URL` targets, then rerun PASS.
63+
64+
## Artifact Output
65+
- PASS: Repo-structured ZIP created at `tmp/PR_26167_197-ddl-apply-supports-local-postgres_delta.zip`.
66+
67+
## Changed Files
68+
- `scripts/apply-supabase-dev-ddl.mjs`
69+
- `scripts/validate-local-postgres-runtime.mjs`
70+
- `docs_build/dev/reports/PR_26167_197-ddl-apply-supports-local-postgres.md`
71+
- `docs_build/dev/reports/codex_review.diff`
72+
- `docs_build/dev/reports/codex_changed_files.txt`
Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
1-
# PR_26167_196 scoped changed files
2-
M docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
3-
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
4-
M package.json
5-
D scripts/start-local-postgres.mjs
6-
M scripts/validate-local-postgres-runtime.mjs
7-
M scripts/validate-supabase-dev.mjs
8-
M src/dev-runtime/auth/provider-contract-stubs.mjs
9-
M src/dev-runtime/persistence/postgres-connection-client.mjs
10-
M src/dev-runtime/server/local-api-router.mjs
11-
12-
# Required reports generated
13-
M docs_build/dev/reports/codex_changed_files.txt
14-
M docs_build/dev/reports/codex_review.diff
15-
16-
# Artifact
17-
tmp/PR_26167_196-local-postgres-runtime-unblock_delta.zip
18-
19-
# Note
20-
ZIP remains ignored by git and is not staged.
1+
scripts/apply-supabase-dev-ddl.mjs
2+
scripts/validate-local-postgres-runtime.mjs
3+
docs_build/dev/reports/PR_26167_197-ddl-apply-supports-local-postgres.md
4+
docs_build/dev/reports/codex_review.diff
5+
docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)