fix: map WorkflowRun UI status from WorkflowCompleted reasons - #741
fix: map WorkflowRun UI status from WorkflowCompleted reasons#741artemiyokulov wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds shared WorkflowRun display-status derivation, exports it with related types, and replaces local status logic in three backend paths. Tests cover completed failures and other condition, task, and timestamp combinations. A changeset records patch releases for four packages. ChangesWorkflowRun status handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant GenericWorkflowService
participant WorkflowService
participant WorkflowRunTransformer
participant deriveWorkflowRunDisplayStatus
GenericWorkflowService->>deriveWorkflowRunDisplayStatus: pass WorkflowRun status data
WorkflowService->>deriveWorkflowRunDisplayStatus: pass WorkflowRun status data
WorkflowRunTransformer->>deriveWorkflowRunDisplayStatus: pass WorkflowRun status data
deriveWorkflowRunDisplayStatus-->>GenericWorkflowService: return display status
deriveWorkflowRunDisplayStatus-->>WorkflowService: return display status
deriveWorkflowRunDisplayStatus-->>WorkflowRunTransformer: return display status
Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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: 2
🤖 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 `@plugins/openchoreo-common/src/workflowRunStatus.ts`:
- Around line 93-100: Update the terminal-reason handling in
workflowRunStatus.ts so unrecognized terminal reasons return the documented
Completed display status instead of the raw reason, while preserving recognized
statuses and useful specific labels. Add a test covering an unrecognized
terminal reason such as Cancelled and assert it normalizes to Completed.
- Around line 76-101: Update the condition evaluation in the workflow status
resolver so a `WorkflowCompleted=True` condition with an
`isFailureReason(reason)` result is handled before the `WorkflowSucceeded=True`
check, preserving failure precedence. Keep existing success and terminal-reason
behavior unchanged, and add a test covering both conditions where the result
must be `Failed`.
🪄 Autofix
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 Plus
Run ID: a08e3762-e2a1-4538-a34f-4b15497da375
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
.changeset/workflowrun-completed-status.mdplugins/openchoreo-backend/src/services/transformers/transformers.test.tsplugins/openchoreo-backend/src/services/transformers/workflow-run.tsplugins/openchoreo-ci-backend/src/services/WorkflowService.tsplugins/openchoreo-common/src/index.tsplugins/openchoreo-common/src/workflowRunStatus.test.tsplugins/openchoreo-common/src/workflowRunStatus.tsplugins/openchoreo-workflows-backend/package.jsonplugins/openchoreo-workflows-backend/src/services/GenericWorkflowService.ts
Honor WorkflowCompleted=True with failure reasons (and typed WorkflowFailed/Succeeded) so completed failures no longer show as Pending when only the aggregate condition is present. Prefer WorkflowCompleted failure over typed WorkflowSucceeded, and keep unrecognized terminal reasons within the documented status set. Signed-off-by: Artemy Okulov <artemy.okulov@x5.ru> Co-authored-by: Cursor <cursoragent@cursor.com>
539f105 to
2cc9366
Compare
|
Addressed CI/review feedback:
|
Signed-off-by: Artemy Okulov <artemy.okulov@x5.ru> Co-authored-by: Cursor <cursoragent@cursor.com>
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
CI follow-up:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Add unit tests for Ready conditions, task phases, and completedAt edge cases so deriveWorkflowRunDisplayStatus reaches 100% line coverage. Signed-off-by: Artemy Okulov <artemy.okulov@x5.ru> Co-authored-by: Cursor <cursoragent@cursor.com>
|
@artemiyokulov Thank you for the contribution. It seems that some of the files you touch are leftover code from multiple ci/workflows related rewrites. But removing those can be a different task and I have raised an issue for that. Thanks for working through this one. The direction is right: mapping One thing to fix before I approve. This helper is supposed to return one of five values: That causes real problems downstream. The workflows backend takes whatever this returns and checks Line 132 — the run has a Lines 137-143 — here there's no completedAt, so the run isn't finished yet. The existing To be clear, neither of these is breaking anything today — the WorkflowRun controller doesn't set a Two smaller things, neither blocking:
One last note: chips will now show Failed where they used to show BuildFailed or |
Summary
deriveWorkflowRunDisplayStatusthat understands both typed conditions (WorkflowFailed/WorkflowSucceeded) and aggregateWorkflowCompleted=True+ reason (WorkflowFailed,ComponentValidationFailed,WorkflowSucceeded, …).transformComponentWorkflowRunso completed failures no longer show as Pending (or false Succeeded whentasks[]lag).Fixes openchoreo/openchoreo#4442
Related: openchoreo/openchoreo#4419
Related controller fix class: openchoreo/openchoreo#3877
Context
On some terminal failure paths the WorkflowRun CR has:
completedAtsetWorkflowCompleted=True reason=WorkflowFailedWorkflowFailed=Truetasks[].phase: PendingGenericWorkflowService.deriveWorkflowRunStatuspreviously only checked typed conditions → default Pending. CI/completedAtpaths could even report Succeeded when tasks were not Failed.Test plan
deriveWorkflowRunDisplayStatus(workflowRunStatus.test.ts)WorkflowCompleted+ stale Pending task → FailedWorkflowCompleted/WorkflowFailed→ Workflows + CI chips show FailedWorkflowCompleted/WorkflowSucceededstill shows SucceededWorkflowRunning=Truestill shows RunningMade with Cursor
Summary by CodeRabbit
Bug Fixes
Tests