From cb3468debdc3327d183cc91d61e505d5774386fa Mon Sep 17 00:00:00 2001 From: Fredrik Ahlgren Date: Fri, 23 Oct 2026 15:58:00 +0200 Subject: [PATCH] fix(fleet): publish a day once five boxes report it The public daily-report feed hid every day below 10 reports. The fleet is still small, so stats.ftw.energy showed nothing. Five is enough for anonymous reports that carry no home id (Fredrik, 23 October 2026). Each label is still held to the same size. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- internal/fleet/public.go | 4 +++- internal/fleet/public_test.go | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 102eea0..ac6118e 100644 --- a/README.md +++ b/README.md @@ -472,7 +472,7 @@ partial; missing data is unknown. One instance supplies its local shard only; public multi-shard totals need an explicit safe collector. The separate anonymous daily-report feed is `GET /v1/fleet/public`. It exposes -only daily counts and dimension labels with at least 10 reports, for at most +only daily counts and dimension labels with at least 5 reports, for at most 90 days. It contains imported relay history and new reports received by Cloud; consumers replace the old archive rather than adding both. It needs no hourly energy activation. Updated Core sends it only after the current project diff --git a/internal/fleet/public.go b/internal/fleet/public.go index 650b4c8..e12ea63 100644 --- a/internal/fleet/public.go +++ b/internal/fleet/public.go @@ -21,7 +21,9 @@ func (s *Service) Public(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusServiceUnavailable) return } - const minimum = 10 + // Five since 23 October 2026 (Fredrik): the fleet is small and the + // reports carry no home id. A day and each label below it stay hidden. + const minimum = 5 days := make([]map[string]any, 0, len(view.Days)) for _, d := range view.Days { row := map[string]any{"date": d.Date, "reports": nil} diff --git a/internal/fleet/public_test.go b/internal/fleet/public_test.go index 03a76bf..ec90ea4 100644 --- a/internal/fleet/public_test.go +++ b/internal/fleet/public_test.go @@ -24,7 +24,7 @@ func TestPublicFleetHidesSmallDaysAndEachSmallLabel(t *testing.T) { now := time.Now() svc.now = func() time.Time { return now } report := fleetwire.Report{Schema: fleetwire.Schema, Version: "v0.147.0", Channel: "stable", Drivers: []string{}, Battery: "none", Zone: "SE4", Age: "unknown"} - for range 9 { + for range 4 { _, err = reg.FleetPut(report, now) if err != nil { t.Fatal(err) @@ -48,10 +48,10 @@ func TestPublicFleetHidesSmallDaysAndEachSmallLabel(t *testing.T) { _, _ = reg.FleetPut(report, now) v = get() d = v["days"].([]any)[0].(map[string]any) - if d["reports"] != float64(10) || len(d["ftw_versions"].(map[string]any)) != 0 { + if d["reports"] != float64(5) || len(d["ftw_versions"].(map[string]any)) != 0 { t.Fatal("small version exposed") } - if d["channels"].(map[string]any)["stable"] != float64(10) { + if d["channels"].(map[string]any)["stable"] != float64(5) { t.Fatal("safe cell hidden") } }