From 40b33f9fc7d171124ac5369312fb8b6a956161ca Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 21 May 2026 14:17:30 +0900 Subject: internal/rosa: enforce exclusions This restores unexported artifact behaviour. Signed-off-by: Ophestra --- cmd/mbf/internal/pkgserver/api.go | 2 +- cmd/mbf/internal/pkgserver/api_test.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'cmd/mbf/internal/pkgserver') diff --git a/cmd/mbf/internal/pkgserver/api.go b/cmd/mbf/internal/pkgserver/api.go index e73b8bbe..125be829 100644 --- a/cmd/mbf/internal/pkgserver/api.go +++ b/cmd/mbf/internal/pkgserver/api.go @@ -30,7 +30,7 @@ var ( // handleInfo writes constant system information. func handleInfo(w http.ResponseWriter, _ *http.Request) { infoPayloadOnce.Do(func() { - infoPayload.Count = int(rosa.Native().Count()) + infoPayload.Count = len(rosa.Native().Collect()) infoPayload.HakureiVersion = info.Version() }) // TODO(mae): cache entire response if no additional fields are planned diff --git a/cmd/mbf/internal/pkgserver/api_test.go b/cmd/mbf/internal/pkgserver/api_test.go index 4c178fb9..3a9945da 100644 --- a/cmd/mbf/internal/pkgserver/api_test.go +++ b/cmd/mbf/internal/pkgserver/api_test.go @@ -31,7 +31,7 @@ func TestAPIInfo(t *testing.T) { checkPayload(t, resp, struct { Count int `json:"count"` HakureiVersion string `json:"hakurei_version"` - }{rosa.Native().Count(), info.Version()}) + }{len(rosa.Native().Collect()), info.Version()}) } func TestAPIGet(t *testing.T) { @@ -92,11 +92,12 @@ func TestAPIGet(t *testing.T) { ) }) + count := len(rosa.Native().Collect()) t.Run("index", func(t *testing.T) { t.Parallel() checkValidate( - t, "limit=1&sort=0&index", 0, rosa.Native().Count()-1, - "index must be an integer between 0 and "+strconv.Itoa(rosa.Native().Count()-1), + t, "limit=1&sort=0&index", 0, count-1, + "index must be an integer between 0 and "+strconv.Itoa(count-1), ) }) -- cgit v1.3.1