diff --git a/API Server/internal/plugins/builtin/openweather/openweather.go b/API Server/internal/plugins/builtin/openweather/openweather.go index beaa7d4..5956de3 100644 --- a/API Server/internal/plugins/builtin/openweather/openweather.go +++ b/API Server/internal/plugins/builtin/openweather/openweather.go @@ -259,8 +259,12 @@ func (p *Plugin) HealthCheck(ctx context.Context) plugins.Health { key := p.apiKey p.mu.Unlock() if key == "" { - return plugins.Health{Status: plugins.StatusDown, LatencyMs: time.Since(start).Milliseconds(), - Detail: errNoKey.Error()} + // No key at this (global) layer. This is a valid configuration: the plugin + // acts as a master switch and organizations/users supply their own key in + // the Web App. Report degraded rather than down — nothing is broken, the + // global layer just can't self-probe without a key. + return plugins.Health{Status: plugins.StatusDegraded, LatencyMs: time.Since(start).Milliseconds(), + Detail: "no global API key — master switch only; organizations and users supply their own key"} } target := p.requestURL("/data/2.5/weather", p.pointQuery("", "")) diff --git a/API Server/internal/plugins/builtin/openweather/openweather_test.go b/API Server/internal/plugins/builtin/openweather/openweather_test.go index 6d03ecc..3a02b68 100644 --- a/API Server/internal/plugins/builtin/openweather/openweather_test.go +++ b/API Server/internal/plugins/builtin/openweather/openweather_test.go @@ -101,12 +101,13 @@ func TestRequestURLNoKey(t *testing.T) { } } -// TestHealthCheckNoKey confirms a missing key is reported as down, not a panic. +// TestHealthCheckNoKey confirms a missing key is reported as degraded (a valid +// master-switch config, not a hard failure), not a panic. func TestHealthCheckNoKey(t *testing.T) { p := &Plugin{} _ = p.Init(context.Background(), nil) - if h := p.HealthCheck(context.Background()); h.Status != plugins.StatusDown { - t.Errorf("status = %q, want down (detail=%q)", h.Status, h.Detail) + if h := p.HealthCheck(context.Background()); h.Status != plugins.StatusDegraded { + t.Errorf("status = %q, want degraded (detail=%q)", h.Status, h.Detail) } }