Skip to content

πŸ› Keep exactly one advisory report per hive, in the primary repo - #18570

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
fix/18568-advisory-primary-only
Nov 17, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
fix/18568-advisory-primary-only

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Summary

A hive keeps exactly one 🐝 Hive Advisory Report, in project.primary_repo. It never opens one in a non-primary repo.

Root cause

Commit 8f0a2f6 (#18534, for #18448) added ensureSecondaryAdvisoryIssues and postAdvisoryDigestToSecondaryRepos (src/cmd/hive/advisory_repo_issues.go) and wired both into runEvalCycle. Every eval cycle, they ensured, and so created, an advisory issue in every repo in project.repos other than the primary, and posted the digest to each. Two hives on the new candidate builds opened one in every monitored repo within minutes of rolling: the hivecommons hive opened 10, and a standalone multi-repo hive opened 1.

The effective config is not the cause: project.primary_repo was correctly hive. advisory.PrimaryRepo falls back to repos[0] only when no primary is set, and never to all repos.

Change

  • Delete the per-repo ensure and digest post (advisory_repo_issues.go and its test), their two call sites in main_eval_cycle.go, and advisory.ManagedRepos. main_eval_cycle.go and pkg/advisory/policy.go are now byte-identical to their pre-πŸ› Create a governor issue in every repo of a multi-repo hiveΒ #18534 versions, apart from one comment.
  • Dedupe is unchanged and stays primary-only: EnsureAdvisoryIssue finds the open report by title (either spelling) and the hive/advisory label before it creates anything, so a restart reuses it.
  • Docs (src/docs/advisory.md) and a changelog.d fragment.

This reverses the per-repo behavior #18448 asked for, at the operator's direction: a hive has a single advisory report in its primary repo.

Not included: self-cleanup of stray reports

This PR does not auto-close reports a hive already opened in non-primary repos. The App identity can be shared by several hives, so one hive's non-primary repo can be another hive's primary, and an automatic close could hit a legitimate report. The strays were closed by hand. This build never ensures a non-primary repo again, so it never reopens them.

Tests

  • pkg/advisory/policy_primary_only_test.go: multi-repo and standalone configs resolve to exactly one report repo.
  • cmd/hive/advisory_primary_only_test.go: across several eval cycles only the primary is ensured, and each restart re-ensures only the primary and adopts the existing number. An AST guard fails if EnsureAdvisoryIssue, PostAdvisoryDigest or the cycle's ensure dep is wired more than once, or if an advisory write is called inside a loop. As a positive control, the guard flags the πŸ› Create a governor issue in every repo of a multi-repo hiveΒ #18534 tree: wiring counts 2/2 instead of 1/1.
  • pkg/github/advisory_restart_idempotent_test.go: three restarts against an existing open report (legacy and [governor] titles) give zero creates and zero edits. A cold start creates exactly one report and reuses it after a restart.

Fixes #18568

πŸ€– Generated with Claude Code

A candidate build opened a "[governor] 🐝 Hive Advisory Report" in every
repo of project.repos. Commit 8f0a2f6 (#18534) added
ensureSecondaryAdvisoryIssues and postAdvisoryDigestToSecondaryRepos,
wired into runEvalCycle, which ensured (and so created) an advisory
issue in every non-primary managed repo each eval cycle and posted the
digest to each.

Remove the per-repo ensure and digest post and ManagedRepos, so only
project.primary_repo is ever ensured or posted to. The single report is
still resolved by title and the hive/advisory label before any create,
so a restart reuses the open report.

Tests pin the primary-only rule for multi-repo and standalone configs,
restart idempotency at the cycle seam and at the client (both title
spellings, zero creates, zero edits), and an AST guard that fails if an
advisory writer is wired a second time or called inside a loop.

Fixes #18568

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@hivecommons-hive

hivecommons-hive Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

ℹ️ Sentinel: informational, author is trusted (owner), merge is not blocked. Head d0d9f8d48b84 matched:

  • test_removal: deletes 3 test file(s) (src/cmd/hive/advisory_repo_issues_test.go, src/pkg/advisory/policy_managed_repos_test.go, src/pkg/github/advisory_multi_repo_test.go)

No sentinel-alert label was added. The finding is recorded in the dashboard Security tab and /api/sentinel; set sentinel.trusted_authors_block: true to block trusted authors too.

Evidence bundle `#18570d0d9f8d` sha256:ec89899145d450e66ff38138d3b8a2b32e484f7f8d3f5dcd17fedc892aa251b6 β€” download from the dashboard or `hivectl review evidence #18570`.

@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 17, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hivecommons-hive
hivecommons-hive Bot merged commit 923b95a into v5 Nov 17, 2026
97 of 103 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/18568-advisory-primary-only branch November 17, 2026 01:18
@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at d0d9f8d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐝 Governor opens a Hive Advisory Report in every monitored repo instead of only the primary

1 participant