feat(landing): capability-driven default landing route per active box - #133
Merged
sarg3nt merged 1 commit intoMay 17, 2026
Merged
Conversation
…#112) RootRedirect's fallback chain hard-coded /haproxy as the dashboard default for any installation with at least one enabled box. On a TrueNAS-style deployment whose agent runs in a distroless container without HAProxy (Mjolnir), users would log in and be dropped on an empty /haproxy page that 503-storms on the per-box stat tiles. Make the landing route per-box and capability-aware: - /haproxy when the active box's agent reports haproxy available (preserves the historical landing for HAProxy-fronted deployments) - /metrics when haproxy isn't available but metrics is — the next-most-useful single-pane-of-glass for a host-only agent - /bx as the universal fallback so an active box with no advertised gears still has a place to land Fail-open to /haproxy when capabilities can't be fetched (agent down, no API key, older agent that pre-dates probing) so a transient outage doesn't change the dashboard's behavior. Per-user / system landing-path overrides (login.go::resolvePostLoginPath) keep priority over this — a user who has explicitly set their landing URL still gets it. Four tests exercise the new helper against a real httptest.Server returning capability responses: haproxy-prefers-haproxy, no-haproxy-falls-to-metrics, host-only-falls-to-bx, and agent-down-fails-open-to-haproxy. Phase 2 slice of #112. Stacked on fix/issue-112-haproxy-empty-state (#118). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
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
RootRedirect's fallback chain hard-coded/haproxyfor any install with ≥1 enabled box. On a TrueNAS-style deployment whose agent runs in a distroless container without HAProxy (Mjolnir), this dropped users on an empty/haproxypage that 503-storms on the per-box stat tiles.Handler.defaultLandingForActiveBox(r)helper picks the landing path from the active box's probe table: haproxy → metrics → bx, with/haproxyas the fail-open default when capabilities are unreachable.resolvePostLoginPath) still win — a user who has explicitly set their landing URL keeps it.Phase 2 slice of #112. Stacked on #118 (which is stacked on #115); merge those first, then this.
Test plan
go build ./...,go vet ./...cleango test -count=1 -run TestDefaultLandingForActiveBox ./internal/framework/handler/...— 4 tests, all green (haproxy-capable, metrics-only, bx-fallback, agent-down fail-open)/metricsrather than/haproxy./haproxy(no regression)./haproxy(fail-open).🤖 Generated with Claude Code