Skip to content

Commit 55e52d2

Browse files
committed
Fix env validation drift and unblock local Postgres runtime - PR_26167_196-local-postgres-runtime-unblock
1 parent 6355e5a commit 55e52d2

11 files changed

Lines changed: 1105 additions & 1172 deletions
Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,84 @@
11
# PR_26167_196-local-postgres-runtime-unblock
22

3-
Status: BLOCKED
3+
Status: PASS
44

55
## Branch Validation
66
- PASS - Current branch is `main`.
77
- PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before implementation.
88

99
## 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.
1416

1517
## Requirement Checklist
1618
- PASS - Main branch only: confirmed `main`.
1719
- 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.
2835

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`.
3546

3647
## 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.
4051

4152
## 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 Authhealth calls observed: `4`.
55+
-PASS - Supabase `/rest/v1/platform_settings` calls observed: `0`.
4556

4657
## 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.
5163

5264
## Validation Lane Report
53-
- PASS - `node --check scripts/start-local-postgres.mjs`.
65+
- PASS - `node --check scripts/validate-supabase-dev.mjs`.
5466
- PASS - `node --check scripts/validate-local-postgres-runtime.mjs`.
67+
- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`.
5568
- PASS - `node --check src/dev-runtime/persistence/postgres-connection-client.mjs`.
5669
- 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.
5875
- PASS - `npm run validate:browser-env-agnostic`.
76+
- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`.
5977
- 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`.
6278
- SKIP - Full samples smoke intentionally not run; not in scope.
6379

6480
## 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`.

‎docs_build/dev/reports/codex_changed_files.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# PR_26167_196 scoped changed files
2+
M docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
23
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
34
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
49
M src/dev-runtime/persistence/postgres-connection-client.mjs
510
M src/dev-runtime/server/local-api-router.mjs
6-
A docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
7-
A scripts/start-local-postgres.mjs
8-
A scripts/validate-local-postgres-runtime.mjs
911

1012
# Required reports generated
1113
M docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Fix env validation drift and unblock local Postgres runtime - PR_2616… · ToolboxAid/HTML-JavaScript-Gaming@55e52d2 · GitHub
Skip to content

Commit 55e52d2

Browse files
committed
Fix env validation drift and unblock local Postgres runtime - PR_26167_196-local-postgres-runtime-unblock
1 parent 6355e5a commit 55e52d2

11 files changed

Lines changed: 1105 additions & 1172 deletions
Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,84 @@
11
# PR_26167_196-local-postgres-runtime-unblock
22

3-
Status: BLOCKED
3+
Status: PASS
44

55
## Branch Validation
66
- PASS - Current branch is `main`.
77
- PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before implementation.
88

99
## 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.
1416

1517
## Requirement Checklist
1618
- PASS - Main branch only: confirmed `main`.
1719
- 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.
2835

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`.
3546

3647
## 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.
4051

4152
## 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 Authhealth calls observed: `4`.
55+
-PASS - Supabase `/rest/v1/platform_settings` calls observed: `0`.
4556

4657
## 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.
5163

5264
## Validation Lane Report
53-
- PASS - `node --check scripts/start-local-postgres.mjs`.
65+
- PASS - `node --check scripts/validate-supabase-dev.mjs`.
5466
- PASS - `node --check scripts/validate-local-postgres-runtime.mjs`.
67+
- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`.
5568
- PASS - `node --check src/dev-runtime/persistence/postgres-connection-client.mjs`.
5669
- 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.
5875
- PASS - `npm run validate:browser-env-agnostic`.
76+
- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`.
5977
- 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`.
6278
- SKIP - Full samples smoke intentionally not run; not in scope.
6379

6480
## 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`.

‎docs_build/dev/reports/codex_changed_files.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# PR_26167_196 scoped changed files
2+
M docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
23
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
34
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
49
M src/dev-runtime/persistence/postgres-connection-client.mjs
510
M src/dev-runtime/server/local-api-router.mjs
6-
A docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
7-
A scripts/start-local-postgres.mjs
8-
A scripts/validate-local-postgres-runtime.mjs
911

1012
# Required reports generated
1113
M docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Fix env validation drift and unblock local Postgres runtime - PR_2616… · ToolboxAid/HTML-JavaScript-Gaming@55e52d2 · GitHub
Skip to content

