feat(tui): classify error reasons on DOWN monitors
CI / test (pull_request) Successful in 2m30s
CI / lint (pull_request) Successful in 1m7s
CI / vulncheck (pull_request) Successful in 46s

Categorize raw error strings into DNS/TCP/TLS/HTTP/ICMP/TMO/PRIV
so users get instant triage from the monitor list without opening
the detail panel.

- Status column shows DOWN:DNS, DOWN:TLS, DOWN:HTTP, etc.
- Inline NAME column errors prefixed with category tag [DNS], [TLS]
- Detail panel shows connection chain checklist for HTTP monitors
  (✓ DNS → ✓ TCP → ✗ TLS → · HTTP) pinpointing failure layer
- All display-side only — no database or model changes
This commit is contained in:
2026-06-03 16:33:12 -04:00
parent 5d362fdbe6
commit 3d7ab5a49e
6 changed files with 464 additions and 8 deletions
+30
View File
@@ -55,6 +55,36 @@ func TestSiteOrder(t *testing.T) {
}
}
func TestFmtStatus_ErrorCategory(t *testing.T) {
tests := []struct {
status string
paused bool
inMaint bool
cat ErrorCategory
wantSub string
}{
{"DOWN", false, false, ErrCatDNS, "DOWN:DNS"},
{"DOWN", false, false, ErrCatTLS, "DOWN:TLS"},
{"DOWN", false, false, ErrCatHTTP, "DOWN:HTTP"},
{"DOWN", false, false, ErrCatTCP, "DOWN:TCP"},
{"DOWN", false, false, ErrCatTimeout, "DOWN:TMO"},
{"DOWN", false, false, ErrCatICMP, "DOWN:ICMP"},
{"DOWN", false, false, ErrCatPrivate, "DOWN:PRIV"},
{"DOWN", false, false, ErrCatUnknown, "DOWN"},
{"UP", false, false, ErrCatUnknown, "UP"},
{"SSL EXP", false, false, ErrCatUnknown, "SSL EXP"},
{"DOWN", true, false, ErrCatDNS, "PAUSED"},
{"DOWN", false, true, ErrCatDNS, "MAINT"},
}
for _, tt := range tests {
got := fmtStatus(tt.status, tt.paused, tt.inMaint, tt.cat)
if !containsPlain(got, tt.wantSub) {
t.Errorf("fmtStatus(%q, paused=%v, maint=%v, %q): %q missing %q",
tt.status, tt.paused, tt.inMaint, tt.cat, got, tt.wantSub)
}
}
}
func TestFmtDuration(t *testing.T) {
tests := []struct {
d time.Duration