platform: modularize api/gui, add docs-tests-web foundation, and refresh root config

This commit is contained in:
beckline
2026-03-26 22:40:54 +03:00
parent 0e2d7f61ea
commit 6a56d734c2
562 changed files with 70151 additions and 16423 deletions

View File

@@ -0,0 +1,46 @@
package app
import (
"strings"
"time"
)
func transportShouldPersistHealthSnapshot(prev, next TransportClient, now time.Time) bool {
if transportHealthChanged(prev, next) {
return true
}
prevTS, ok := parseTransportHealthLastCheck(prev)
if !ok {
return true
}
return now.Sub(prevTS) >= transportHealthPersistMinAge
}
func transportHealthChanged(prev, next TransportClient) bool {
if normalizeTransportStatus(prev.Status) != normalizeTransportStatus(next.Status) {
return true
}
if strings.TrimSpace(prev.Health.LastError) != strings.TrimSpace(next.Health.LastError) {
return true
}
if transportHealthLatencyBucket(prev.Health.LatencyMS) != transportHealthLatencyBucket(next.Health.LatencyMS) {
return true
}
return false
}
func transportHealthLatencyBucket(ms int) string {
if ms <= 0 {
return "none"
}
switch {
case ms < 100:
return "lt100"
case ms < 300:
return "100-299"
case ms < 800:
return "300-799"
default:
return "ge800"
}
}