-
Notifications
You must be signed in to change notification settings - Fork 0
PR_26177_CHARLIE_034-startup-runtime-report-cleanup #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # PR_26177_CHARLIE_034-startup-runtime-report-cleanup | ||
|
|
||
| Team: Charlie | ||
| Branch: pr/26177-CHARLIE-034-startup-runtime-report-cleanup | ||
| Base: pr/26177-CHARLIE-032-runtime-health-json-endpoints | ||
| Lifecycle: Build / Validation | ||
| Repair: Rebased onto repaired PR_26177_CHARLIE_032 branch on 2026-06-25. | ||
|
|
||
| ## Scope | ||
| - Polished Local API startup diagnostics with explicit Local API URL, local site URL, local site URL port, database mode, and storage status. | ||
| - Kept runtime environment variable output deterministic and alphabetized. | ||
| - Confirmed secret-like environment keys containing PASSWORD, SECRET, TOKEN, KEY, SERVICE_ROLE, or JWT remain masked. | ||
| - Mirrored the safe diagnostics through the System Health API payload so the browser renders service-owned status. | ||
|
|
||
| ## Changed Files | ||
| - scripts/start-local-api-server.mjs | ||
| - src/dev-runtime/server/local-api-router.mjs | ||
| - tests/dev-runtime/LocalApiStartupLogging.test.mjs | ||
| - tests/dev-runtime/AdminHealthOperations.test.mjs | ||
| - tests/api/admin-system-health/contract.test.mjs | ||
| - tests/playwright/tools/AdminHealthOperationsPage.spec.mjs | ||
| - docs_build/dev/reports/coverage_changed_js_guardrail.txt | ||
| - docs_build/dev/reports/playwright_v8_coverage_report.txt | ||
|
|
||
| ## Validation | ||
| - PASS: node --check scripts/start-local-api-server.mjs | ||
| - PASS: node --check src/dev-runtime/server/local-api-router.mjs | ||
| - PASS: node --test tests/dev-runtime/LocalApiStartupLogging.test.mjs | ||
| - PASS: node --test tests/api/admin-system-health/contract.test.mjs | ||
| - PASS: node --test tests/dev-runtime/AdminHealthOperations.test.mjs | ||
| - PASS: npx playwright test tests/playwright/tools/AdminHealthOperationsPage.spec.mjs --workers=1 --reporter=line | ||
| - PASS: git diff --check | ||
|
|
||
| ## ZIP | ||
| - Generated after repair: C:\Users\DavidQ\Documents\GitHub\HTML-JavaScript-Gaming\tmp\PR_26177_CHARLIE_034-startup-runtime-report-cleanup_delta.zip |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # PR_26177_CHARLIE_034 Branch Validation | ||
|
|
||
| Branch: pr/26177-CHARLIE-034-startup-runtime-report-cleanup | ||
| Base: pr/26177-CHARLIE-032-runtime-health-json-endpoints | ||
|
|
||
| ## Results | ||
| - PASS: Continued the stacked Charlie workstream from PR_26177_CHARLIE_032. | ||
| - PASS: Branch is based on repaired PR_26177_CHARLIE_032 branch. | ||
| - PASS: Rebase conflict scope was generated report artifacts only. | ||
| - PASS: Worktree was clean before edits. | ||
| - PASS: Runtime changes are limited to Local API startup/runtime diagnostics. | ||
| - PASS: No start_of_day files were modified. | ||
| - PASS: No direct commit to main was made. | ||
| - PASS: PR branch will be pushed for draft PR creation. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # PR_26177_CHARLIE_034 Manual Validation Notes | ||
|
|
||
| - Confirmed startup log output now prints Local API URL, local site URL, local site URL port, database mode, and storage status. | ||
| - Confirmed `.env` diagnostic lines remain alphabetized by key. | ||
| - Confirmed secret-like values are masked, including KEY and SERVICE_ROLE variables. | ||
| - Confirmed System Health renders the new Local API startup diagnostics from the Local API payload. | ||
| - Confirmed no browser-owned infrastructure health state was introduced. | ||
| - Confirmed branch repair conflict was limited to generated report artifacts. | ||
| - Confirmed no start_of_day files changed. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # PR_26177_CHARLIE_034 Requirement Checklist | ||
|
|
||
| - PASS: Polish Local API startup/runtime diagnostics. | ||
| - PASS: Keep environment variables alphabetized. | ||
| - PASS: Mask secrets containing PASSWORD, SECRET, TOKEN, KEY, SERVICE_ROLE, or JWT. | ||
| - PASS: Include clear Local API URL. | ||
| - PASS: Include local site URL and port when available. | ||
| - PASS: Include database mode without exposing connection credentials. | ||
| - PASS: Include storage status without exposing secrets. | ||
| - PASS: Preserve existing startup and System Health behavior. | ||
| - PASS: Do not modify unrelated files. | ||
| - PASS: Do not modify start_of_day folders. | ||
| - PASS: Do not introduce MEM DB, fake-login, silent fallbacks, or browser-owned infrastructure state. | ||
| - PASS: Rebased onto repaired PR_26177_CHARLIE_032 branch. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # PR_26177_CHARLIE_034 Validation Lane | ||
|
|
||
| ## Commands | ||
| - PASS: node --check scripts/start-local-api-server.mjs | ||
| - PASS: node --check src/dev-runtime/server/local-api-router.mjs | ||
| - PASS: node --test tests/dev-runtime/LocalApiStartupLogging.test.mjs | ||
| - PASS: node --test tests/api/admin-system-health/contract.test.mjs | ||
| - PASS: node --test tests/dev-runtime/AdminHealthOperations.test.mjs | ||
| - PASS: npx playwright test tests/playwright/tools/AdminHealthOperationsPage.spec.mjs --workers=1 --reporter=line | ||
| - PASS: git diff --check | ||
|
|
||
| ## Notes | ||
| - `git diff --check` reported only expected Windows LF-to-CRLF working-copy warnings. | ||
| - Full samples smoke was not run because this PR is scoped to Local API startup diagnostics and System Health rendering. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,38 @@ | ||
| # git diff --name-only pr/26177-CHARLIE-031-environment-health-comparison -- | ||
| docs_build/dev/reports/PR_26177_CHARLIE_032-runtime-health-json-endpoints.md | ||
| docs_build/dev/reports/PR_26177_CHARLIE_032-runtime-health-json-endpoints_branch-validation.md | ||
| docs_build/dev/reports/PR_26177_CHARLIE_032-runtime-health-json-endpoints_manual-validation-notes.md | ||
| docs_build/dev/reports/PR_26177_CHARLIE_032-runtime-health-json-endpoints_requirements-checklist.md | ||
| docs_build/dev/reports/PR_26177_CHARLIE_032-runtime-health-json-endpoints_validation-lane.md | ||
| # git diff --name-only pr/26177-CHARLIE-032-runtime-health-json-endpoints -- | ||
| docs_build/dev/reports/PR_26177_CHARLIE_034-startup-runtime-report-cleanup.md | ||
| docs_build/dev/reports/PR_26177_CHARLIE_034-startup-runtime-report-cleanup_branch-validation.md | ||
| docs_build/dev/reports/PR_26177_CHARLIE_034-startup-runtime-report-cleanup_manual-validation-notes.md | ||
| docs_build/dev/reports/PR_26177_CHARLIE_034-startup-runtime-report-cleanup_requirements-checklist.md | ||
| docs_build/dev/reports/PR_26177_CHARLIE_034-startup-runtime-report-cleanup_validation-lane.md | ||
| docs_build/dev/reports/codex_changed_files.txt | ||
| docs_build/dev/reports/codex_review.diff | ||
| docs_build/dev/reports/coverage_changed_js_guardrail.txt | ||
| docs_build/dev/reports/playwright_v8_coverage_report.txt | ||
| scripts/start-local-api-server.mjs | ||
| src/dev-runtime/server/local-api-router.mjs | ||
| tests/api/admin-system-health/contract.test.mjs | ||
| tests/dev-runtime/AdminHealthOperations.test.mjs | ||
| tests/dev-runtime/LocalApiStartupLogging.test.mjs | ||
| tests/playwright/tools/AdminHealthOperationsPage.spec.mjs | ||
|
|
||
| # git status --short | ||
| (no output) | ||
| M docs_build/dev/reports/PR_26177_CHARLIE_034-startup-runtime-report-cleanup.md | ||
| M docs_build/dev/reports/PR_26177_CHARLIE_034-startup-runtime-report-cleanup_branch-validation.md | ||
| M docs_build/dev/reports/PR_26177_CHARLIE_034-startup-runtime-report-cleanup_manual-validation-notes.md | ||
| M docs_build/dev/reports/PR_26177_CHARLIE_034-startup-runtime-report-cleanup_requirements-checklist.md | ||
| M docs_build/dev/reports/codex_review.diff | ||
| M docs_build/dev/reports/playwright_v8_coverage_report.txt | ||
|
|
||
| # git diff --stat pr/26177-CHARLIE-031-environment-health-comparison -- | ||
| ...77_CHARLIE_032-runtime-health-json-endpoints.md | 30 ++++++++++ | ||
| ...time-health-json-endpoints_branch-validation.md | 17 ++++++ | ||
| ...ealth-json-endpoints_manual-validation-notes.md | 8 +++ | ||
| ...health-json-endpoints_requirements-checklist.md | 13 +++++ | ||
| ...untime-health-json-endpoints_validation-lane.md | 20 +++++++ | ||
| docs_build/dev/reports/codex_changed_files.txt | 66 ++++++++-------------- | ||
| docs_build/dev/reports/codex_review.diff | 2 +- | ||
| .../dev/reports/coverage_changed_js_guardrail.txt | 1 - | ||
| .../dev/reports/playwright_v8_coverage_report.txt | 2 - | ||
| src/dev-runtime/server/local-api-router.mjs | 48 ++++++++++++++++ | ||
| tests/api/admin-system-health/contract.test.mjs | 9 +++ | ||
| tests/dev-runtime/AdminHealthOperations.test.mjs | 12 ++++ | ||
| .../tools/AdminHealthOperationsPage.spec.mjs | 2 + | ||
| 13 files changed, 185 insertions(+), 45 deletions(-) | ||
| # git diff --stat pr/26177-CHARLIE-032-runtime-health-json-endpoints -- | ||
| ...7_CHARLIE_034-startup-runtime-report-cleanup.md | 35 ++ | ||
| ...tup-runtime-report-cleanup_branch-validation.md | 14 + | ||
| ...ntime-report-cleanup_manual-validation-notes.md | 9 + | ||
| ...untime-report-cleanup_requirements-checklist.md | 14 + | ||
| ...artup-runtime-report-cleanup_validation-lane.md | 14 + | ||
| docs_build/dev/reports/codex_changed_files.txt | 59 ++- | ||
| docs_build/dev/reports/codex_review.diff | 479 ++++++++++++++++++++- | ||
| .../dev/reports/playwright_v8_coverage_report.txt | 3 +- | ||
| scripts/start-local-api-server.mjs | 34 +- | ||
| src/dev-runtime/server/local-api-router.mjs | 101 ++++- | ||
| tests/dev-runtime/AdminHealthOperations.test.mjs | 7 + | ||
| tests/dev-runtime/LocalApiStartupLogging.test.mjs | 32 ++ | ||
| .../tools/AdminHealthOperationsPage.spec.mjs | 6 + | ||
| 13 files changed, 771 insertions(+), 36 deletions(-) |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import path from "node:path"; | |
| import { pathToFileURL } from "node:url"; | ||
| import { databaseSslMode } from "../src/dev-runtime/persistence/postgres-connection-client.mjs"; | ||
| import { startLocalApiServer } from "../src/dev-runtime/server/local-api-server.mjs"; | ||
| import { loadStorageConfig } from "../src/dev-runtime/storage/storage-config.mjs"; | ||
|
|
||
| const RUNTIME_ENV_FILE = ".env"; | ||
| const NOT_CONFIGURED = "(not configured)"; | ||
|
|
@@ -181,6 +182,28 @@ function formatRuntimePortLogLines({ env, localServer }) { | |
| ]; | ||
| } | ||
|
|
||
| function databaseMode(env) { | ||
| const rawValue = String(env.GAMEFOUNDRY_DATABASE_URL || "").trim(); | ||
| if (!rawValue) { | ||
| return "not configured"; | ||
| } | ||
| try { | ||
| const parsedUrl = new URL(rawValue); | ||
| return ["postgres:", "postgresql:"].includes(parsedUrl.protocol) ? "Postgres" : "invalid database URL"; | ||
| } catch { | ||
| return "invalid database URL"; | ||
| } | ||
| } | ||
|
|
||
| function storageStatus(env) { | ||
| const storageConfig = loadStorageConfig(env); | ||
| if (storageConfig.configured) { | ||
| return `configured (bucket ${storageConfig.safe.bucket}; prefix ${storageConfig.safe.projectsPrefix})`; | ||
| } | ||
| const issue = storageConfig.validationError || `missing ${storageConfig.missingKeys?.join(", ") || "storage configuration"}`; | ||
| return `not configured (${issue})`; | ||
| } | ||
|
|
||
| export function formatStartupLogLines({ | ||
| accountConnection, | ||
| configuredDatabaseSslMode, | ||
|
|
@@ -190,14 +213,21 @@ export function formatStartupLogLines({ | |
| localServer, | ||
| runtimeEnv, | ||
| }) { | ||
| const configuredApiUrl = String(env.GAMEFOUNDRY_API_URL || "").trim() || defaultApiUrl(localServer.baseUrl); | ||
| const configuredSiteUrl = configuredValue(env.GAMEFOUNDRY_SITE_URL); | ||
| return [ | ||
| `GameFoundry API runtime server running at ${localServer.baseUrl}`, | ||
| `Configured site URL: ${configuredValue(env.GAMEFOUNDRY_SITE_URL)}`, | ||
| `Configured API URL: ${String(env.GAMEFOUNDRY_API_URL || "").trim() || defaultApiUrl(localServer.baseUrl)}`, | ||
| `Configured site URL: ${configuredSiteUrl}`, | ||
| `Configured API URL: ${configuredApiUrl}`, | ||
| `Local API URL: ${configuredApiUrl}`, | ||
| `Local site URL: ${configuredSiteUrl}`, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| `Local site URL port: ${portFromUrl(env.GAMEFOUNDRY_SITE_URL)}`, | ||
| ...formatEnvironmentVariableLogLines(runtimeEnv), | ||
| ...formatRuntimePortLogLines({ env, localServer }), | ||
| connectionStatusLine("auth", accountConnection), | ||
| connectionStatusLine("database", databaseConnection), | ||
| `Database mode: ${databaseMode(env)}`, | ||
| `Storage status: ${storageStatus(env)}`, | ||
| `Database SSL mode: ${configuredDatabaseSslMode || `invalid (${databaseSslModeError})`}`, | ||
| "Press Ctrl+C to stop.", | ||
| ]; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
GAMEFOUNDRY_API_URLpoints somewhere other than the server that just bound locally (for example a shared/dev API URL whilelocalServer.baseUrlishttp://127.0.0.1:5599), this newLocal API URLline prints the configured public URL instead of the local endpoint. That duplicatesConfigured API URLand hides the actual local/apiURL/port users need for startup troubleshooting; derive this line fromlocalServer.baseUrlinstead.Useful? React with 👍 / 👎.