Skip to content

Commit 297108b

Browse files
committed
Wire admin Postgres diagnostics runtime
1 parent 49e4cca commit 297108b

10 files changed

Lines changed: 1052 additions & 406 deletions

admin/system-health.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ <h2 id="admin-system-health-title">System Health Tables</h2>
8585
</tr>
8686
</thead>
8787
<tbody>
88-
<tr><td>Provider</td><td>Postgres</td><td data-health-status="PASS">PASS</td></tr>
89-
<tr><td>Host</td><td>Configured host placeholder</td><td data-health-status="PENDING" title="Reason: host reader is intentionally not wired in this foundation PR." aria-label="PENDING: host reader is intentionally not wired in this foundation PR.">PENDING</td></tr>
90-
<tr><td>Port</td><td>5432</td><td data-health-status="PASS">PASS</td></tr>
91-
<tr><td>Database</td><td>Configured database placeholder</td><td data-health-status="PENDING" title="Reason: database name reader is intentionally not wired in this foundation PR." aria-label="PENDING: database name reader is intentionally not wired in this foundation PR.">PENDING</td></tr>
92-
<tr><td>Migration Version</td><td>Pending migration reader</td><td data-health-status="PENDING" title="Reason: migration version reader is intentionally not wired in this foundation PR." aria-label="PENDING: migration version reader is intentionally not wired in this foundation PR.">PENDING</td></tr>
93-
<tr><td>Status</td><td>Connection check pending</td><td data-health-status="PENDING" title="Reason: live Postgres connection checks are intentionally not wired in this foundation PR." aria-label="PENDING: live Postgres connection checks are intentionally not wired in this foundation PR.">PENDING</td></tr>
88+
<tr><td>Provider</td><td data-admin-system-health-db-value="provider">Postgres</td><td data-health-status="PASS" data-admin-system-health-db-status="provider">PASS</td></tr>
89+
<tr><td>Host</td><td data-admin-system-health-db-value="host">Configured host placeholder</td><td data-health-status="PENDING" data-admin-system-health-db-status="host" title="Reason: host reader is intentionally not wired in this foundation PR." aria-label="PENDING: host reader is intentionally not wired in this foundation PR.">PENDING</td></tr>
90+
<tr><td>Port</td><td data-admin-system-health-db-value="port">5432</td><td data-health-status="PASS" data-admin-system-health-db-status="port">PASS</td></tr>
91+
<tr><td>Database</td><td data-admin-system-health-db-value="database">Configured database placeholder</td><td data-health-status="PENDING" data-admin-system-health-db-status="database" title="Reason: database name reader is intentionally not wired in this foundation PR." aria-label="PENDING: database name reader is intentionally not wired in this foundation PR.">PENDING</td></tr>
92+
<tr><td>Migration Version</td><td data-admin-system-health-db-value="migration">Pending migration reader</td><td data-health-status="PENDING" data-admin-system-health-db-status="migration" title="Reason: migration version reader is intentionally not wired in this foundation PR." aria-label="PENDING: migration version reader is intentionally not wired in this foundation PR.">PENDING</td></tr>
93+
<tr><td>Status</td><td data-admin-system-health-db-value="connection">Connection check pending</td><td data-health-status="PENDING" data-admin-system-health-db-status="connection" title="Reason: live Postgres connection checks are intentionally not wired in this foundation PR." aria-label="PENDING: live Postgres connection checks are intentionally not wired in this foundation PR.">PENDING</td></tr>
9494
</tbody>
9595
</table>
9696
</div>
@@ -221,6 +221,7 @@ <h2>Diagnostics</h2>
221221
<script src="assets/theme-v2/js/gamefoundry-partials.js" defer></script>
222222
<script src="assets/theme-v2/js/tool-display-mode.js" defer></script>
223223
<script type="module" src="assets/theme-v2/js/admin-owner-navigation.js"></script>
224+
<script type="module" src="assets/theme-v2/js/admin-system-health.js"></script>
224225
</body>
225226

