Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- **An owner's approval of a workflow-file change no longer merges a head that also deletes tests.** The contributor lane's diff check names only its first fence, and the owner-approval release ([#14664](https://github.com/hivecommons/hive/issues/14664)) lifts the workflow-path fence alone, so a PR that edited `.github/workflows/**` and removed tests merged on that approval with the test removal never checked. Such a head now stops at `contributor-lane:tests-removed`, which no approval overrides, before any release is read.
4 changes: 3 additions & 1 deletion src/docs/hive-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,9 @@ A PR merges through this tier only when all of the following hold:
the lane logs `workflow-path fence released by owner approval login=…
head=…`, leaves one `<!-- hive:workflow-approval head=… by=… -->` audit
comment per head, and the PR goes through every other gate below like any
other. Merging such a PR needs the App's **Workflows: Read and write**;
other. The release covers the workflow fence only: a head that also deletes
tests stops at `contributor-lane:tests-removed` (the next bullet) before any
approval is read. Merging such a PR needs the App's **Workflows: Read and write**;
when GitHub refuses the merge for want of it the lane marks the PR
`hive:unauthorized` (step `merge-workflow-path`), stops retrying that
head, and the approved head parks at `090-ready-for-human-merge` for a
Expand Down
2 changes: 1 addition & 1 deletion src/docs/operator-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ advanced into the merge path.
| `auto_merge.contributor_lane.auto_promotion_scope` | `hive` | Where the clean-merged-PR ratchet (`auto_merge.contributor_tier.auto_promote_after_merged`) counts an author's merges: `hive` counts across every repository the hive manages (one `search/issues` query finds the repos holding the author's merges; the PR's own repo is always walked first), `repo` counts only the PR's repository. Revert and sentinel-alert evidence blocks promotion in either scope. |
| `auto_merge.contributor_tier.auto_promote_after_merged` | `5` | Clean merged PRs (no revert, no sentinel label, not undone by a later merged revert) after which the contributor lane treats an author as `trusted` without an operator grant, unless the registry marks them `revoked`. Negative disables the ratchet. |
| `auto_merge.contributor_lane.approve_held_runs_for_registry_trusted` | `true` | When the registry path admitted the PR author and the lane stops at `required-check-missing:<ctx>`, approve the head's `action_required` workflow runs once (`POST /repos/{owner}/{repo}/actions/runs/{id}/approve`, fork heads included), post one `hive:contributor-held-runs-approved` audit comment and log `contributor-lane approved held runs`. Never acts for claim-marker, auto-promoted or association admissions, sentinel/exclude-labelled PRs, or diffs touching `.github/workflows/**`. Needs the App's **Actions: Read and write** permission. See [hive-merge.md](hive-merge.md#contributor-lane-auto-merge). |
| `auto_merge.contributor_lane.owner_approval_releases_workflow_fence` | `true` | A hive owner / trusted merger's explicit approval on the **current** head — a GitHub `APPROVED` review on that commit, or a dashboard `/hive decision approve` bound to it — releases the contributor lane's `contributor-lane:workflow-path` fence, so the lane merges a PR editing `.github/workflows/**` / `.github/actions/**` itself once CI, soak and the other gates are clear. Logs `workflow-path fence released by owner approval`, leaves one `hive:workflow-approval` audit comment per head; approval on an older head does not count. Needs the App's **Workflows: Read and write**; without it the merge is refused, the PR is marked `hive:unauthorized` (`merge-workflow-path`) and parks at 090 for a person's click. `false` keeps every workflow-path PR a person's merge ([#14664](https://github.com/hivecommons/hive/issues/14664)). See [hive-merge.md](hive-merge.md#contributor-lane-auto-merge). |
| `auto_merge.contributor_lane.owner_approval_releases_workflow_fence` | `true` | A hive owner / trusted merger's explicit approval on the **current** head — a GitHub `APPROVED` review on that commit, or a dashboard `/hive decision approve` bound to it — releases the contributor lane's `contributor-lane:workflow-path` fence (never for a head that also removes tests, which stays `contributor-lane:tests-removed`), so the lane merges a PR editing `.github/workflows/**` / `.github/actions/**` itself once CI, soak and the other gates are clear. Logs `workflow-path fence released by owner approval`, leaves one `hive:workflow-approval` audit comment per head; approval on an older head does not count. Needs the App's **Workflows: Read and write**; without it the merge is refused, the PR is marked `hive:unauthorized` (`merge-workflow-path`) and parks at 090 for a person's click. `false` keeps every workflow-path PR a person's merge ([#14664](https://github.com/hivecommons/hive/issues/14664)). See [hive-merge.md](hive-merge.md#contributor-lane-auto-merge). |
| `auto_merge.contributor_lane.repos` | empty = all watched repos | Optional repo allow-list for the contributor-lane tier (bare name or `owner/repo`). |
| `auto_merge.contributor_lane.exclude_labels` | `hold`, `do-not-merge`, `needs-human`, `blocked`, `needs-rebase` | Labels that keep a PR out of contributor-lane auto-merge (`do-not-merge/*` always excluded). |

Expand Down
19 changes: 18 additions & 1 deletion src/pkg/github/automerge/automerge_contributor_lane.go
Original file line number Diff line number Diff line change
Expand Up @@ -1075,12 +1075,19 @@ func contributorLaneLinkedIssues(body, fullRepo string) []int {
// CI workflow/action definitions and test deletion. It returns "" when the
// diff may be merged unattended.
func contributorLaneDiffReason(files []intent.ChangedFile) string {
adds, dels := 0, 0
for _, f := range files {
if intent.PathMatchesAny(f.Filename, contributorLaneWorkflowPaths) {
return contributorLaneReasonWorkflowPath
}
}
return contributorLaneTestsRemovedReason(files)
}

// contributorLaneTestsRemovedReason is contributorLaneDiffReason's test
// deletion fence on its own: contributorLaneReasonTestsRemoved when the diff
// deletes a test file or removes test lines past the floor and ratio, else "".
func contributorLaneTestsRemovedReason(files []intent.ChangedFile) string {
adds, dels := 0, 0
for _, f := range files {
if !contributorLaneIsTestPath(f.Filename) {
continue
Expand Down Expand Up @@ -1247,6 +1254,16 @@ func (c *Engine) evaluateContributorLanePR(ctx context.Context, displayRepo, own
return eval, contributorLaneReasonFilesEvidence, err
}
if reason := contributorLaneDiffReason(files); reason != "" {
// contributorLaneDiffReason names only the first fence, and the
// owner-approval release lifts the workflow fence alone: a head that
// also removes tests merged on that approval with its test removal
// never checked. Name the rule no approval overrides, before any
// release is read or its audit comment posted.
if reason == contributorLaneReasonWorkflowPath {
if tests := contributorLaneTestsRemovedReason(files); tests != "" {
return eval, tests, nil
}
}
approver, released := c.workflowFenceReleased(ctx, displayRepo, owner, repo, pr, number, headSHA, reason, policy)
if !released {
return eval, reason, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ func TestContributorLaneWorkflowFenceOwnerApproval(t *testing.T) {
trusted: []string{"clubanderson"},
wantReason: contributorLaneReasonWorkflowPath,
},
{
// The release covers the workflow fence only: a head that also
// deletes a test stops at the tests-removed rule, with no
// release read and no audit marker.
name: "approval does not release a head that also removes a test",
mutate: func(fx *contributorLaneFixture) {
fx.files = append(workflowPathFiles(), map[string]any{"filename": "pkg/widget/widget_test.go", "status": "removed", "additions": 0, "deletions": 40})
fx.reviews = []map[string]any{ownerApprovedReview("clubanderson", "sha7")}
},
trusted: []string{"clubanderson"},
wantReason: contributorLaneReasonTestsRemoved,
},
{
name: "no approval behaves as before",
trusted: []string{"clubanderson"},
Expand Down
Loading