Skip to content

Commit 7fe5f7b

Browse files
committed
Add System Health environment comparison
1 parent 3acec8b commit 7fe5f7b

15 files changed

Lines changed: 635 additions & 546 deletions

admin/system-health.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ <h2>Admin</h2>
4040
<div class="accordion-body content-stack">
4141
<p>Environment Identity</p>
4242
<p>Environment Map</p>
43+
<p>Environment Health Comparison</p>
4344
<p>Environment Capabilities</p>
4445
<p>Health API Contract</p>
4546
<p>Admin API Registry</p>
@@ -110,6 +111,25 @@ <h2 id="admin-system-health-title">System Health Tables</h2>
110111
</tbody>
111112
</table>
112113
</div>
114+
<div class="table-wrapper">
115+
<table class="data-table" aria-label="Environment health comparison">
116+
<caption>Environment Health Comparison</caption>
117+
<thead>
118+
<tr>
119+
<th scope="col">Environment</th>
120+
<th scope="col">Hosting model</th>
121+
<th scope="col">Runtime expectation</th>
122+
<th scope="col">Database model</th>
123+
<th scope="col">Storage folder</th>
124+
<th scope="col">State</th>
125+
<th scope="col">Status</th>
126+
</tr>
127+
</thead>
128+
<tbody data-admin-system-health-environment-comparison-rows>
129+
<tr><td>Environment comparison</td><td>Reference-only</td><td>Waiting for safe API status</td><td>Reference-only</td><td>Reference-only</td><td>Unavailable</td><td data-health-status="PENDING" title="Reason: environment comparison has not loaded yet." aria-label="PENDING: environment comparison has not loaded yet.">PENDING</td></tr>
130+
</tbody>
131+
</table>
132+
</div>
113133
<div class="table-wrapper">
114134
<table class="data-table" aria-label="Environment capabilities">
115135
<caption>Environment Capabilities</caption>

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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class AdminSystemHealthController {
6969
this.historyRows = root.querySelector("[data-admin-system-health-history-rows]");
7070
this.apiContractRows = root.querySelector("[data-admin-system-health-api-contract-rows]");
7171
this.apiRegistryRows = root.querySelector("[data-admin-system-health-api-registry-rows]");
72+
this.environmentComparisonRows = root.querySelector("[data-admin-system-health-environment-comparison-rows]");
7273
this.capabilityRows = root.querySelector("[data-admin-system-health-capability-rows]");
7374
this.featureFlagRows = root.querySelector("[data-admin-system-health-feature-flag-rows]");
7475
this.actionRows = root.querySelector("[data-admin-system-health-action-rows]");
@@ -160,6 +161,7 @@ class AdminSystemHealthController {
160161
this.renderPostgresMetricsPending(reason);
161162
this.renderStoragePending(reason);
162163
this.renderRuntimeHealthPending(reason);
164+
this.renderEnvironmentComparisonPending(reason);
163165
this.renderEnvironmentCapabilitiesPending(reason);
164166
this.renderApiContractPending(reason);
165167
this.renderAdminApiRegistryPending(reason);
@@ -203,6 +205,53 @@ class AdminSystemHealthController {
203205
this.setEnvironmentStatus("lastHealthCheck", environmentIdentity.lastHealthCheck ? "PASS" : "WARN", reason);
204206
}
205207

208+
renderEnvironmentComparisonPending(reason) {
209+
if (!this.environmentComparisonRows) {
210+
return;
211+
}
212+
const row = document.createElement("tr");
213+
row.append(
214+
this.createCell("Environment comparison"),
215+
this.createCell("Reference-only"),
216+
this.createCell("not available"),
217+
this.createCell("Reference-only"),
218+
this.createCell("Reference-only"),
219+
this.createCell("Unavailable"),
220+
this.createStatusCell("PENDING", reason),
221+
);
222+
this.environmentComparisonRows.replaceChildren(row);
223+
}
224+
225+
renderEnvironmentComparison(environmentComparison = {}) {
226+
if (!this.environmentComparisonRows) {
227+
return;
228+
}
229+
if (environmentComparison?.secretsExposed === true || environmentComparison?.secretEditingAllowed === true) {
230+
this.renderEnvironmentComparisonPending("Safe environment comparison response was blocked because it exposed secret controls.");
231+
return;
232+
}
233+
const rows = Array.isArray(environmentComparison.rows) ? environmentComparison.rows : [];
234+
if (!rows.length) {
235+
this.renderEnvironmentComparisonPending("Safe Admin System Health API returned no environment comparison rows.");
236+
return;
237+
}
238+
const fragment = document.createDocumentFragment();
239+
rows.forEach((comparisonRow) => {
240+
const row = document.createElement("tr");
241+
row.append(
242+
this.createCell(comparisonRow.displayName),
243+
this.createCell(comparisonRow.hostingModel),
244+
this.createCell(comparisonRow.runtimeExpectation),
245+
this.createCell(comparisonRow.databaseModel),
246+
this.createCell(comparisonRow.storageFolder),
247+
this.createCell(comparisonRow.state),
248+
this.createStatusCell(comparisonRow.status, comparisonRow.summary || environmentComparison.message),
249+
);
250+
fragment.append(row);
251+
});
252+
this.environmentComparisonRows.replaceChildren(fragment);
253+
}
254+
206255
renderStoragePending(reason) {
207256
["bucket", "list", "upload", "read", "delete", "lastChecked"].forEach((key) => {
208257
this.setStorageStatus(key, "PENDING", reason);
@@ -893,6 +942,7 @@ class AdminSystemHealthController {
893942
return;
894943
}
895944
this.renderEnvironmentIdentity(data?.environmentIdentity || {});
945+
this.renderEnvironmentComparison(data?.environmentComparison || {});
896946
this.renderPostgresStatus(data?.databaseStatus || {});
897947
this.renderStartupDiagnostics(data?.localApiStartup || {});
898948
this.renderStorageStatus(data?.storageStatus || {});
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# PR_26177_CHARLIE_031-environment-health-comparison
2+
3+
Team: Charlie
4+
Branch: pr/26177-CHARLIE-031-environment-health-comparison
5+
Base: pr/26177-CHARLIE-030-r2-storage-health-expanded-validation
6+
Lifecycle: Build / Validation
7+
8+
## Scope
9+
- Added a server-owned Environment Health Comparison payload and System Health table.
10+
- Shows Local (VS Code), DEV, IST, UAT, and PROD as a reference comparison view.
11+
- Marks only the current deployment as actively checked; peer environments are reference-only Not Configured or Unavailable.
12+
13+
## Changed Files
14+
- admin/system-health.html
15+
- assets/theme-v2/js/admin-system-health.js
16+
- src/dev-runtime/server/local-api-router.mjs
17+
- tests/api/admin-system-health/contract.test.mjs
18+
- tests/dev-runtime/AdminHealthOperations.test.mjs
19+
- tests/playwright/tools/AdminHealthOperationsPage.spec.mjs
20+
- docs_build/dev/reports/coverage_changed_js_guardrail.txt
21+
- docs_build/dev/reports/playwright_v8_coverage_report.txt
22+
23+
## Validation
24+
- PASS: node --check src/dev-runtime/server/local-api-router.mjs
25+
- PASS: node --check assets/theme-v2/js/admin-system-health.js
26+
- PASS: node --test tests/api/admin-system-health/contract.test.mjs
27+
- PASS: node --test tests/dev-runtime/AdminHealthOperations.test.mjs
28+
- PASS: npx playwright test tests/playwright/tools/AdminHealthOperationsPage.spec.mjs --workers=1 --reporter=line
29+
- PASS: git diff --check
30+
31+
## ZIP
32+
- Pending until commit: C:\Users\DavidQ\Documents\GitHub\HTML-JavaScript-Gaming\tmp\PR_26177_CHARLIE_031-environment-health-comparison_delta.zip
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# PR_26177_CHARLIE_031-environment-health-comparison Branch Validation
2+
3+
Branch: pr/26177-CHARLIE-031-environment-health-comparison
4+
Expected stack base: pr/26177-CHARLIE-030-r2-storage-health-expanded-validation
5+
Current status at validation:
6+
## pr/26177-CHARLIE-031-environment-health-comparison
7+
M admin/system-health.html
8+
M assets/theme-v2/js/admin-system-health.js
9+
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
10+
M docs_build/dev/reports/playwright_v8_coverage_report.txt
11+
M src/dev-runtime/server/local-api-router.mjs
12+
M tests/api/admin-system-health/contract.test.mjs
13+
M tests/dev-runtime/AdminHealthOperations.test.mjs
14+
M tests/playwright/tools/AdminHealthOperationsPage.spec.mjs
15+
16+
Result: PASS
17+
18+
Checks:
19+
- PASS: Branch created from PR 030 branch for the approved stacked chain.
20+
- PASS: Active branch matches PR identity.
21+
- PASS: Worktree contained only scoped PR changes and generated validation reports.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# PR_26177_CHARLIE_031-environment-health-comparison Manual Validation Notes
2+
3+
- Confirmed Environment Health Comparison appears as a reference-only table.
4+
- Confirmed DEV current deployment shows Current in the Playwright environment.
5+
- Confirmed peer rows show Not Configured or Unavailable and are not actively checked.
6+
- Confirmed PROD displays with R2 /prd without changing the existing PRD Environment Map.
7+
- Confirmed no secrets or peer-environment health probes are exposed.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# PR_26177_CHARLIE_031-environment-health-comparison Requirement Checklist
2+
3+
- PASS: Added a single System Health comparison view.
4+
- PASS: Includes Local (VS Code), DEV, IST, UAT, and PROD.
5+
- PASS: Shows clear state/status indicators per environment.
6+
- PASS: Local (VS Code) represents local static server/API/developer runtime expectations.
7+
- PASS: Unavailable or non-current environments do not have to pass.
8+
- PASS: No silent defaults; peer rows explicitly show Not Configured or Unavailable.
9+
- PASS: No cross-environment active checks added.
10+
- PASS: Browser UI consumes API/service contract.
11+
- PASS: No unrelated files or start_of_day files modified.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# PR_26177_CHARLIE_031-environment-health-comparison Validation Lane Report
2+
3+
Impacted lanes:
4+
- runtime: Local API Admin System Health status payload.
5+
- contract: Admin System Health API contract tests.
6+
- UI: Admin System Health Theme V2 table rendering.
7+
- Playwright: targeted Admin System Health page spec.
8+
9+
Commands:
10+
- node --check src/dev-runtime/server/local-api-router.mjs
11+
- node --check assets/theme-v2/js/admin-system-health.js
12+
- node --test tests/api/admin-system-health/contract.test.mjs
13+
- node --test tests/dev-runtime/AdminHealthOperations.test.mjs
14+
- npx playwright test tests/playwright/tools/AdminHealthOperationsPage.spec.mjs --workers=1 --reporter=line
15+
- git diff --check
16+
17+
Skipped lanes:
18+
- Full samples smoke skipped; comparison view is Admin System Health only.
19+
- Full Project Workspace suite skipped; targeted Admin/System Health coverage was sufficient.
20+
21+
Result: PASS

docs_build/dev/reports/codex_changed_files.txt

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,30 @@ M admin/system-health.html
33
M assets/theme-v2/js/admin-system-health.js
44
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
55
M docs_build/dev/reports/playwright_v8_coverage_report.txt
6-
M src/api/admin-system-health-api-client.js
76
M src/dev-runtime/server/local-api-router.mjs
87
M tests/api/admin-system-health/contract.test.mjs
98
M tests/dev-runtime/AdminHealthOperations.test.mjs
109
M tests/playwright/tools/AdminHealthOperationsPage.spec.mjs
11-
?? docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation.md
12-
?? docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_branch-validation.md
13-
?? docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_manual-validation-notes.md
14-
?? docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_requirements-checklist.md
15-
?? docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_validation-lane.md
10+
?? docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison.md
11+
?? docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison_branch-validation.md
12+
?? docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison_manual-validation-notes.md
13+
?? docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison_requirements-checklist.md
14+
?? docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison_validation-lane.md
1615

1716
# git ls-files --others --exclude-standard
18-
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation.md
19-
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_branch-validation.md
20-
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_manual-validation-notes.md
21-
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_requirements-checklist.md
22-
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_validation-lane.md
17+
docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison.md
18+
docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison_branch-validation.md
19+
docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison_manual-validation-notes.md
20+
docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison_requirements-checklist.md
21+
docs_build/dev/reports/PR_26177_CHARLIE_031-environment-health-comparison_validation-lane.md
2322

2423
# git diff --stat
25-
admin/system-health.html | 13 +--
26-
assets/theme-v2/js/admin-system-health.js | 41 ++++++--
27-
.../dev/reports/coverage_changed_js_guardrail.txt | 3 +-
28-
.../dev/reports/playwright_v8_coverage_report.txt | 8 +-
29-
src/api/admin-system-health-api-client.js | 4 +
30-
src/dev-runtime/server/local-api-router.mjs | 105 +++++++++++++++++++--
31-
tests/api/admin-system-health/contract.test.mjs | 19 ++++
32-
tests/dev-runtime/AdminHealthOperations.test.mjs | 6 ++
33-
.../tools/AdminHealthOperationsPage.spec.mjs | 8 +-
34-
9 files changed, 180 insertions(+), 27 deletions(-)
24+
admin/system-health.html | 20 ++++++
25+
assets/theme-v2/js/admin-system-health.js | 50 ++++++++++++++
26+
.../dev/reports/coverage_changed_js_guardrail.txt | 2 +-
27+
.../dev/reports/playwright_v8_coverage_report.txt | 6 +-
28+
src/dev-runtime/server/local-api-router.mjs | 76 ++++++++++++++++++++++
29+
tests/api/admin-system-health/contract.test.mjs | 13 ++++
30+
tests/dev-runtime/AdminHealthOperations.test.mjs | 9 +++
31+
.../tools/AdminHealthOperationsPage.spec.mjs | 11 ++++
32+
8 files changed, 183 insertions(+), 4 deletions(-)

0 commit comments

Comments
 (0)