feat(p1.7): relay health check page#87
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements P1.7 from the roadmap: relay-side diagnostics so operators can verify version, HTTPS, origins, bootstrap-admin status, rate limits, and active uplink count at a glance — plus a copyable plaintext blob.
GET /healthz— public, no auth, returns{ok:true, version}withCache-Control: no-store. Suitable for K8s liveness probes and load balancer health checks.GET /admin/api/health— admin Bearer-gated, returns fullHealthPayloadJSON (the same shape consumers see from the copy button).GET /admin/health— admin Bearer-gated, server-rendered HTML page (Gohtml/template, no Vue dep, no build step) with a "Copy diagnostics" button.int64onServer, incremented inhandleUplinkHTTPright afterwebsocket.Acceptsucceeds, decremented on connection close.isMobileOriginCompatiblethat detects whetherAllowedOriginsadmitscapacitor://*,ionic://*,https://localhost*, ornull. Surfaced as a one-glance flag on the page.Every field in
HealthPayloadis either a configured value or an aggregate count — no PII, no token prefixes, no IP addresses, no file paths. The page and the copy-diagnostics text share the same data; no separate redaction layer needed.Spec:
docs/superpowers/specs/2026-05-31-relay-health-page-design.mdPlan:
docs/superpowers/plans/2026-05-31-relay-health-page.mdTest Plan
go test ./...— greengo vet ./...— cleango build ./cmd/atterm-relay— cleanTestIsMobileOriginCompatible(Capacitor / Ionic / localhost / null / wails-only / mixed)collectHealthpopulates every documented field on a real Server + in-memory store/healthzreturns 200 +ok+version, no auth required,Cache-Control: no-store/admin/api/healthreturns 401 unauthed, 401 for regular user, 200 + full payload for admin Bearer/admin/healthreturns 401 unauthed, 200 + every label +window.__HEALTH__injection for adminTestHealthPayload_JSONFieldsStablecontract test pins the 11 JSON field namesTestUplinkCount_IncrementsOnConnectDecrementsOnClosedrives a real WebSocket through/uplink, asserts counter moves 0 → 1 → 0go run ./cmd/atterm-relay --dev-insecure --addr :8080, thencurl /healthzand visit/admin/healthafter admin login — confirm UI matches spec §7