Commit 55e52d2

Browse files
committed
Fix env validation drift and unblock local Postgres runtime - PR_26167_196-local-postgres-runtime-unblock
1 parent 6355e5a commit 55e52d2

11 files changed

Lines changed: 1105 additions & 1172 deletions
Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,84 @@
11
# PR_26167_196-local-postgres-runtime-unblock
22

3-
Status: BLOCKED
3+
Status: PASS
44

55
## Branch Validation
66
- PASS - Current branch is `main`.
77
- PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before implementation.
88

99
## 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.
1416

1517
## Requirement Checklist
1618
- PASS - Main branch only: confirmed `main`.
1719
- 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.
2835

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`.
3546

3647
## 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.
4051

4152
## 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 Authhealth calls observed: `4`.
55+
-PASS - Supabase `/rest/v1/platform_settings` calls observed: `0`.
4556

4657
## 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.
5163

5264
## Validation Lane Report
53-
- PASS - `node --check scripts/start-local-postgres.mjs`.
65+
- PASS - `node --check scripts/validate-supabase-dev.mjs`.
5466
- PASS - `node --check scripts/validate-local-postgres-runtime.mjs`.
67+
- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`.
5568
- PASS - `node --check src/dev-runtime/persistence/postgres-connection-client.mjs`.
5669
- 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.
5875
- PASS - `npm run validate:browser-env-agnostic`.
76+
- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`.
5977
- 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`.
6278
- SKIP - Full samples smoke intentionally not run; not in scope.
6379

6480
## 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`.

‎docs_build/dev/reports/codex_changed_files.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# PR_26167_196 scoped changed files
2+
M docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
23
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
34
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
49
M src/dev-runtime/persistence/postgres-connection-client.mjs
510
M src/dev-runtime/server/local-api-router.mjs
6-
A docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
7-
A scripts/start-local-postgres.mjs
8-
A scripts/validate-local-postgres-runtime.mjs
911

1012
# Required reports generated
1113
M docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Fix env validation drift and unblock local Postgres runtime - PR_2616… · ToolboxAid/HTML-JavaScript-Gaming@55e52d2 · GitHub
Skip to content

Commit 55e52d2

Browse files
committed
Fix env validation drift and unblock local Postgres runtime - PR_26167_196-local-postgres-runtime-unblock
1 parent 6355e5a commit 55e52d2

11 files changed

Lines changed: 1105 additions & 1172 deletions
Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,84 @@
11
# PR_26167_196-local-postgres-runtime-unblock
22

3-
Status: BLOCKED
3+
Status: PASS
44

55
## Branch Validation
66
- PASS - Current branch is `main`.
77
- PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before implementation.
88

99
## 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.
1416

1517
## Requirement Checklist
1618
- PASS - Main branch only: confirmed `main`.
1719
- 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.
2835

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`.
3546

3647
## 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.
4051

4152
## 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 Authhealth calls observed: `4`.
55+
-PASS - Supabase `/rest/v1/platform_settings` calls observed: `0`.
4556

4657
## 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.
5163

5264
## Validation Lane Report
53-
- PASS - `node --check scripts/start-local-postgres.mjs`.
65+
- PASS - `node --check scripts/validate-supabase-dev.mjs`.
5466
- PASS - `node --check scripts/validate-local-postgres-runtime.mjs`.
67+
- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`.
5568
- PASS - `node --check src/dev-runtime/persistence/postgres-connection-client.mjs`.
5669
- 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.
5875
- PASS - `npm run validate:browser-env-agnostic`.
76+
- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`.
5977
- 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`.
6278
- SKIP - Full samples smoke intentionally not run; not in scope.
6379

6480
## 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`.

‎docs_build/dev/reports/codex_changed_files.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# PR_26167_196 scoped changed files
2+
M docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
23
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
34
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
49
M src/dev-runtime/persistence/postgres-connection-client.mjs
510
M src/dev-runtime/server/local-api-router.mjs
6-
A docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
7-
A scripts/start-local-postgres.mjs
8-
A scripts/validate-local-postgres-runtime.mjs
911

1012
# Required reports generated
1113
M docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Fix env validation drift and unblock local Postgres runtime - PR_2616… · ToolboxAid/HTML-JavaScript-Gaming@55e52d2 · GitHub
Skip to content

Commit 55e52d2

