Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions admin/system-health.html
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,17 @@ <h3>Manual Health Actions</h3>
<tr>
<th scope="col">Check</th>
<th scope="col">Target</th>
<th scope="col">Timing</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<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>
<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>
<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>
<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>
<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>
<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>
<tr><td>Bucket connectivity</td><td data-admin-system-health-storage-value="bucket">Loading</td><td data-admin-system-health-storage-timing="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>
<tr><td>List</td><td data-admin-system-health-storage-value="list">Loading</td><td data-admin-system-health-storage-timing="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>
<tr><td>Upload</td><td data-admin-system-health-storage-value="upload">Loading</td><td data-admin-system-health-storage-timing="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>
<tr><td>Read</td><td data-admin-system-health-storage-value="read">Loading</td><td data-admin-system-health-storage-timing="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>
<tr><td>Delete</td><td data-admin-system-health-storage-value="delete">Loading</td><td data-admin-system-health-storage-timing="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>
<tr><td>Last checked</td><td data-admin-system-health-storage-value="lastChecked">Loading</td><td data-admin-system-health-storage-timing="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>
</tbody>
</table>
</div>
Expand Down
41 changes: 33 additions & 8 deletions assets/theme-v2/js/admin-system-health.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
readAdminSystemHealthStatus,
runAdminSystemHealthAction,
runAdminSystemHealthStorageConnectivityAction,
runAdminSystemHealthStorageExpandedValidation,
} from "../../../src/api/admin-system-health-api-client.js";
import {
applyStatusNode,
Expand Down Expand Up @@ -54,6 +54,10 @@ class AdminSystemHealthController {
node.dataset.adminSystemHealthStorageStatus,
node,
]));
this.storageTimings = new Map(Array.from(root.querySelectorAll("[data-admin-system-health-storage-timing]")).map((node) => [
node.dataset.adminSystemHealthStorageTiming,
node,
]));
this.runtimeHealthValues = new Map(Array.from(root.querySelectorAll("[data-admin-system-health-runtime-health-value]")).map((node) => [
node.dataset.adminSystemHealthRuntimeHealthValue,
node,
Expand Down Expand Up @@ -122,6 +126,13 @@ class AdminSystemHealthController {
this.setStatusNode(node, status, reason);
}

setStorageTiming(key, value, fallback) {
const node = this.storageTimings.get(key);
if (node) {
node.textContent = asText(value, fallback);
}
}

setRuntimeHealthValue(key, value, fallback) {
const node = this.runtimeHealthValues.get(key);
if (node) {
Expand Down Expand Up @@ -195,6 +206,7 @@ class AdminSystemHealthController {
renderStoragePending(reason) {
["bucket", "list", "upload", "read", "delete", "lastChecked"].forEach((key) => {
this.setStorageStatus(key, "PENDING", reason);
this.setStorageTiming(key, "not available");
});
this.renderRuntimePending(reason);
}
Expand Down Expand Up @@ -261,8 +273,10 @@ class AdminSystemHealthController {
const reason = storageStatus.message || "Cloudflare R2 configuration status returned by the safe Admin System Health API.";
this.setStorageValue("bucket", storageStatus.environmentFolder ? `${storageStatus.bucket || "not configured"} ${storageStatus.environmentFolder}` : storageStatus.bucket, "not configured");
this.setStorageStatus("bucket", storageStatus.bucketStatus || storageStatus.status, reason);
this.setStorageTiming("bucket", storageStatus.lastChecked ? "configuration status" : "not available");
this.setStorageValue("lastChecked", storageStatus.lastChecked, "not available");
this.setStorageStatus("lastChecked", storageStatus.lastChecked ? "PASS" : "WARN", reason);
this.setStorageTiming("lastChecked", storageStatus.lastChecked ? "configuration status" : "not available");
}

renderRuntimeHealthPending(reason) {
Expand Down Expand Up @@ -684,9 +698,11 @@ class AdminSystemHealthController {
}
this.setStorageValue(key, this.storageResultTarget(result));
this.setStorageStatus(key, result.status, result.message || "R2 diagnostic returned without a message.");
this.setStorageTiming(key, Number.isFinite(Number(result.durationMs)) ? `${result.durationMs} ms` : "not available");
if (result.lastChecked) {
this.setStorageValue("lastChecked", result.lastChecked);
this.setStorageStatus("lastChecked", "PASS", "Most recent current-environment R2 health check timestamp.");
this.setStorageTiming("lastChecked", Number.isFinite(Number(result.durationMs)) ? `${result.durationMs} ms` : "not available");
}
}

Expand Down Expand Up @@ -732,15 +748,24 @@ class AdminSystemHealthController {
runStorageDiagnostics() {
STORAGE_DIAGNOSTIC_ACTIONS.forEach(({ key }) => {
this.setStorageStatus(key, "PENDING", "R2 diagnostic is running through the safe Admin System Health API.");
this.setStorageTiming(key, "running");
});
STORAGE_DIAGNOSTIC_ACTIONS.forEach(({ actionId, key }) => {
try {
this.renderStorageResult(key, runAdminSystemHealthStorageConnectivityAction(actionId));
} catch (error) {
const message = error instanceof Error ? error.message : "Safe R2 diagnostic API is unavailable.";
try {
const validation = runAdminSystemHealthStorageExpandedValidation();
const diagnostics = Array.isArray(validation.storageDiagnostics) ? validation.storageDiagnostics : [];
diagnostics.forEach((storageResult) => {
const key = STORAGE_DIAGNOSTIC_ACTION_KEY_BY_ID.get(storageResult.actionId);
if (key) {
this.renderStorageResult(key, storageResult);
}
});
} catch (error) {
const message = error instanceof Error ? error.message : "Safe R2 diagnostic API is unavailable.";
STORAGE_DIAGNOSTIC_ACTIONS.forEach(({ key }) => {
this.setStorageStatus(key, "PENDING", message);
}
});
this.setStorageTiming(key, "not available");
});
}
}

createCell(text) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# PR_26177_CHARLIE_030-r2-storage-health-expanded-validation

Team: Charlie
Branch: pr/26177-CHARLIE-030-r2-storage-health-expanded-validation
Base: pr/26177-CHARLIE-029-system-health-postgres-metrics-panel
Lifecycle: Build / Validation
Repair: Rebased onto repaired PR_26177_CHARLIE_029 branch on 2026-06-25.

## Scope
- Expanded System Health R2 validation into an API-owned current-environment validation run.
- Added safe list/upload/read/delete diagnostics with duration, operation label, cleanup status, and permanent-object metadata.
- Updated the System Health UI to show storage timing without adding inline styles, script blocks, or page-local CSS.

## Changed Files
- admin/system-health.html
- assets/theme-v2/js/admin-system-health.js
- src/api/admin-system-health-api-client.js
- src/dev-runtime/server/local-api-router.mjs
- tests/api/admin-system-health/contract.test.mjs
- tests/dev-runtime/AdminHealthOperations.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 src/dev-runtime/server/local-api-router.mjs
- PASS: node --check assets/theme-v2/js/admin-system-health.js
- PASS: node --check src/api/admin-system-health-api-client.js
- 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_030-r2-storage-health-expanded-validation_delta.zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# PR_26177_CHARLIE_030-r2-storage-health-expanded-validation Branch Validation

Branch: pr/26177-CHARLIE-030-r2-storage-health-expanded-validation
Expected stack base: pr/26177-CHARLIE-029-system-health-postgres-metrics-panel
Current status at validation:
## pr/26177-CHARLIE-030-r2-storage-health-expanded-validation
Updated onto repaired PR_26177_CHARLIE_029 stack base.

Result: PASS

Checks:
- PASS: Branch created from PR 029 branch for the approved stacked chain.
- PASS: Active branch matches PR identity.
- PASS: Worktree contained only scoped PR changes and generated validation reports.
- PASS: Branch is based on repaired PR 029 branch.
- PASS: Rebase conflict scope was generated report artifacts only.
- PASS: No start_of_day files modified.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# PR_26177_CHARLIE_030-r2-storage-health-expanded-validation Manual Validation Notes

- Confirmed the browser calls one expanded R2 validation action instead of owning the list/upload/read/delete sequence itself.
- Confirmed Storage Health displays timing values for list, upload, read, and delete rows.
- Confirmed storage validation payload includes cleanup status and permanent-object metadata.
- Confirmed storage diagnostics stay scoped to the current environment folder.
- Confirmed no storage credentials or secrets are displayed.
- 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,13 @@
# PR_26177_CHARLIE_030-r2-storage-health-expanded-validation Requirement Checklist

- PASS: Expanded Cloud/R2 storage health validation.
- PASS: Included safe bucket/list/write/read/delete validation through API-owned action contract.
- PASS: Included timing/status fields where available.
- PASS: Does not create browser-owned storage health state.
- PASS: Test object cleanup is attempted in the same expanded validation run.
- PASS: Does not expose secrets.
- PASS: Current environment folder only.
- PASS: No unrelated files modified.
- PASS: No start_of_day files modified.
- PASS: Rebased onto repaired PR_26177_CHARLIE_029 branch.
- PASS: Shows unavailable/not configured states explicitly.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# PR_26177_CHARLIE_030-r2-storage-health-expanded-validation Validation Lane Report

Impacted lanes:
- runtime: Local API Admin System Health R2 action contract.
- contract: Admin System Health API contract tests.
- UI: Admin System Health Theme V2 page controller and markup.
- Playwright: targeted Admin System Health page spec.

Commands:
- PASS: node --check src/dev-runtime/server/local-api-router.mjs
- PASS: node --check assets/theme-v2/js/admin-system-health.js
- PASS: node --check src/api/admin-system-health-api-client.js
- 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

Skipped lanes:
- Full samples smoke skipped; not impacted by System Health storage diagnostics.
- Full Project Workspace suite skipped; targeted Admin/System Health coverage was sufficient for this scoped page/API change.

Result: PASS
59 changes: 30 additions & 29 deletions docs_build/dev/reports/codex_changed_files.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
# git diff --name-only origin/main --
# git diff --name-only pr/26177-CHARLIE-029-system-health-postgres-metrics-panel --
admin/system-health.html
assets/theme-v2/js/admin-system-health.js
docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel.md
docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel_branch-validation.md
docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel_manual-validation-notes.md
docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel_requirements-checklist.md
docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel_validation-lane.md
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation.md
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_branch-validation.md
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_manual-validation-notes.md
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_requirements-checklist.md
docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_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
src/api/admin-system-health-api-client.js
src/dev-runtime/server/local-api-router.mjs
tests/api/admin-system-health/contract.test.mjs
tests/dev-runtime/AdminHealthOperations.test.mjs
tests/playwright/tools/AdminHealthOperationsPage.spec.mjs

# git status --short
M docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel.md
M docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel_branch-validation.md
M docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel_manual-validation-notes.md
M docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel_requirements-checklist.md
M docs_build/dev/reports/PR_26177_CHARLIE_029-system-health-postgres-metrics-panel_validation-lane.md
M docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation.md
M docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_branch-validation.md
M docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_manual-validation-notes.md
M docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_requirements-checklist.md
M docs_build/dev/reports/PR_26177_CHARLIE_030-r2-storage-health-expanded-validation_validation-lane.md
M docs_build/dev/reports/codex_review.diff
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
M docs_build/dev/reports/playwright_v8_coverage_report.txt

# git diff --stat origin/main --
admin/system-health.html | 16 +
assets/theme-v2/js/admin-system-health.js | 42 ++
...LIE_029-system-health-postgres-metrics-panel.md | 39 +
...lth-postgres-metrics-panel_branch-validation.md | 17 +
...stgres-metrics-panel_manual-validation-notes.md | 9 +
...ostgres-metrics-panel_requirements-checklist.md | 16 +
...ealth-postgres-metrics-panel_validation-lane.md | 21 +
docs_build/dev/reports/codex_changed_files.txt | 42 +-
docs_build/dev/reports/codex_review.diff | 794 +++++++++++++++------
.../dev/reports/coverage_changed_js_guardrail.txt | 4 +-
.../dev/reports/playwright_v8_coverage_report.txt | 24 +-
src/dev-runtime/server/local-api-router.mjs | 115 ++-
tests/api/admin-system-health/contract.test.mjs | 15 +
tests/dev-runtime/AdminHealthOperations.test.mjs | 20 +
.../tools/AdminHealthOperationsPage.spec.mjs | 11 +
15 files changed, 924 insertions(+), 261 deletions(-)
# git diff --stat pr/26177-CHARLIE-029-system-health-postgres-metrics-panel --
admin/system-health.html | 13 +-
assets/theme-v2/js/admin-system-health.js | 41 +-
...IE_030-r2-storage-health-expanded-validation.md | 35 +
...health-expanded-validation_branch-validation.md | 17 +
...-expanded-validation_manual-validation-notes.md | 9 +
...h-expanded-validation_requirements-checklist.md | 13 +
...e-health-expanded-validation_validation-lane.md | 22 +
docs_build/dev/reports/codex_changed_files.txt | 70 +-
docs_build/dev/reports/codex_review.diff | 988 +++++++++++----------
.../dev/reports/coverage_changed_js_guardrail.txt | 6 +-
.../dev/reports/playwright_v8_coverage_report.txt | 17 +-
src/api/admin-system-health-api-client.js | 4 +
src/dev-runtime/server/local-api-router.mjs | 105 ++-
tests/api/admin-system-health/contract.test.mjs | 19 +
tests/dev-runtime/AdminHealthOperations.test.mjs | 6 +
.../tools/AdminHealthOperationsPage.spec.mjs | 8 +-
16 files changed, 851 insertions(+), 522 deletions(-)
Loading
Loading