OCPBUGS-100385: MonitorTest: measure the union of ClusterOperator wait intervals - #31457
OCPBUGS-100385: MonitorTest: measure the union of ClusterOperator wait intervals#31457stbenjam wants to merge 2 commits into
Conversation
Signed-off-by: Stephen Benjamin <stephen@redhat.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: stbenjam The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
WalkthroughUpgrade Progressing checks now aggregate CVO waiting intervals into merged episodes, total and longest durations, observation spans, and episode ranges. Exception output and tests use the new summary instead of a single overall interval. ChangesWaiting interval summarization
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go (1)
915-984: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider a brief "why" comment on the merge/union algorithm.
summarizeWaitingIntervalsimplements non-trivial interval-union semantics (sort, merge overlapping/adjacent into episodes, compute total/longest/span) with no comment explaining the intent (avoiding false failures from healthy gaps between disjoint waits). A one-line comment would help future maintainers reasoning about this CI-flake-diagnosis logic without re-deriving the algorithm.As per coding guidelines,
**/*.go: "Favor clarity and maintainability over cleverness in Go code. Keep comments minimal and helpful, explaining why rather than what."📝 Example comment
+// summarizeWaitingIntervals merges overlapping/adjacent waiting intervals into +// episodes so that healthy gaps between disjoint observations aren't counted +// as waiting time (see false failures caused by disjoint aggregator gaps). func summarizeWaitingIntervals(intervals monitorapi.Intervals) waitingIntervalSummary {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go` around lines 915 - 984, Add a concise why-focused comment above the interval sorting/merging logic in summarizeWaitingIntervals, explaining that unioning overlapping or adjacent waits into episodes prevents healthy gaps between disjoint waits from producing misleading CI-flake failures. Keep the existing interval-union and summary calculations unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go`:
- Around line 915-984: Add a concise why-focused comment above the interval
sorting/merging logic in summarizeWaitingIntervals, explaining that unioning
overlapping or adjacent waits into episodes prevents healthy gaps between
disjoint waits from producing misleading CI-flake failures. Keep the existing
interval-union and summary calculations unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: da7f5c77-8b94-456a-bad8-be8695bb23da
📒 Files selected for processing (2)
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.gopkg/monitortests/clusterversionoperator/legacycvomonitortests/operators_test.go
|
@stbenjam: This pull request references Jira Issue OCPBUGS-100385, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/payload-job periodic-ci-openshift-release-main-ci-5.0-upgrade-from-stable-4.22-e2e-aws-ovn-upgrade |
|
@stbenjam: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/8d5e6b80-8ce9-11f1-8b39-f47c20246fc6-0 |
Review: Interval Union for CVO Wait MeasurementI reviewed the diff, the CVO source code (specifically how The BugDuring an upgrade, CVO periodically publishes its The old Algorithm CorrectnessThe new
Test CoverageThe new
The existing Minor Suggestions (non-blocking)
Overall✅ This is a correct and well-motivated fix. The interval-union algorithm is sound, test coverage is solid for the production failure patterns, and the improved diagnostics are a nice bonus. The real-world impact is significant — this defect caused the Payload Agent to falsely recommend reverting unrelated PRs at 90% confidence. |
|
Scheduling required tests: |
Signed-off-by: Stephen Benjamin <stephen@redhat.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators_test.go (1)
314-315: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the formatted summary for valid intervals too.
expectedStringis set only for empty and all-invalid inputs. This test does not detect regressions in non-empty diagnostics, including total duration, episode count, observation span, or merged ranges. Add expected strings for representative separated, overlapping, and multi-episode cases, or add a dedicated table-driven string test.Also applies to: 383-385
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators_test.go` around lines 314 - 315, Extend the table-driven tests around the existing expectedString cases to assert formatted summaries for valid intervals, including separated, overlapping, and multi-episode inputs. Populate expectedString with exact output covering total duration, episode count, observation span, and merged ranges, or add a dedicated table-driven test for the summary formatter.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators_test.go`:
- Around line 314-315: Extend the table-driven tests around the existing
expectedString cases to assert formatted summaries for valid intervals,
including separated, overlapping, and multi-episode inputs. Populate
expectedString with exact output covering total duration, episode count,
observation span, and merged ranges, or add a dedicated table-driven test for
the summary formatter.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: c71a9c51-2388-4393-a7e6-7f2818d289e5
📒 Files selected for processing (2)
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.gopkg/monitortests/clusterversionoperator/legacycvomonitortests/operators_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go
|
@stbenjam: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
These bugs and fixes were automatically generated by a payload-agent experiment to improve resilience and diagnostics for infrastructure failures. Please review the PR and either shepherd it to merge or close it. If the work is incorrect or unhelpful, a brief comment would help us improve. Thanks, and apologies if we missed the mark.
What this fixes
The upgrade monitor decides whether CVO reported waiting at least three minutes for a ClusterOperator. Its input consists of constructed intervals representing periods when the
ClusterVersionProgressing message named that operator.The existing calculation subtracts the earliest interval start from the latest interval end. When CVO names an operator in multiple disjoint episodes, this counts all intervening time—even though CVO did not report waiting on that operator during the gap.
This change sorts and merges overlapping or adjacent intervals, then applies the threshold to the duration of their union. This restores the accumulation intended by origin#30333 without double-counting overlaps. Failure diagnostics now report:
These intervals are a CVO status-message metric. They do not prove operator availability, pod readiness, or overall cluster health during the gaps.
Visualization of the new behavior is here
Payload and RCA context
The false attribution surfaced during the 4.22→5.0 regression introduced by cluster-version-operator#1427 and reverted by cluster-version-operator#1431. The old CVO could not render its 5.0 Deployment, never self-updated, and repeatedly restarted its sync between the embedded 4.22 payload and desired 5.0 payload. That produced several short
waiting on config-operatorepisodes separated by unrelated payload work and restarts.The CVO defect was the primary payload regression; this PR fixes a secondary monitor calculation that turned those disjoint episodes into a misleading
config-operatorfailure. The CVO, etcd, alert, and disruption signals for the underlying product regression remain unaffected.For payload
5.0.0-0.ci-2026-07-25-102741, 13 raw AWS/Azure child failures had CVO-reported interval unions of 13–150 seconds with no episode longer than 150 seconds, while the old calculation reported observation spans from 3m27s to 58m53s. One representative result combined a 15-second interval with a later point observation and reported 45m14s.The Payload Agent consequently recommended reverting unrelated
openshift/api#2920and#2923at 90 confidence. Experimental revert jobs continued failing, falsifying both recommendations.Validation
go test ./pkg/monitortests/clusterversionoperator/legacycvomonitortestsgo vet ./pkg/monitortests/clusterversionoperator/legacycvomonitortestsSummary by CodeRabbit
Summary by CodeRabbit