Skip to content
Closed
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
1 change: 1 addition & 0 deletions changelog.d/fixed-withheld-fix-exclusion-once.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- review: a not-hive-authored head whose fix is withheld is now reported in `FixExclusions` only on the cycle that first withholds it, matching `auditWithheldReviewFixes`' doc instead of repeating every eval cycle (#14882, #14883).
6 changes: 4 additions & 2 deletions src/cmd/hive/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11647,8 +11647,10 @@ type reviewFixAuditor interface {
// not get a bot commit — and silence is the one thing an operator cannot
// investigate, so each one names the PR, who opened it, and the
// review.fix_human_prs value at the time (on no longer permits the push:
// hivecommons/hive#12897). The planner reports each head once, so
// this does not repeat on every eval cycle.
// hivecommons/hive#12897). The planner records the exclusion and
// the withheld fix only on the cycle that first withholds a head (a persisted
// State.Withheld entry suppresses later cycles), so this does not repeat on
// every eval cycle.
func auditWithheldReviewFixes(plan review.DispatchPlan, auditor reviewFixAuditor, logger *slog.Logger) {
// One WARN per changes_requested head that ends the cycle without a fix
// kick: a PR shown as "Fixing" that nobody is fixing must be loud
Expand Down
5 changes: 0 additions & 5 deletions src/pkg/review/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -1417,11 +1417,6 @@ func fixPushAuthorOK(author string) bool {
func (p *DispatchPlan) withholdFix(pr PullRequest, opts DispatchOptions, now time.Time) {
for _, w := range p.State.Withheld {
if samePRHead(w.Repo, w.Number, w.HeadSHA, pr.Repo, pr.Number, pr.HeadSHA) {
reason := FixDispatchExcludedNotHiveAuthored
if opts.FixHumanPRs {
reason = FixDispatchExcludedNotHiveAuthoredDCO
}
p.recordFixExclusion(pr, reason, 0)
return
}
}
Expand Down
19 changes: 19 additions & 0 deletions src/pkg/review/fix_push_gate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,22 @@ func TestFixPushAuthorOK(t *testing.T) {
})
}
}

func TestWithheldFixExclusionReportedOncePerHead(t *testing.T) {
pr := humanPR("sha1")
pr.HiveAttributed = true
arts := Artifact{Items: []Aggregate{changesRequestedFor(pr)}}

first := PlanDispatch([]PullRequest{pr}, arts, DispatchState{}, fixGateOpts(false))
if len(first.FixExclusions) != 1 || len(first.WithheldFixes) != 1 {
t.Fatalf("first cycle: exclusions=%+v withheld=%+v, want one of each", first.FixExclusions, first.WithheldFixes)
}

second := PlanDispatch([]PullRequest{pr}, arts, first.State, fixGateOpts(false))
if len(second.FixExclusions) != 0 || len(second.WithheldFixes) != 0 {
t.Fatalf("second cycle re-reported the same head: exclusions=%+v withheld=%+v", second.FixExclusions, second.WithheldFixes)
}
if len(second.State.Withheld) != 1 {
t.Fatalf("withheld state = %+v, want the single entry kept", second.State.Withheld)
}
}
Loading