Skip to content

Commit 9740705

Browse files
committed
PR_26175_CHARLIE_009-system-health-current-r2-health
1 parent 2603aeb commit 9740705

8 files changed

Lines changed: 143 additions & 38 deletions

File tree

admin/system-health.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,12 @@ <h2 id="admin-system-health-title">System Health Tables</h2>
143143
</tr>
144144
</thead>
145145
<tbody>
146-
<tr><td>Bucket</td><td data-admin-system-health-storage-value="bucket">Configured bucket placeholder</td><td data-health-status="PENDING" data-admin-system-health-storage-status="bucket" title="Reason: R2 bucket reader is intentionally not wired in this foundation PR." aria-label="PENDING: R2 bucket reader is intentionally not wired in this foundation PR.">PENDING</td></tr>
147-
<tr><td>List</td><td data-admin-system-health-storage-value="list">Objects prefix</td><td data-health-status="PENDING" data-admin-system-health-storage-status="list" title="Reason: R2 list check is intentionally not wired in this foundation PR." aria-label="PENDING: R2 list check is intentionally not wired in this foundation PR.">PENDING</td></tr>
148-
<tr><td>Read</td><td data-admin-system-health-storage-value="read">Health object</td><td data-health-status="PENDING" data-admin-system-health-storage-status="read" title="Reason: R2 read check is intentionally not wired in this foundation PR." aria-label="PENDING: R2 read check is intentionally not wired in this foundation PR.">PENDING</td></tr>
149-
<tr><td>Write</td><td data-admin-system-health-storage-value="write">Health object</td><td data-health-status="PENDING" data-admin-system-health-storage-status="write" title="Reason: R2 write check is intentionally not wired in this foundation PR." aria-label="PENDING: R2 write check is intentionally not wired in this foundation PR.">PENDING</td></tr>
150-
<tr><td>Delete</td><td data-admin-system-health-storage-value="delete">Health object</td><td data-health-status="PENDING" data-admin-system-health-storage-status="delete" title="Reason: R2 delete check is intentionally not wired in this foundation PR." aria-label="PENDING: R2 delete check is intentionally not wired in this foundation PR.">PENDING</td></tr>
146+
<tr><td>Bucket connectivity</td><td data-admin-system-health-storage-value="bucket">Loading</td><td data-health-status="PENDING" data-admin-system-health-storage-status="bucket" title="Reason: R2 bucket connectivity has not loaded yet." aria-label="PENDING: R2 bucket connectivity has not loaded yet.">PENDING</td></tr>
147+
<tr><td>List</td><td data-admin-system-health-storage-value="list">Loading</td><td data-health-status="PENDING" data-admin-system-health-storage-status="list" title="Reason: R2 list check has not loaded yet." aria-label="PENDING: R2 list check has not loaded yet.">PENDING</td></tr>
148+
<tr><td>Upload</td><td data-admin-system-health-storage-value="upload">Loading</td><td data-health-status="PENDING" data-admin-system-health-storage-status="upload" title="Reason: R2 upload check has not loaded yet." aria-label="PENDING: R2 upload check has not loaded yet.">PENDING</td></tr>
149+
<tr><td>Read</td><td data-admin-system-health-storage-value="read">Loading</td><td data-health-status="PENDING" data-admin-system-health-storage-status="read" title="Reason: R2 read check has not loaded yet." aria-label="PENDING: R2 read check has not loaded yet.">PENDING</td></tr>
150+
<tr><td>Delete</td><td data-admin-system-health-storage-value="delete">Loading</td><td data-health-status="PENDING" data-admin-system-health-storage-status="delete" title="Reason: R2 delete check has not loaded yet." aria-label="PENDING: R2 delete check has not loaded yet.">PENDING</td></tr>
151+
<tr><td>Last checked</td><td data-admin-system-health-storage-value="lastChecked">Loading</td><td data-health-status="PENDING" data-admin-system-health-storage-status="lastChecked" title="Reason: R2 health has not loaded yet." aria-label="PENDING: R2 health has not loaded yet.">PENDING</td></tr>
151152
</tbody>
152153
</table>
153154
</div>

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import {
99
} from "../../js/shared/status.js";
1010

1111
const STORAGE_DIAGNOSTIC_ACTIONS = Object.freeze([
12+
Object.freeze({ actionId: "storage-bucket-connectivity", key: "bucket" }),
1213
Object.freeze({ actionId: "storage-list", key: "list" }),
13-
Object.freeze({ actionId: "storage-write-test-object", key: "write" }),
14+
Object.freeze({ actionId: "storage-upload-test-object", key: "upload" }),
1415
Object.freeze({ actionId: "storage-read-test-object", key: "read" }),
1516
Object.freeze({ actionId: "storage-delete-test-object", key: "delete" }),
1617
]);
@@ -127,7 +128,7 @@ class AdminSystemHealthController {
127128
}
128129

