fix(workflow): remove duplicate package doc and consolidate ReviewBlocking
Delete the redundant package doc comment from review_findings.go to preserve workflow.go as the single canonical package comment, and consolidate the package-level decision function to a single ReviewBlocking export mirroring gate.Blocking.
This commit is contained in:
1 parent
708030845b
commit
20a8df2bbb
2 files changed
+9
-16
No files matched your search
@@ -1,4 +1,3 @@
|
||||
// Package workflow defines pipeline stages, contracts, and execution rules.
|
||||
package workflow
|
||||
|
||||
import (
|
||||
@@ -117,9 +116,11 @@ func (f ReviewFinding) Blocking() bool {
|
||||
return f.Verdict == ReviewVerdictConfirmed && f.Level == ReviewLevelError
|
||||
}
|
||||
|
||||
// BlockingReviewFindings reports whether any finding in the slice is blocking.
|
||||
// It returns true if at least one finding is confirmed with level "error".
|
||||
func BlockingReviewFindings(findings []ReviewFinding) bool {
|
||||
// ReviewBlocking reports whether any finding in the slice is blocking.
|
||||
// The load-bearing rule: ONLY a finding with Verdict == ReviewVerdictConfirmed
|
||||
// and Level == ReviewLevelError blocks. Plausible findings and warn-level findings
|
||||
// never block.
|
||||
func ReviewBlocking(findings []ReviewFinding) bool {
|
||||
for _, f := range findings {
|
||||
if f.Blocking() {
|
||||
return true
|
||||
@@ -128,11 +129,6 @@ func BlockingReviewFindings(findings []ReviewFinding) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ReviewBlocking is an alias for BlockingReviewFindings to match package-level naming conventions.
|
||||
func ReviewBlocking(findings []ReviewFinding) bool {
|
||||
return BlockingReviewFindings(findings)
|
||||
}
|
||||
|
||||
// Ran reports whether the adversarial reviewer actually executed to completion.
|
||||
// Reviews that were not run (Status == ReviewStatusNotRun or uninitialised) or skipped
|
||||
// return false.
|
||||
@@ -142,7 +138,7 @@ func (r ReviewReport) Ran() bool {
|
||||
|
||||
// Blocking reports whether any finding within the report is blocking.
|
||||
func (r ReviewReport) Blocking() bool {
|
||||
return BlockingReviewFindings(r.Findings)
|
||||
return ReviewBlocking(r.Findings)
|
||||
}
|
||||
|
||||
// Passed reports whether the review ran to completion and produced no blocking findings.
|
||||
|
||||
@@ -113,7 +113,7 @@ func TestReviewFindingBlockingMatrix(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBlockingReviewFindingsSlice(t *testing.T) {
|
||||
func TestReviewBlockingSlice(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
findings []ReviewFinding
|
||||
@@ -244,9 +244,6 @@ func TestBlockingReviewFindingsSlice(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := BlockingReviewFindings(tt.findings); got != tt.wantBlocking {
|
||||
t.Errorf("BlockingReviewFindings() = %v, want %v", got, tt.wantBlocking)
|
||||
}
|
||||
if got := ReviewBlocking(tt.findings); got != tt.wantBlocking {
|
||||
t.Errorf("ReviewBlocking() = %v, want %v", got, tt.wantBlocking)
|
||||
}
|
||||
@@ -276,8 +273,8 @@ func TestBlockingReviewFindingsSlice(t *testing.T) {
|
||||
Category: ReviewCategoryNilRisk,
|
||||
}
|
||||
|
||||
if !BlockingReviewFindings(findings) {
|
||||
t.Error("BlockingReviewFindings() = false, want true for confirmed error at index 750")
|
||||
if !ReviewBlocking(findings) {
|
||||
t.Error("ReviewBlocking() = false, want true for confirmed error at index 750")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user