From 404092e81dcd2d2eb84a6a367b45381d42f73299 Mon Sep 17 00:00:00 2001 From: Nyk <0xnykcd@googlemail.com> Date: Sat, 21 Mar 2026 22:42:50 +0700 Subject: [PATCH] fix(tui): treat DB+Disk as essential health checks --- scripts/mc-tui.cjs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/mc-tui.cjs b/scripts/mc-tui.cjs index 581515b..e0159a3 100755 --- a/scripts/mc-tui.cjs +++ b/scripts/mc-tui.cjs @@ -146,17 +146,19 @@ function renderHeader(cols, baseUrl, healthData, refreshMs) { if (healthData?._error) { status = ansi.red('UNREACHABLE'); } else { - // Show healthy if core checks pass, even when gateway is down + // Show healthy if essential checks pass (DB + Disk), even when + // gateway is down or dev-mode memory is high const checks = healthData?.checks || []; - const coreChecks = checks.filter(c => c.name !== 'Gateway'); - const coreHealthy = coreChecks.length > 0 && coreChecks.every(c => c.status === 'healthy'); - const gwCheck = checks.find(c => c.name === 'Gateway'); - const gwDown = gwCheck && gwCheck.status !== 'healthy'; + const essentialNames = new Set(['Database', 'Disk Space']); + const essentialChecks = checks.filter(c => essentialNames.has(c.name)); + const essentialOk = essentialChecks.length > 0 && essentialChecks.every(c => c.status === 'healthy'); + const warnings = checks.filter(c => !essentialNames.has(c.name) && c.status !== 'healthy'); + const warningNames = warnings.map(c => c.name.toLowerCase()).join(', '); - if (coreHealthy && !gwDown) { + if (essentialOk && warnings.length === 0) { status = ansi.green('healthy'); - } else if (coreHealthy && gwDown) { - status = ansi.yellow('healthy') + ansi.dim(' (no gateway)'); + } else if (essentialOk) { + status = ansi.yellow('operational') + ansi.dim(` (${warningNames})`); } else { status = statusColor(healthData?.status || 'unknown'); }