diff --git a/changelog.d/fixed-review-fix-dispatch-excluded-log.md b/changelog.d/fixed-review-fix-dispatch-excluded-log.md new file mode 100644 index 0000000000..4787ed2a1d --- /dev/null +++ b/changelog.d/fixed-review-fix-dispatch-excluded-log.md @@ -0,0 +1 @@ +- The "review fix dispatch excluded" line for PRs the hive did not author (`not-hive-authored`) is now logged at INFO instead of WARN, so the expected policy skip is no longer filed as an `unclassified_error_repeated` fleet issue ([#14870](https://github.com/hivecommons/hive/issues/14870)). diff --git a/src/cmd/hive/main.go b/src/cmd/hive/main.go index edaefb81b8..9fbe6b847e 100644 --- a/src/cmd/hive/main.go +++ b/src/cmd/hive/main.go @@ -11150,7 +11150,12 @@ func auditWithheldReviewFixes(plan review.DispatchPlan, auditor reviewFixAuditor // kick: a PR shown as "Fixing" that nobody is fixing must be loud // (hivecommons/hive#14665). for _, x := range plan.FixExclusions { - logger.Warn("review fix dispatch excluded", + level := slog.LevelWarn + if x.Reason == review.FixDispatchExcludedNotHiveAuthored || x.Reason == review.FixDispatchExcludedNotHiveAuthoredDCO { + // Policy skip (the hive never pushes to PRs it did not author), not a fault. + level = slog.LevelInfo + } + logger.Log(context.Background(), level, "review fix dispatch excluded", "repo", x.Repo, "pr", x.Number, "head_sha", x.HeadSHA, "author", x.Author, "reason", x.Reason, "attempts", x.Attempts) } for _, w := range plan.WithheldFixes { diff --git a/src/cmd/hive/review_fix_withheld_audit_test.go b/src/cmd/hive/review_fix_withheld_audit_test.go index 667f532dea..1531948cd7 100644 --- a/src/cmd/hive/review_fix_withheld_audit_test.go +++ b/src/cmd/hive/review_fix_withheld_audit_test.go @@ -69,3 +69,16 @@ func TestAuditWithheldReviewFixesRecordsSettingOn(t *testing.T) { t.Fatalf("audit entry must record the setting as on: %v", auditor.entries) } } + +func TestAuditWithheldReviewFixesNotHiveAuthoredExclusionIsNotWarn(t *testing.T) { + var buf strings.Builder + logger := slog.New(slog.NewTextHandler(&buf, nil)) + plan := review.DispatchPlan{FixExclusions: []review.FixDispatchExclusion{ + {Repo: "acme/x", Number: 1, HeadSHA: "abc", Author: "human", Reason: review.FixDispatchExcludedNotHiveAuthored}, + }} + auditWithheldReviewFixes(plan, nil, logger) + out := buf.String() + if !strings.Contains(out, "review fix dispatch excluded") || strings.Contains(out, "level=WARN") { + t.Fatalf("not-hive-authored exclusion must log below WARN, got: %s", out) + } +}