Fail flow trigger workload when branch creation fails
What does this MR do and why?
This MR fixes an error in Ai::FlowTriggers::RunService where a ServiceResponse object was being returned directly instead of a Hash, causing a "no implicit conversion of ServiceResponse into Hash" error.
The issue occurred when branch creation failed - the service was trying to return a ServiceResponse from branch_args method, but the calling code expected a hash to splat into keyword arguments.
Changes
- Modified
branch_argsto always return aServiceResponse:- On success: returns
ServiceResponse.success(payload: { ref: branch_name }) - On failure: returns the error
ServiceResponsefrom the branch service
- On success: returns
- Updated
run_workloadto check theServiceResponseand extract the ref from the payload - When branch creation fails, the entire workload execution now fails with the appropriate error message
- Added test coverage for the branch creation failure scenario
Related issues
Closes #issue_number_here (if applicable)