Repository navigation
✨ feature(hub): add the public-safe Fleet activity view for the hivecommonsfleet broadcast - #16110
Conversation
…ommonsfleet broadcast Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Review findings from Read the new handler against the tree at What I verified:
Body and diff agree. Remaining owner steps (private-window check, stream key, enable + ack) are correctly listed as out of this PR's scope. Evidence bundle `#16110674a580` sha256:7e4baca772c0fb9263b0ccdb9c527b9bdcb412f7e56d061479020242f5843c9a — download from the dashboard or `hivectl review evidence #16110`. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
674a580
ℹ️ Sentinel notice — informational; author is trusted (hive agent), merge is not blockedHive flagged this PR (author @hivecommons-hive[bot], head
Hive did not add the |
There was a problem hiding this comment.
Decision needed: @hanthor should confirm that a public Twitch broadcast may show every hive whose owner never set is_public (the registry defaults it to true at provisioning, src/pkg/hub/saas_hives_api.go:1544), or whether the public-safe view should require an explicit opt-in before DASHBOARD_PATH points at it.
Read the diff against the v5 tree, then the callers. The code does what it says; the one open question is a policy choice, not a defect.
Verified correct
publicSafeActivityBlocks/publicSafeActivityEvents(src/pkg/hub/activity_public.go:48-77) rebuild the digest with only!Privateitems and an emptydroppedmap beforebuildActivityViewruns, soTotals/Truncated(activity.go:325-326) andEventsDropped(activity_events.go:273) can never carry a private count into the body or the ETag.- Repo visibility fails closed on the spoke:
publicRepoSet.allowsreturns false for any repo not in the set (src/pkg/dashboard/battle_log.go:491-494), andhubActivityItems/hubActivityMergesmarkPrivate: !public.allows(repo)(hub_activity.go:88). sameGitHubHost("", "github.com")is true (server.go:893-901), so hives with noGitHubHostare not accidentally excluded; GHE hosts are.- Routes:
/activitystays behindrequireAuth(activity_page.go:48),/api/hub/activitystays behind it (server.go:1728); the two new routes bypass it by registration, and the test exercisessrv.muxdirectly, not the handler in isolation. activity.js:credentials: 'omit'on the public page and the 401→/loginredirect is suppressed there, so an anonymous kiosk never bounces.
Open question for the owner (why this is routed, not approved)
The hive-level filter is h.IsPublic && sameGitHubHost(...) (activity.go:407). IsPublic is true when the provisioning request omits it (saas_hives_api.go:1544, "Default to public when the request omits is_public"). The PR body says a hive "with no public flag" is excluded; the test models that as IsPublic=false, which is not what an omitted flag produces. Item-level visibility does fail closed, so no private repo leaks — but every default-public hive's name and public rows will appear on a broadcast its owner never opted into. That is consistent with the public registry and leaderboard today, and may be exactly the intent; it just should be a human's call before DASHBOARD_PATH (src/deploy/stream/fleet/configmap.yaml:20) points the stream at it. Nothing is activated by this PR (STREAM_ENABLED=false, replicas: 0).
Minor, no action needed: !h.Missing in publicActivityHives (activity_public.go:40) is always true because activityRegistry never sets Missing; harmless.
I have not approved or changed anything.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #15966. Part of RFC #15861 by @hanthor (cc @hanthor).
Why
The
twitch.tv/hivecommonsfleetdeployment from #15998 renders the hub anonymously, but it had nothing safe to point at. ItsDASHBOARD_PATHwas aCHANGE-MEplaceholder. The signed-in/activitypage is scoped per viewer, and a Twitch stream is public. A viewer's own Fleet access must therefore never decide what a broadcast shows. The issue asks for a separately authorized view that shows public-safe content only, plus a hub-side test that private rows are omitted. That route and test were the only acceptance left after #15998.What changes
GET /activity/public+GET /api/hub/activity/public(src/pkg/hub/activity_public.go). These are distinct routes, not a flag on the signed-in ones. The endpoint never reads a cookie, token orAuthorizationheader, so a signed-in admin gets the same bytes as an anonymous visitor. It filters the copied store data before building the view:private. The spoke marks a repo private unless it knows it is public, so unknown visibility fails closed;totals, digesttruncatedorevents_dropped, because those can count private items; no owner; no per-user grants.activity.js: on/activity/publicthe page polls only the public endpoint, withcredentials: 'omit'./activitybehaves exactly as before.fleet/configmap.yaml:DASHBOARD_PATHnow points at/activity/public?kiosk=1. The gate still refuses to start, becauseSTREAM_ENABLED=false, there is no policy ack and no key, andreplicas: 0.hub-fleet-activity.md#public-safe-viewand the API reference rows.changelog.d/added-15966-public-safe-activity-view.md.Tests (
activity_public_test.go)TestActivityPublic_OmitsPrivateRowsByConstruction: one spoke shares a private item and a private event; the other hives are a non-public hive, a hive with no public flag and a GHE hive. Only the public row and the public event appear, and no totals, truncation or drop counts. The response is byte-identical whether the request is anonymous or carries an admin session and bearer. The admin's/api/hub/activitystill sees all four hives.TestActivityPublic_PublicRowsRender: public rows render, and an invalid filter returns400.TestActivityPublic_RoutesAnonymouslyThroughTheHubMux: both public routes return200anonymously;/activitystill redirects to login and/api/hub/activitystill returns401; both public routes are noindex.TestActivityPublic_PagePollsThePublicEndpointWithoutCredentials: run under node.Existing
/activitytests are unmodified.TestHivecommonsStreamConfigUnchangedis untouched (no change underk8s/,overlays/ordocker-compose.yaml). FollowingAGENTS.md, I did not run anything locally exceptgofmt -l; CI gives the verdict.Deployment / activation status
Nothing is activated. This PR installs no credential and enables no broadcast; the
hivecommonsstream is unchanged. What remains are owner actions outside this issue's code scope (#15861):https://hive.hivecommons.dev/activity/publicin a private window;hivecommonsfleetstream key;STREAM_ENABLEDandPUBLIC_SAFE_POLICY_ACK, then scale to 1.— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@hanthor