fix: set Failed/Succeeded counter for single-run Orders#430
Conversation
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR updates ArtifactWorkflow status handling so succeeded and failed counters are set from Argo Workflow phase, propagated into Order status, and verified in controller and e2e tests. ChangesArtifactWorkflow status counter propagation
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant SingleWorkflowHandler
participant ArgoWorkflow
participant ArtifactWorkflow
participant OrderReconciler
participant Order
SingleWorkflowHandler->>ArgoWorkflow: read wf.Status.Phase
SingleWorkflowHandler->>ArtifactWorkflow: set succeeded/failed counter
SingleWorkflowHandler->>ArtifactWorkflow: update status when changed
OrderReconciler->>ArtifactWorkflow: compare workflow status fields
OrderReconciler->>Order: copy WorkflowStatus when any field differs
OrderReconciler->>Order: update order status when anyStatusChanged
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
pkg/controller/workflow_handler.go (1)
86-100: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winUnconditional forced update causes redundant status writes on every reconcile.
Once the phase becomes terminal,
updatedis unconditionally forced totrueon every reconcile even ifSucceeded/Failedis already set to the target value, triggering an unnecessaryStatus().Update()call (Line 103) repeatedly for the lifetime of the resource.♻️ Proposed fix: only mark updated when the value actually changes
switch wf.Status.Phase { case wfv1alpha1.WorkflowSucceeded: - h.aw.Status.Succeeded = 1 - updated = true + if h.aw.Status.Succeeded != 1 { + h.aw.Status.Succeeded = 1 + updated = true + } case wfv1alpha1.WorkflowError, wfv1alpha1.WorkflowFailed: - h.aw.Status.Failed = 1 - updated = true - default: - break + if h.aw.Status.Failed != 1 { + h.aw.Status.Failed = 1 + updated = true + } }🤖 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/controller/workflow_handler.go` around lines 86 - 100, The workflow status update path in setStatusFromWorkflow and the switch on wf.Status.Phase is forcing updated to true even when h.aw.Status.Succeeded or h.aw.Status.Failed is already set, causing repeated Status().Update() calls. Change the logic so h.aw.Status.Succeeded/Failed is only assigned and updated is only set when the current value actually differs from the desired terminal value, while keeping the existing behavior for non-terminal phases.
🤖 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.
Inline comments:
In `@test/e2e/e2e_test.go`:
- Around line 226-233: The current `artifactWorkflows` check in the e2e test can
still pass when `.status.artifactWorkflows` is empty, so strengthen the
assertion around the `kubectl get`/`strings.FieldsSeq` loop in `e2e_test.go` to
verify the template output is non-empty before iterating. Use the existing
`run`, `strings.FieldsSeq`, and `strconv.Atoi` flow, but add an explicit
non-empty assertion on the `output` (or collected fields) so the succeeded-count
check is guaranteed to run.
---
Nitpick comments:
In `@pkg/controller/workflow_handler.go`:
- Around line 86-100: The workflow status update path in setStatusFromWorkflow
and the switch on wf.Status.Phase is forcing updated to true even when
h.aw.Status.Succeeded or h.aw.Status.Failed is already set, causing repeated
Status().Update() calls. Change the logic so h.aw.Status.Succeeded/Failed is
only assigned and updated is only set when the current value actually differs
from the desired terminal value, while keeping the existing behavior for
non-terminal phases.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2cb1e428-f8d3-4171-b61f-c9f07ea15eb5
📒 Files selected for processing (4)
pkg/controller/artifactworkflow_controller_test.gopkg/controller/order_controller.gopkg/controller/workflow_handler.gotest/e2e/e2e_test.go
Coverage Report for CI Build 28522681173Warning No base build found for commit Coverage: 84.534%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
4adab38 to
b81b3d4
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
b81b3d4 to
e05b322
Compare
What
Closes #418
Checklist
Summary by CodeRabbit