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
1 change: 1 addition & 0 deletions changelog.d/fixed-stage-drift-on-park.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- On a PR the hive did not author, the security review's `requires_human` now stays a hold for a person (`stage/085-needs-decision`, with the finding named) when another perspective also asks for changes. Before, the sibling `changes_requested` folded the security hold into the fix cycle and the PR went back to its author at `stage/072-returned-to-contributor`, although a security finding is the contributor rule's one early exit to a person ([#15640](https://github.com/hivecommons/hive/issues/15640)). projectbluefin/utah-packages#890 was sent to its author for a PR-body edit while the security review's question about a new App credential waited on a maintainer.
9 changes: 8 additions & 1 deletion src/docs/review-swarm.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,14 @@ tests-removed lane rule and a reporter-trust hold are the lane-side
equivalents and park the PR the same way. The finding is recorded as
`decision_finding` and the 085 comment and tracker popover print it as
`the review found: …` next to the reviewer's question, so the operator is
told WHAT was found.
told WHAT was found. Another perspective's `changes_requested` on the same
head does not fold that exit into the fix cycle: the aggregate stays
`requires_human` with the finding, and the change requests wait in the
review for the person who decides
([projectbluefin/utah-packages#890](https://github.com/projectbluefin/utah-packages/pull/890)
went to its author at `stage/072-returned-to-contributor` for a PR-body
edit while the security review's App-credential question waited on a
maintainer).

Everything else the review raises — ordinary nits and findings, a duplicate,
naming, scope, sequencing, licensing, a failing optional check, a conflict
Expand Down
15 changes: 15 additions & 0 deletions src/pkg/review/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,21 @@ func aggregateReports(reports []PerspectiveReport, opts AggregateOptions) Aggreg
agg.Reasons = []string{fmt.Sprintf("fix cycle cap reached (%d/%d)", opts.FixAttempts, maxFix)}
return agg
}
if seenVerdicts[VerdictRequiresHuman] && contributorHandsFree(agg, opts) {
// A security finding is the contributor rule's one early exit
// to a person (hivecommons/hive#15640), and a sibling
// perspective's change request does not fold it into the fix
// cycle: the decision-marker path above already keeps it.
// projectbluefin/utah-packages#890 went back to its author at
// 072 for a PR-body edit while the security review's question
// about a new App credential waited on a maintainer.
if finding, backed := securityFindingAcross(reports, sensitivePaths); backed {
agg.DecisionFinding = finding
agg.Verdict = VerdictRequiresHuman
agg.RequiresHuman = true
return agg
}
}
agg.Verdict = VerdictChangesRequested
agg.FixCycle = true
markRequiresHumanPerspectivesAsChangesRequested(&agg)
Expand Down
37 changes: 37 additions & 0 deletions src/pkg/review/review_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,3 +807,40 @@ func TestAggregateReportsContributorUnbackedDecisionWithChangesRoutesToFixer(t *
t.Fatalf("aggregate = %+v, want the sibling change request to route to the fixer, question advisory", got)
}
}

// projectbluefin/utah-packages#890: the security review withheld approval on
// a new App credential while intent-alignment asked for a PR-body edit. The
// security hold is the contributor rule's one early exit to a person
// (hivecommons/hive#15640); the sibling change request folded it into the
// fix cycle and the PR went back to its author at 072 instead of 085.
func TestAggregateReportsContributorSecurityHoldSurvivesSiblingChangeRequest(t *testing.T) {
sec := baseReport(PerspectiveSecurity, VerdictRequiresHuman)
sec.Summary = "New App credential minted in a scheduled workflow; a maintainer must confirm the credential choice."
intent := baseReport(PerspectiveIntentAlignment, VerdictChangesRequested, outputschema.Finding{Title: "`Closes #874` contradicts the issue's own handoff", Severity: outputschema.SeverityMedium, ReviewScope: "in-scope"})
got := AggregateReports([]PerspectiveReport{sec, intent}, AggregateOptions{})
if got.Verdict != VerdictRequiresHuman || !got.RequiresHuman || got.FixCycle || got.MergeEligible {
t.Fatalf("aggregate = %+v, want the security hold kept for a person", got)
}
if !strings.Contains(got.DecisionFinding, "security review withheld approval") {
t.Fatalf("DecisionFinding = %q, want the security hold named", got.DecisionFinding)
}
if got.Perspectives[PerspectiveSecurity] != VerdictRequiresHuman {
t.Fatalf("perspectives = %v, want the security perspective left as requires_human", got.Perspectives)
}

// An unbacked requires_human beside a change request still goes to the fixer.
plain := baseReport(PerspectiveIntentAlignment, VerdictRequiresHuman)
plain.Summary = "Unclear whether the groundwork should land before its consumer."
changes := baseReport(PerspectiveCorrectness, VerdictChangesRequested, outputschema.Finding{Title: "nil deref", Severity: outputschema.SeverityMedium, ReviewScope: "in-scope"})
got = AggregateReports([]PerspectiveReport{plain, changes}, AggregateOptions{})
if got.Verdict != VerdictChangesRequested || !got.FixCycle || got.RequiresHuman {
t.Fatalf("unbacked aggregate = %+v, want the fixer lane", got)
}

// The hive's own PR is not under the contributor rule: its fix cycle runs first.
sec.HiveAuthored, intent.HiveAuthored = true, true
got = AggregateReports([]PerspectiveReport{sec, intent}, AggregateOptions{})
if got.Verdict != VerdictChangesRequested || !got.FixCycle || got.RequiresHuman {
t.Fatalf("hive-authored aggregate = %+v, want the fixer lane", got)
}
}
Loading