226227
</html>

assets/theme-v2/js/admin-system-health.js

Lines changed: 82 additions & 350 deletions
Large diffs are not rendered by default.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# PR_26171_GAMMA_014 Instruction Compliance Checklist
2+
3+
## Required Reads
4+
5+
- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md`.
6+
- PASS: Read `docs_build/dev/PROJECT_MULTI_PC.txt`.
7+
- PASS: Read exact target file `admin/system-health.html`.
8+
- PASS: Read existing runtime target `assets/theme-v2/js/admin-system-health.js`.
9+
- PASS: Read existing API client `src/api/admin-system-health-api-client.js`.
10+
- PASS: Read existing safe server contract in `src/dev-runtime/server/local-api-router.mjs`.
11+
- PASS: Read existing target route test `tests/playwright/tools/AdminHealthOperationsPage.spec.mjs`.
12+
13+
## Ownership And Branch
14+
15+
- PASS: Queued PR name includes TEAM token `GAMMA`.
16+
- PASS: TEAM ownership was verified against `PROJECT_MULTI_PC.txt`.
17+
- PASS: User explicitly directed continuation on `team/GAMMA/admin`.
18+
- PASS: User explicitly accepted current preflight: branch `team/GAMMA/admin`, clean, local/origin sync `0 0`.
19+
- PASS: User explicitly directed updating existing draft PR #36 and not creating a separate PR014 GitHub PR.
20+
- PASS: Work remained within the Admin diagnostics/runtime scope.
21+
22+
## Scope Compliance
23+
24+
- PASS: Wired Admin System Health Postgres diagnostics.
25+
- PASS: Used existing safe server/API/service contract.
26+
- PASS: Showed provider.
27+
- PASS: Showed host.
28+
- PASS: Showed port.
29+
- PASS: Showed database.
30+
- PASS: Showed migration version/summary.
31+
- PASS: Showed connection status.
32+
- PASS: Masked secrets and refused unsafe secret-bearing responses.
33+
- PASS: Did not introduce SQLite.
34+
- PASS: Did not expose client-side secrets.
35+
- PASS: Preserved Theme V2 only.
36+
- PASS: Preserved Postgres-only database direction.
37+
- PASS: Left non-PR014 diagnostics outside runtime wiring.
38+
- PASS: Added reason text for every non-`PASS` status rendered by PR014 code.
39+
40+
## Validation Compliance
41+
42+
- PASS: Ran `git diff --check`.
43+
- PASS: Ran targeted Admin System Health source validation.
44+
- PASS: Ran targeted Admin System Health Playwright route/behavior validation.
45+
- PASS: Verified no SQLite was introduced in the changed page/runtime module.
46+
- PASS: Verified no secret values are exposed by the page behavior.
47+
- PASS: Verified every non-`PASS` status has reason text.
48+
- PASS: Produced Playwright V8 coverage notes for changed runtime JavaScript.
49+
- PASS: Did not run samples.
50+
51+
## Reports And Packaging
52+
53+
- PASS: Created queued-scope PR report.
54+
- PASS: Created manual validation notes.
55+
- PASS: Created instruction compliance checklist.
56+
- PASS: Generate `codex_review.diff` after scoped changes.
57+
- PASS: Generate `codex_changed_files.txt` after scoped changes.
58+
- PASS: Create repo-structured delta ZIP under `tmp/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime_delta.zip`.
59+
- PASS: Verify no report remains modified after ZIP creation.
60+
61+
## Merge Control
62+
63+
- PASS: No merge performed.
64+
- PASS: Owner-controlled EOD merge approval remains required.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# PR_26171_GAMMA_014 Manual Validation Notes
2+
3+
## Manual Review Notes
4+
5+
- Reviewed `admin/system-health.html` after adding Postgres diagnostics hooks.
6+
- Confirmed the page still uses Theme V2 only and keeps scripts external.
7+
- Confirmed the Database Health table remains Postgres-only.
8+
- Confirmed the runtime module reads only the safe Admin System Health status API.
9+
- Confirmed the runtime module renders provider, host, port, database, migration summary, and connection status.
10+
- Confirmed no storage action buttons or R2 connectivity controls were introduced in PR014.
11+
- Confirmed no client-side secret values, database URLs, access keys, or secret keys are rendered.
12+
- Confirmed non-`PASS` status cells include hover/accessibility reason text.
13+
- Confirmed no SQLite runtime or persistence code was introduced.
14+
15+
## Validation Notes
16+
17+
- `git diff --check` passed.
18+
- Targeted Admin System Health source validation passed.
19+
- Targeted Admin System Health Playwright route/behavior spec passed with 3 tests.
20+
- Playwright V8 coverage report includes `assets/theme-v2/js/admin-system-health.js`.
21+
- Samples were not run because samples are outside this queued Admin diagnostics scope.
22+
23+
## User Review Focus
24+
25+
- Review whether the Postgres connection and migration wording is the desired admin-facing phrasing.
26+
- Review whether WARN/PENDING semantics are acceptable when local Postgres is not configured.
27+
- Confirm owner approval before any EOD merge.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime
2+
3+
## Summary
4+
5+
Queued scope 014 was applied to the existing draft PR #36 workstream branch:
6+
7+
- PR #36: `PR_26171_GAMMA_011-admin-system-health-foundation`
8+
- Branch: `team/GAMMA/admin`
9+
10+
This queued scope wires the Admin System Health Postgres diagnostics table to the existing safe Admin System Health status API without creating a separate GitHub PR.
11+
12+
## Scope Evidence
13+
14+
- Added stable Postgres table hooks in `admin/system-health.html`.
15+
- Loaded `assets/theme-v2/js/admin-system-health.js` as an external Theme V2 module.
16+
- Replaced the old unused broad controller with a focused current-page renderer.
17+
- Used the existing safe API contract through `readAdminSystemHealthStatus()`.
18+
- Rendered provider, host, port, database, migration summary, and connection status.
19+
- Preserved Postgres-only database direction.
20+
- Kept Cloudflare R2 and runtime diagnostics outside PR014 runtime wiring.
21+
- Left diagnostics as `PENDING` only when the safe status API is unavailable or refuses to render.
22+
- Preserved masked secret display and did not expose database URLs, passwords, keys, tokens, or storage credentials.
23+
- Did not introduce SQLite, new persistence, storage action wiring, inline CSS, or inline JavaScript.
24+
25+
## Safe Backend Contract
26+
27+
- Existing safe contract found: `GET /api/admin/system-health/status`.
28+
- Existing browser API client found: `src/api/admin-system-health-api-client.js`.
29+
- Existing server payload includes `databaseStatus` with safe host, port, database name, migration counts, last migration metadata, and status fields.
30+
- Existing payload flags `secretEditingAllowed: false` and `secretsExposed: false`; the page refuses to render runtime diagnostics if either safe-secret condition is violated.
31+
32+
## Instruction Start Gate
33+
34+
- Instructions read: PASS
35+
- `docs_build/dev/PROJECT_INSTRUCTIONS.md`: read before edits
36+
- `docs_build/dev/PROJECT_MULTI_PC.txt`: read before edits
37+
- Current branch: `team/GAMMA/admin`
38+
- Clean status before edits: PASS
39+
- Local/origin sync before edits: PASS (`0 0`)
40+
- TEAM token: `GAMMA`
41+
- TEAM ownership: PASS by explicit Master Control/user assignment for diagnostics/admin workstream
42+
- Implementation path: `admin/system-health.html`, `assets/theme-v2/js/admin-system-health.js`, `tests/playwright/tools/AdminHealthOperationsPage.spec.mjs`
43+
- Existing draft PR target: PR #36
44+
- Separate PR creation: SKIP by explicit user instruction
45+
- Merge: SKIP, owner-controlled EOD approval remains required
46+
47+
Note: the merged instruction file still contains older main-only guard wording. This queued update proceeded only after explicit user instruction to continue on `team/GAMMA/admin` and update existing draft PR #36 rather than creating a separate PR014 GitHub PR.
48+
49+
## Validation
50+
51+
- PASS: `git diff --check`
52+
- PASS: targeted source check found no SQLite references in `admin/system-health.html` or `assets/theme-v2/js/admin-system-health.js`.
53+
- PASS: targeted source check verified every static non-`PASS` status in `admin/system-health.html` has `title` or `aria-label` reason text.
54+
- PASS: targeted source check verified PR014 did not add storage connectivity action wiring.
55+
- PASS: Playwright verified the admin page calls `/api/admin/system-health/status`.
56+
- PASS: Playwright verified the admin page does not call `/api/admin/system-health/storage-connectivity-action`.
57+
- PASS: Playwright verified non-admin sessions do not call the Admin System Health status endpoint.
58+
- PASS: Playwright verified the page does not expose full Postgres URLs or configured secret values.
59+
- PASS: `npx playwright test tests/playwright/tools/AdminHealthOperationsPage.spec.mjs --config=codex_playwright_system_chrome.config.cjs --project=playwright` (3 passed)
60+
- PASS: Playwright V8 coverage report lists changed runtime JS file `assets/theme-v2/js/admin-system-health.js`.
61+
62+
## Playwright Coverage Notes
63+
64+
- `docs_build/dev/reports/playwright_v8_coverage_report.txt`
65+
- `docs_build/dev/reports/coverage_changed_js_guardrail.txt`
66+
- Changed runtime JS coverage: `(93%) assets/theme-v2/js/admin-system-health.js - executed lines 104/104; executed functions 13/14`
67+
- Coverage is advisory only; no threshold is enforced.
68+
69+
## Skipped Lanes
70+
71+
- Full samples smoke: skipped by request because this Admin diagnostics runtime PR does not touch samples.
72+
- Full Playwright suite: skipped because the targeted Admin System Health route/behavior spec covers the changed page and runtime module.
73+
- Storage/R2 runtime action validation: skipped because PR014 only wires Postgres diagnostics.
74+
- Runtime environment dynamic visibility validation: skipped because PR016 owns runtime environment wiring.
75+
76+
## Required Reports
77+
78+
- `docs_build/dev/reports/codex_review.diff`
79+
- `docs_build/dev/reports/codex_changed_files.txt`
80+
- `docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime.md`
81+
- `docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime-manual-validation-notes.md`
82+
- `docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime-instruction-compliance-checklist.md`
83+
- `docs_build/dev/reports/playwright_v8_coverage_report.txt`
84+
- `docs_build/dev/reports/coverage_changed_js_guardrail.txt`
85+
86+
## ZIP Artifact
87+
88+
- `tmp/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime_delta.zip`
89+
- Generated from the current `team/GAMMA/admin` branch delta against the branch merge-base with `origin/main`, preserving the existing PR #36 workstream context.
90+
91+
## EOD Approval
92+
93+
No merge was performed. EOD merge remains owner-controlled and requires explicit approval.
Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
Base merge-base: e8845dae6e990164072d4ee9b37ec81eda563fc3
2-
Head at artifact refresh: 0514f858342704357ec1cdf9b8af9497a9d40a1d
2+
Head at artifact refresh: 49e4cca2a249909b569a2dd710c2df6d3a3fe679
33

44
Working tree status at artifact generation:
55
M admin/system-health.html
6-
A docs_build/dev/reports/PR_26171_GAMMA_013-admin-system-health-diagnostics-plan-instruction-compliance-checklist.md
7-
A docs_build/dev/reports/PR_26171_GAMMA_013-admin-system-health-diagnostics-plan-manual-validation-notes.md
8-
A docs_build/dev/reports/PR_26171_GAMMA_013-admin-system-health-diagnostics-plan.md
6+
M assets/theme-v2/js/admin-system-health.js
7+
A docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime-instruction-compliance-checklist.md
8+
A docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime-manual-validation-notes.md
9+
A docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime.md
10+
M docs_build/dev/reports/codex_changed_files.txt
11+
M docs_build/dev/reports/codex_review.diff
12+
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
13+
M docs_build/dev/reports/playwright_v8_coverage_report.txt
914
M tests/playwright/tools/AdminHealthOperationsPage.spec.mjs
1015

1116
Changed files against merge-base:
1217
M admin/system-health.html
18+
M assets/theme-v2/js/admin-system-health.js
1319
A docs_build/dev/reports/PR_26171_GAMMA_011-admin-system-health-foundation-instruction-compliance-checklist.md
1420
A docs_build/dev/reports/PR_26171_GAMMA_011-admin-system-health-foundation-manual-validation-notes.md
1521
A docs_build/dev/reports/PR_26171_GAMMA_011-admin-system-health-foundation.md
@@ -19,22 +25,29 @@ A docs_build/dev/reports/PR_26171_GAMMA_012-admin-system-health-status-reason-cl
1925
A docs_build/dev/reports/PR_26171_GAMMA_013-admin-system-health-diagnostics-plan-instruction-compliance-checklist.md
2026
A docs_build/dev/reports/PR_26171_GAMMA_013-admin-system-health-diagnostics-plan-manual-validation-notes.md
2127
A docs_build/dev/reports/PR_26171_GAMMA_013-admin-system-health-diagnostics-plan.md
28+
A docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime-instruction-compliance-checklist.md
29+
A docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime-manual-validation-notes.md
30+
A docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime.md
2231
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
2332
M docs_build/dev/reports/playwright_v8_coverage_report.txt
2433
M tests/playwright/tools/AdminHealthOperationsPage.spec.mjs
2534

2635
Stat against merge-base:
27-
admin/system-health.html | 367 ++++++---------------
36+
admin/system-health.html | 366 +++++------------
37+
assets/theme-v2/js/admin-system-health.js | 432 ++++-----------------
2838
...-foundation-instruction-compliance-checklist.md | 32 ++
2939
...em-health-foundation-manual-validation-notes.md | 34 ++
3040
...171_GAMMA_011-admin-system-health-foundation.md | 65 ++++
31-
...son-cleanup-instruction-compliance-checklist.md | 57 ++++
41+
...son-cleanup-instruction-compliance-checklist.md | 57 +++
3242
...tatus-reason-cleanup-manual-validation-notes.md | 26 ++
3343
...12-admin-system-health-status-reason-cleanup.md | 70 ++++
34-
...ostics-plan-instruction-compliance-checklist.md | 64 ++++
44+
...ostics-plan-instruction-compliance-checklist.md | 64 +++
3545
...lth-diagnostics-plan-manual-validation-notes.md | 27 ++
36-
...MMA_013-admin-system-health-diagnostics-plan.md | 82 +++++
46+
...MMA_013-admin-system-health-diagnostics-plan.md | 82 ++++
47+
...ics-runtime-instruction-compliance-checklist.md | 64 +++
48+
...-diagnostics-runtime-manual-validation-notes.md | 27 ++
49+
...GAMMA_014-admin-postgres-diagnostics-runtime.md | 93 +++++
3750
.../dev/reports/coverage_changed_js_guardrail.txt | 6 +-
38-
.../dev/reports/playwright_v8_coverage_report.txt | 31 +-
39-
.../tools/AdminHealthOperationsPage.spec.mjs | 87 ++++-
40-
13 files changed, 636 insertions(+), 312 deletions(-)
51+
.../dev/reports/playwright_v8_coverage_report.txt | 34 +-
52+
.../tools/AdminHealthOperationsPage.spec.mjs | 114 +++++-
53+
17 files changed, 933 insertions(+), 660 deletions(-)

0 commit comments

Comments
 (0)