Browse files
committed
Fix env validation drift and unblock local Postgres runtime - PR_26167_196-local-postgres-runtime-unblock
1 parent 6355e5a commit 55e52d2

11 files changed

Lines changed: 1105 additions & 1172 deletions
Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,84 @@
11
# PR_26167_196-local-postgres-runtime-unblock
22

3-
Status: BLOCKED
3+
Status: PASS
44

55
## Branch Validation
66
- PASS - Current branch is `main`.
77
- PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before implementation.
88

99
## 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.
1416

1517
## Requirement Checklist
1618
- PASS - Main branch only: confirmed `main`.
1719
- 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.
2835

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`.
3546

3647
## 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.
4051

4152
## 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 Authhealth calls observed: `4`.
55+
-PASS - Supabase `/rest/v1/platform_settings` calls observed: `0`.
4556

4657
## 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.
5163

5264
## Validation Lane Report
53-
- PASS - `node --check scripts/start-local-postgres.mjs`.
65+
- PASS - `node --check scripts/validate-supabase-dev.mjs`.
5466
- PASS - `node --check scripts/validate-local-postgres-runtime.mjs`.
67+
- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`.
5568
- PASS - `node --check src/dev-runtime/persistence/postgres-connection-client.mjs`.
5669
- 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.
5875
- PASS - `npm run validate:browser-env-agnostic`.
76+
- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`.
5977
- 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`.
6278
- SKIP - Full samples smoke intentionally not run; not in scope.
6379

6480
## 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`.

‎docs_build/dev/reports/codex_changed_files.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# PR_26167_196 scoped changed files
2+
M docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
23
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
34
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
49
M src/dev-runtime/persistence/postgres-connection-client.mjs
510
M src/dev-runtime/server/local-api-router.mjs
6-
A docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
7-
A scripts/start-local-postgres.mjs
8-
A scripts/validate-local-postgres-runtime.mjs
911

1012
# Required reports generated
1113
M docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Fix env validation drift and unblock local Postgres runtime - PR_2616… · ToolboxAid/HTML-JavaScript-Gaming@55e52d2 · GitHub
Skip to content

Commit 55e52d2

Browse files
committed
Fix env validation drift and unblock local Postgres runtime - PR_26167_196-local-postgres-runtime-unblock
1 parent 6355e5a commit 55e52d2

11 files changed

Lines changed: 1105 additions & 1172 deletions
Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,84 @@
11
# PR_26167_196-local-postgres-runtime-unblock
22

3-
Status: BLOCKED
3+
Status: PASS
44

55
## Branch Validation
66
- PASS - Current branch is `main`.
77
- PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before implementation.
88

99
## 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.
1416

1517
## Requirement Checklist
1618
- PASS - Main branch only: confirmed `main`.
1719
- 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.
2835

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`.
3546

3647
## 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.
4051

4152
## 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 Authhealth calls observed: `4`.
55+
-PASS - Supabase `/rest/v1/platform_settings` calls observed: `0`.
4556

4657
## 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.
5163

5264
## Validation Lane Report
53-
- PASS - `node --check scripts/start-local-postgres.mjs`.
65+
- PASS - `node --check scripts/validate-supabase-dev.mjs`.
5466
- PASS - `node --check scripts/validate-local-postgres-runtime.mjs`.
67+
- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`.
5568
- PASS - `node --check src/dev-runtime/persistence/postgres-connection-client.mjs`.
5669
- 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.
5875
- PASS - `npm run validate:browser-env-agnostic`.
76+
- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`.
5977
- 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`.
6278
- SKIP - Full samples smoke intentionally not run; not in scope.
6379

6480
## 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`.

‎docs_build/dev/reports/codex_changed_files.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# PR_26167_196 scoped changed files
2+
M docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
23
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
34
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
49
M src/dev-runtime/persistence/postgres-connection-client.mjs
510
M src/dev-runtime/server/local-api-router.mjs
6-
A docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
7-
A scripts/start-local-postgres.mjs
8-
A scripts/validate-local-postgres-runtime.mjs
911

1012
# Required reports generated
1113
M docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Fix env validation drift and unblock local Postgres runtime - PR_2616… · ToolboxAid/HTML-JavaScript-Gaming@55e52d2 · GitHub
Skip to content

Commit 55e52d2

