-
Notifications
You must be signed in to change notification settings - Fork 548
UN-2584 [FIX] Corrected HTTP status codes for workflow execution status API #1256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM - however
- Won't this break existing clients that rely on the existing (flawed) logic? Ideally we should version the API deployments to aid with such changes however since we don't have it in place I'm wondering how we can carry this out cleanly
- We might have to update accordingly in our
python-client
and the API deployments batch run script if required
Summary by CodeRabbit
## Summary by CodeRabbit
* **Bug Fixes**
* Improved handling of deployment execution statuses with clearer and more accurate HTTP responses for acknowledged, completed, executing, pending, and error states.
* **Refactor**
* Clarified and streamlined the logic for determining response statuses based on execution state.
## Walkthrough
The control flow in the `get` method of the `DeploymentExecution` API view was refactored to more explicitly handle various execution statuses. The response status codes and messages were adjusted based on the execution state, with clearer branching and an early return for acknowledged results. Enum usage was updated for status checks. A new helper method was added to modularize response data filtering based on request flags and global settings.
## Changes
| File(s) | Change Summary |
|-------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| backend/api_v2/api_deployment_views.py | Refactored `get` method to restructure response status logic, added early return for acknowledged results, replaced enum import, and introduced `_filter_response_data` helper method for conditional response data filtering. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Client
participant API_View
participant ExecutionStatus
Client->>API_View: GET /deployment-execution
API_View->>ExecutionStatus: Check execution status
alt Result already acknowledged
API_View-->>Client: HTTP 406 (Not Acceptable) with message
else Execution completed
API_View-->>Client: HTTP 200 with result (filtered as needed)
else Executing or Pending
API_View-->>Client: HTTP 200 with current status (filtered as needed)
else Other statuses (stopped, error, etc.)
API_View-->>Client: HTTP 422 (Unprocessable Entity) with error info
end
|
…us API Fixed PENDING and EXECUTING states to return 200 OK instead of 422, resolving API integration issues where clients expected 200 OK for valid in-progress states per documentation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
|
What
200 OK
instead of422 Unprocessable Entity
Why
422
status codes for valid in-progress states (PENDING/EXECUTING)200 OK
for successful status checks per API documentationHow
backend/api_v2/api_deployment_views.py
to return proper HTTP status codes:PENDING
,EXECUTING
→200 OK
(was 422 before)COMPLETED
→200 OK
(no change)ERROR
,STOPPED
→422 Unprocessable Entity
(no change)Result already acknowledged
→406 Not Acceptable
(no change)get
method with improved structure and documentation_filter_response_data
methodCan this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
Screenshots
N/A - Backend API change
Checklist
I have read and understood the Contribution Guidelines.
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]