Repository navigation
✨ feature(hub): bounded activity digest contract and per-user /api/hub/activity - #16005
Conversation
…b/activity First implementation slice of the hub-wide Activity Monitor (RFC #15861 by @hanthor, child #15951): - pkg/hubactivity: shared wire contract for the heartbeat `activity` block. Build caps items at 100 by default under a hard 250-item ceiling, orders by urgency (needs-human/needs-decision, stalled, furthest stage, oldest), drops private-repo items unless the spoke opts in while still counting them in totals, and stamps a content etag independent of generated_at. Sanitize re-applies every bound on the hub: owner/name repos only, closed kind/author_kind sets, slug-only stage/mods, deduped repo#n rows, clamped integers, control/format/separator characters stripped from titles. - Hub: the digest rides the existing per-hive heartbeat bearer, is sanitized and kept in memory only (leaf-locked activityStore, never in the persisted registry, forgotten after 24h of silence), and the beat response acknowledges the held etag (activity_etag) so a spoke can send an unchanged marker. - GET /api/hub/activity (signed-in users): per-user/per-hive authorization before any block is read (admins all hives; others owned or unexpired granted hives), merged items tagged with hive_id, per-hive ok / stale / not_reporting / missing disclosure, digest and response truncation counts, bounded filters, ETag + If-None-Match polling, private no-cache. - Spoke payload/response carry the optional fields; nothing populates the digest yet (#15963). No rollout, participation or broadcast setting changes. Hive-Run: #15861 Hive-Plan: rfc-15861 decomposition, child 1 (#15951) Hive-Spec: rfc-15861#A-B-C Signed-off-by: Karibhou <157208370+Karibhou@users.noreply.github.com>
…i/hub/activity The new activityStore field and /api/hub/activity registration in pkg/hub/server.go shifted every cited line in the hub-server API reference, so the changelog-fragment-guard citation check failed. Re-run the citation fixer and align the documented Vary header with what the handler sets. 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 |
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. |
There was a problem hiding this comment.
Conclusion: the Go change reads correct to me against v5 and does what #15951 scopes; CI is green at 51bd49a. One housekeeping gap in the PR body, no code findings.
What I verified (read src/pkg/hub/activity.go, src/pkg/hubactivity/hubactivity.go, the heartbeat/server wiring, and saas_hives_api.go at head)
- Authorization before data.
handleHubActivityis mounted behindrequireAuth(src/pkg/hub/server.go:1728), resolves the visible hive set first (activity.go:346), and only then copies those hives' blocks out of the store (activityStore.snapshot,activity.go:128-138). The rule invisibleActivityHives(activity.go:154-183: hub admin → all; else owner or unexpired grant) matchesbuildMyHivesResponse(saas_hives_api.go:1332-1348) and is slightly stricter, since it also drops expired grants viaaccessGrantExpired. - Bounded.
Sanitize(hubactivity.go:158-182) dedups byrepo#n, truncates atMaxItemsCeiling(250) with overflow counted intoTruncated, and clamps every integer and map; the merged response is further capped at8 × 250(activity.go:42,313-316). Filter values are bounded to 200 valid-UTF-8 runes (activity.go:205). - Memory only.
HubServer.activityis a struct field never written to the registry (server.go:1002);recordis called afters.muis released (server.go:2737), consistent with the "leaf lock" comment atactivity.go:62-63. Hives not refreshed for 24h are forgotten (activity.go:118-124). - Handshake. Unchanged marker compares against
CleanETagof the stored form (activity.go:91) so an etag altered by sanitizing cannot wedge the spoke into re-sending forever;ActivityETagis returned on every beat (server.go:2826). - Private items. The hub-side
SanitizekeepsPrivateitems; exclusion happens in the spoke-sideBuildunlessSharePrivate(hubactivity.go:133). That is what #15951 asks for ("private-item exclusion in the digest builder") — noting it so nobody expects the hub to re-filter. - ETag/caching.
Cache-Control: private, no-cache+Vary: Cookie, Authorization(activity.go:362-363) — appropriate for per-user bodies.
Gap in the body (not code): #15951 inherits from RFC #15861 the requirement to "mention @hanthor in every implementation child and PR" and link the RFC. #16001's body did; this superseder's body links neither @hanthor nor #15861. Worth adding before merge so the attribution trail survives the squash.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read against v5 at What I verified in the tree (not from the body):
Low — a full digest with zero items is indistinguishable from an "unchanged" marker unless Not approving (that is a human's signature); recording the verdict with the hive. Review findings from Read the new packages against the tree at What I verified, not inferred:
Body claims ("nothing populates the digest yet", memory-only, no participation change) match the diff: One non-blocking observation: |
There was a problem hiding this comment.
docs-currency review (head 97270f4)
Docs check out: src/docs/api-reference/hub-server.md:49 matches the handler in src/pkg/hub/activity.go (status values :49-54, 2000-item response cap :42 = 8×MaxItemsCeiling 250, ≤200-rune filters :45/:194, private, no-cache + Vary :340-341, 401 via requireAuth in saas_auth.go:29-35), item field names match src/pkg/hubactivity/hubactivity.go:67-79, and the re-numbered pkg/hub/server.go citations (:1711, :1720, :1731 …) are correct at head.
One advisory, per #15951's attribution requirement ("mention @hanthor in every implementation child and PR"): the superseded #16001 body carried the mention, but this PR's body does not. Add the RFC #15861 / #15951 attribution line (with the proposer's handle) to the PR body before merge so the squash commit carries it.
— hive: agent=adjudicator-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 |
Supersedes #16001 (adopted in place, re-homed because a hive commit on the contributor branch cannot carry a squash-safe sign-off; original commits by @Karibhou preserved).
Closes #15951
This branch is #16001's head
51bd49a88b1bas pushed by @Karibhou (forkKaribhou/hive), unchanged. Last lane reason on the original:reviewer-verdict:changes_requested.Hive fix agent: rebase this branch on
v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and theirSigned-off-by; add your own sign-off on your commits. Do not open another PR.Sign-off attribution: the original PR would squash the App's signed fixes as the contributor. This App-authored superseder keeps every original commit and sign-off unchanged and attributes the squash to the App instead. DCO and all merge gates still apply here.