refactor(health): probe /api/setup/version in the server-URL reachability check (refs #451)

Move the internal self-reachability probe onto the new /api/setup/version path
(updating the doc comment and the unit test accordingly). No behavior change
(the legacy path still works); keeps our own code off the soon-to-be-legacy
/setup/* surface.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tobias Gesellchen
2026-06-06 20:57:54 +02:00
co-authored by Claude Opus 4.8
parent a5bdd58cb6
commit 21742cfbf6
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ import (
const CheckIDServerURLReachable = "server_url_reachable"
// RegisterServerURLReachableCheck registers the server_url_reachable
// check. It probes GET {serverURL}/setup/version from inside the
// check. It probes GET {serverURL}/api/setup/version from inside the
// service. If the request fails or returns a non-200 status, the
// configured server URL doesn't route back to AfterTouch — speakers
// pointing their margeURL at that address will receive errors instead
@@ -41,7 +41,7 @@ func runServerURLReachableCheck(serverURL string) []Finding {
return nil
}
probeURL := strings.TrimRight(serverURL, "/") + "/setup/version"
probeURL := strings.TrimRight(serverURL, "/") + "/api/setup/version"
res := ProbeGet(context.Background(), probeURL, 2*time.Second)
if res.Reachable && res.Status == 200 {
+3 -3
View File
@@ -9,7 +9,7 @@ import (
func TestServerURLReachableCheck_PassesWhenVersionEndpointReturns200(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/setup/version" {
if r.URL.Path == "/api/setup/version" {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte(`{"version":"test"}`))
return
@@ -20,7 +20,7 @@ func TestServerURLReachableCheck_PassesWhenVersionEndpointReturns200(t *testing.
got := runServerURLReachableCheck(srv.URL)
if len(got) != 0 {
t.Errorf("expected no findings when /setup/version returns 200, got %+v", got)
t.Errorf("expected no findings when /api/setup/version returns 200, got %+v", got)
}
}
@@ -32,7 +32,7 @@ func TestServerURLReachableCheck_WarnsWhenVersionEndpointReturns404(t *testing.T
got := runServerURLReachableCheck(srv.URL)
if len(got) != 1 {
t.Fatalf("expected one finding when /setup/version returns 404, got %+v", got)
t.Fatalf("expected one finding when /api/setup/version returns 404, got %+v", got)
}
if got[0].Severity != SeverityWarning {