Skip to content

Fix: coupling in internal workflows endpoints

What does this MR do and why?

Fix: coupling in internal workflows endpoints

The render_response helper in workflows_internal.rb was directly using response.reason from services as HTTP status codes. This violated the Service Response pattern, which states that service objects should return semantic reasons rather than HTTP status codes.

Changes Made

  1. Service Layer (revoke_token_service.rb): Service now returns semantic reason :invalid_token when token validation fails

  2. API Endpoint Helper (workflows_internal.rb): Helper now maps semantic reasons to appropriate HTTP status codes

  3. Tests (workflows_internal_spec.rb): Updated tests to verify the reason-to-status mapping works correctly.

Fixes #567346

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sankalp

Merge request reports

Loading