129130
renderStoragePending(reason) {
130-
["bucket", "list", "read", "write", "delete"].forEach((key) => {
131+
["bucket", "list", "upload", "read", "delete", "lastChecked"].forEach((key) => {
131132
this.setStorageStatus(key, "PENDING", reason);
132133
});
133134
this.renderRuntimePending(reason);
@@ -153,8 +154,10 @@ class AdminSystemHealthController {
153154

154155
renderStorageStatus(storageStatus = {}) {
155156
const reason = storageStatus.message || "Cloudflare R2 configuration status returned by the safe Admin System Health API.";
156-
this.setStorageValue("bucket", storageStatus.bucket, "not configured");
157+
this.setStorageValue("bucket", storageStatus.environmentFolder ? `${storageStatus.bucket || "not configured"} ${storageStatus.environmentFolder}` : storageStatus.bucket, "not configured");
157158
this.setStorageStatus("bucket", storageStatus.bucketStatus || storageStatus.status, reason);
159+
this.setStorageValue("lastChecked", storageStatus.lastChecked, "not available");
160+
this.setStorageStatus("lastChecked", storageStatus.lastChecked ? "PASS" : "WARN", reason);
158161
}
159162

160163
renderStartupPending(reason) {
@@ -198,9 +201,12 @@ class AdminSystemHealthController {
198201

199202
storageResultTarget(result = {}) {
200203
if (typeof result.keysListed === "number" && result.actionId === "storage-list") {
201-
return `${result.keysListed} object(s) under ${asText(result.projectsPrefix, "configured prefix")}`;
204+
return `${result.keysListed} object(s) under ${asText(result.environmentFolder, "current environment folder")}`;
202205
}
203-
return result.testObjectKey || result.projectsPrefix || result.message || "diagnostic target unavailable";
206+
if (result.actionId === "storage-bucket-connectivity") {
207+
return result.environmentFolder || result.message || "bucket connectivity target unavailable";
208+
}
209+
return result.testObjectKey || result.environmentFolder || result.message || "diagnostic target unavailable";
204210
}
205211

206212
renderStorageResult(key, result = {}) {
@@ -210,6 +216,10 @@ class AdminSystemHealthController {
210216
}
211217
this.setStorageValue(key, this.storageResultTarget(result));
212218
this.setStorageStatus(key, result.status, result.message || "R2 diagnostic returned without a message.");
219+
if (result.lastChecked) {
220+
this.setStorageValue("lastChecked", result.lastChecked);
221+
this.setStorageStatus("lastChecked", "PASS", "Most recent current-environment R2 health check timestamp.");
222+
}
213223
}
214224

215225
runStorageDiagnostics() {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# PR_26175_CHARLIE_009 System Health Current R2 Health
2+
3+
## Scope
4+
5+
Team: Charlie
6+
7+
Purpose: Add current-environment Cloudflare R2 folder health only to Admin System Health.
8+
9+
## Changes
10+
11+
- Replaced the System Health Storage Health rows with current-environment R2 checks:
12+
- bucket connectivity
13+
- list
14+
- upload
15+
- read
16+
- delete
17+
- last checked
18+
- System Health storage diagnostics run against the current environment folder only:
19+
- Local: `/local`
20+
- DEV: `/dev`
21+
- IST: `/ist`
22+
- UAT: `/uat`
23+
- PRD: `/prd`
24+
- Preserved the separate Admin Infrastructure storage diagnostic path that uses the configured project prefix.
25+
- Updated focused API and Playwright tests.
26+
27+
## Architecture Constraint
28+
29+
PASS. R2 health checks target only the current deployment environment folder. No peer environment R2 folders are actively checked by System Health.
30+
31+
## Validation
32+
33+
- PASS: `node --check src/dev-runtime/server/local-api-router.mjs`
34+
- PASS: `node --check assets/theme-v2/js/admin-system-health.js`
35+
- PASS: `git diff --check`
36+
- PASS: `node --test tests/dev-runtime/AdminHealthOperations.test.mjs`
37+
- PASS: `npx playwright test tests/playwright/tools/AdminHealthOperationsPage.spec.mjs --workers=1 --reporter=line`
38+
39+
## Artifact
40+
41+
- `tmp/PR_26175_CHARLIE_009-system-health-current-r2-health_delta.zip`

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
77

88
Changed runtime JS files considered:
99
(0%) src/dev-runtime/server/local-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10-
(89%) assets/theme-v2/js/admin-system-health.js - executed lines 284/284; executed functions 33/37
10+
(89%) assets/theme-v2/js/admin-system-health.js - executed lines 294/294; executed functions 33/37
1111

1212
Guardrail warnings:
1313
(0%) src/dev-runtime/server/local-api-router.mjs - WARNING: changed runtime JS file missing from coverage; advisory only

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Exercised tool entry points detected:
1818

1919
Changed runtime JS files covered:
2020
(0%) src/dev-runtime/server/local-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
21-
(89%) assets/theme-v2/js/admin-system-health.js - executed lines 284/284; executed functions 33/37
21+
(89%) assets/theme-v2/js/admin-system-health.js - executed lines 294/294; executed functions 33/37
2222

2323
Files with executed line/function counts where available:
2424
(36%) src/api/server-api-client.js - executed lines 167/167; executed functions 5/14
@@ -28,7 +28,7 @@ Files with executed line/function counts where available:
2828
(74%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 1001/1001; executed functions 69/93
2929
(80%) src/api/admin-owner-navigation.js - executed lines 42/42; executed functions 4/5
3030
(83%) assets/js/shared/status.js - executed lines 37/37; executed functions 5/6
31-
(89%) assets/theme-v2/js/admin-system-health.js - executed lines 284/284; executed functions 33/37
31+
(89%) assets/theme-v2/js/admin-system-health.js - executed lines 294/294; executed functions 33/37
3232
(91%) assets/theme-v2/js/admin-owner-navigation.js - executed lines 58/58; executed functions 10/11
3333
(100%) src/api/admin-system-health-api-client.js - executed lines 19/19; executed functions 3/3
3434

0 commit comments

Comments
 (0)