Browse files
committed
Fix env validation drift and unblock local Postgres runtime - PR_26167_196-local-postgres-runtime-unblock
1 parent 6355e5a commit 55e52d2

11 files changed

Lines changed: 1105 additions & 1172 deletions
Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,84 @@
11
# PR_26167_196-local-postgres-runtime-unblock
22

3-
Status: BLOCKED
3+
Status: PASS
44

55
## Branch Validation
66
- PASS - Current branch is `main`.
77
- PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before implementation.
88

99
## 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.
1416

1517
## Requirement Checklist
1618
- PASS - Main branch only: confirmed `main`.
1719
- 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.
2835

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`.
3546

3647
## 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.
4051

4152
## 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 Authhealth calls observed: `4`.
55+
-PASS - Supabase `/rest/v1/platform_settings` calls observed: `0`.
4556

4657
## 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.
5163

5264
## Validation Lane Report
53-
- PASS - `node --check scripts/start-local-postgres.mjs`.
65+
- PASS - `node --check scripts/validate-supabase-dev.mjs`.
5466
- PASS - `node --check scripts/validate-local-postgres-runtime.mjs`.
67+
- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`.
5568
- PASS - `node --check src/dev-runtime/persistence/postgres-connection-client.mjs`.
5669
- 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.
5875
- PASS - `npm run validate:browser-env-agnostic`.
76+
- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`.
5977
- 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`.
6278
- SKIP - Full samples smoke intentionally not run; not in scope.
6379

6480
## 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`.

‎docs_build/dev/reports/codex_changed_files.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# PR_26167_196 scoped changed files
2+
M docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
23
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
34
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
49
M src/dev-runtime/persistence/postgres-connection-client.mjs
510
M src/dev-runtime/server/local-api-router.mjs
6-
A docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
7-
A scripts/start-local-postgres.mjs
8-
A scripts/validate-local-postgres-runtime.mjs
911

1012
# Required reports generated
1113
M docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); Fix env validation drift and unblock local Postgres runtime - PR_2616… · ToolboxAid/HTML-JavaScript-Gaming@55e52d2 · GitHub
Skip to content

Commit 55e52d2

Browse files
committed
Fix env validation drift and unblock local Postgres runtime - PR_26167_196-local-postgres-runtime-unblock
1 parent 6355e5a commit 55e52d2

11 files changed

Lines changed: 1105 additions & 1172 deletions
Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,84 @@
11
# PR_26167_196-local-postgres-runtime-unblock
22

3-
Status: BLOCKED
3+
Status: PASS
44

55
## Branch Validation
66
- PASS - Current branch is `main`.
77
- PASS - `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before implementation.
88

99
## 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.
1416

1517
## Requirement Checklist
1618
- PASS - Main branch only: confirmed `main`.
1719
- 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.
2835

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`.
3546

3647
## 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.
4051

4152
## 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 Authhealth calls observed: `4`.
55+
-PASS - Supabase `/rest/v1/platform_settings` calls observed: `0`.
4556

4657
## 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.
5163

5264
## Validation Lane Report
53-
- PASS - `node --check scripts/start-local-postgres.mjs`.
65+
- PASS - `node --check scripts/validate-supabase-dev.mjs`.
5466
- PASS - `node --check scripts/validate-local-postgres-runtime.mjs`.
67+
- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`.
5568
- PASS - `node --check src/dev-runtime/persistence/postgres-connection-client.mjs`.
5669
- 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.
5875
- PASS - `npm run validate:browser-env-agnostic`.
76+
- PASS - `node --test tests/dev-runtime/ProductDataDatabaseUrl.test.mjs`.
5977
- 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`.
6278
- SKIP - Full samples smoke intentionally not run; not in scope.
6379

6480
## 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`.

‎docs_build/dev/reports/codex_changed_files.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# PR_26167_196 scoped changed files
2+
M docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
23
M docs_build/dev/reports/environment_agnostic_browser_gate_report.md
34
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
49
M src/dev-runtime/persistence/postgres-connection-client.mjs
510
M src/dev-runtime/server/local-api-router.mjs
6-
A docs_build/dev/reports/PR_26167_196-local-postgres-runtime-unblock.md
7-
A scripts/start-local-postgres.mjs
8-
A scripts/validate-local-postgres-runtime.mjs
911

1012
# Required reports generated
1113
M docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)