@@ -1028,6 +1028,71 @@ function systemHealthRuntimeEnvironment(env = process.env) {
10281028 } ;
10291029}
10301030
1031+ function systemHealthHistoryRow ( { checkedAt, environmentName, area, result, summary, kind = "recent check" } ) {
1032+ return {
1033+ area,
1034+ checkedAt,
1035+ environmentName,
1036+ kind,
1037+ result : normalizeHealthStatus ( result ) ,
1038+ summary : String ( summary || "No summary returned." ) ,
1039+ } ;
1040+ }
1041+
1042+ function systemHealthCheckHistory ( {
1043+ checkedAt,
1044+ databaseStatus = { } ,
1045+ environmentIdentity = { } ,
1046+ runtimeEnvironment = { } ,
1047+ storageStatus = { } ,
1048+ } ) {
1049+ const environmentName = environmentIdentity . name || "Unknown" ;
1050+ const databaseResponseTime = Number . isFinite ( databaseStatus . responseTimeMs )
1051+ ? `${ databaseStatus . responseTimeMs } ms`
1052+ : "not available" ;
1053+ const recentChecks = [
1054+ systemHealthHistoryRow ( {
1055+ area : "Environment Summary" ,
1056+ checkedAt,
1057+ environmentName,
1058+ result : environmentIdentity . status ,
1059+ summary : `Current deployment ${ environmentName } ; hosting ${ environmentIdentity . hostingModel || "not configured" } ; storage folder ${ environmentIdentity . storageFolder || "not configured" } .` ,
1060+ } ) ,
1061+ systemHealthHistoryRow ( {
1062+ area : "Database Health" ,
1063+ checkedAt,
1064+ environmentName,
1065+ result : databaseStatus . connectivityStatus || databaseStatus . status ,
1066+ summary : `${ databaseStatus . databaseType || "PostgreSQL" } connectivity ${ databaseStatus . connectivity || "not configured" } ; response time ${ databaseResponseTime } ; version ${ databaseStatus . version || "not available" } .` ,
1067+ } ) ,
1068+ systemHealthHistoryRow ( {
1069+ area : "Storage Health" ,
1070+ checkedAt,
1071+ environmentName,
1072+ result : storageStatus . status ,
1073+ summary : `Cloudflare R2 folder ${ storageStatus . environmentFolder || environmentIdentity . storageFolder || "not configured" } ; bucket ${ storageStatus . configured ? "configured" : "not configured" } ; last checked ${ storageStatus . lastChecked || checkedAt } .` ,
1074+ } ) ,
1075+ systemHealthHistoryRow ( {
1076+ area : "Runtime Health" ,
1077+ checkedAt,
1078+ environmentName,
1079+ result : runtimeEnvironment . status ,
1080+ summary : runtimeEnvironment . message || "Runtime environment health unavailable." ,
1081+ } ) ,
1082+ ] ;
1083+ const issueRows = recentChecks
1084+ . filter ( ( row ) => row . result !== "PASS" )
1085+ . map ( ( row ) => systemHealthHistoryRow ( {
1086+ area : `${ row . area } ${ row . result === "FAIL" ? "Failure" : "Warning" } ` ,
1087+ checkedAt : row . checkedAt ,
1088+ environmentName : row . environmentName ,
1089+ kind : row . result === "FAIL" ? "failure" : "warning" ,
1090+ result : row . result ,
1091+ summary : row . summary ,
1092+ } ) ) ;
1093+ return [ ...recentChecks , ...issueRows ] ;
1094+ }
1095+
10311096function systemHealthR2Readiness ( storageStatus ) {
10321097 const credentialsConfigured = storageStatus . accessKeyConfigured === true && storageStatus . secretKeyConfigured === true ;
10331098 const configurationReady = storageStatus . configured === true
@@ -3838,6 +3903,13 @@ LIMIT 1;
38383903 const r2Readiness = systemHealthR2Readiness ( storageStatus ) ;
38393904 const runtimeEnvironment = systemHealthRuntimeEnvironment ( ) ;
38403905 const operationsHealth = adminOperationsHealth ( this . standaloneTables ) ;
3906+ const healthCheckHistory = systemHealthCheckHistory ( {
3907+ checkedAt,
3908+ databaseStatus,
3909+ environmentIdentity,
3910+ runtimeEnvironment,
3911+ storageStatus,
3912+ } ) ;
38413913 const importBlocked = promotionFoundation . importOverwriteAllowed === false
38423914 && promotionFoundation . browserExecutionAllowed === false
38433915 && promotionFoundation . destructiveOperationsAllowed === false ;
@@ -3961,6 +4033,7 @@ LIMIT 1;
39614033 message : "Admin System Health loaded safe status only." ,
39624034 environmentIdentity,
39634035 environmentMap,
4036+ healthCheckHistory,
39644037 operationsHealth,
39654038 overview,
39664039 pressureLabels : SYSTEM_HEALTH_LIMIT_PRESSURE_LABELS ,
0 commit comments