You are working on the hyperswitch repository (Rust payment processing system).…
- User
You are working on the hyperswitch repository (Rust payment processing system).
REPOSITORY SETUP:
- Repository: juspay/hyperswitch
- Working directory: ./repos/hyperswitch_pool_2 (already cloned)
- Base commit: 8a7590cf60a0610863e7b6ef8a3c4b780ba03a85
- Task ID: juspay__hyperswitch-8612
- Version: v1.115.0
TASK DESCRIPTION: Bug: Add support to pass fallback_configs for PL routing in the /routing/evaulate request from hyperswitch
DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
Decision engine does not have the concept of fallback connectors, so we recently added support to handle the default connectors by allowing them to be passed in the evaluate request. As part of this PR we are making the necessary changes to pass fallback connectors to decision engine
Additional Changes
- This PR modifies the API contract
- This PR modifies the database schema
- This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
On making a payment from hyperswitch, with the routing rules defined and activated already. We will be passing the fallback_output to the decision engine
Checklist
- I formatted the code
cargo +nightly fmt --all - I addressed lints thrown by
cargo clippy - I reviewed the submitted code
- I added unit tests for my changes where possible
CRITICAL INSTRUCTIONS - WORK FAST AND EFFICIENTLY:
-
Create DENSE, ACTION-FOCUSED todos IMMEDIATELY
- Make todos specific and actionable
- Focus on HIGH-IMPACT actions only
- 5-8 todos maximum - be surgical, not exhaustive
-
Execute aggressively:
- Use bash commands to search efficiently
- Read multiple related files in quick succession
- Make ALL related changes in one edit
- Skip unnecessary exploration
-
File operations:
- All repo files: './repos/hyperswitch_pool_2/'
- Use targeted edits over whole file rewrites
-
NO TESTING UNLESS CRITICAL:
- Focus on making the actual code changes
- Only test if explicitly required
-
Maximize information density:
- Each turn should accomplish significant work
- Batch file reads when examining related code
- Use search commands to locate code quickly
EFFICIENCY IS CRITICAL. Make substantial progress every turn.
Assistant
I need to understand the task better. Let me break down what's needed:
- The task is to add support for passing fallback_configs for PL routing in the /routing/evaluate request
- This involves making changes to pass fallback connectors to the decision engine
- There's a screenshot showing how this should work with routing rules and fallback_output
Let me start by exploring the routing-related code to understand the current implementation.
Assistant
Let me first explore the routing-related code to understand the current structure:
Assistant
(no content)
Assistant
Let me examine the main routing route file:
Assistant
Now let me look for the
/routing/evaluateendpoint which seems to be the key target for this task. Let me search for it:Assistant
Let me check what OpenAPI definitions are available for routing:
Assistant
I need to find the evaluate endpoint, which might be under a different name. Let me search for routing evaluation in the codebase:
Assistant
Let me look at the core routing modules:
Assistant
Let me look at the API model definitions for routing to understand the request structures:
Assistant
(no content)
Assistant
(no content)
Assistant
Let me look at the routing API models:
Assistant
Now let me search for any reference to the decision engine and routing evaluation specifically:
Assistant
Let me look for references to decision engine and routing evaluation more broadly:
Assistant
Let me check the core routing module that might contain decision engine integration:
Assistant
Let me continue reading to find the decision engine integration details:
Assistant
Let me look at how the routing evaluates work in payments to understand where the decision engine is called:
Assistant
Let me continue to read this function that looks like it handles routing evaluation with decision engine:
Assistant
Now let me examine the actual utility function that performs decision engine routing to understand where I need to make changes:
Assistant
(no content)
Assistant
Now I have a much clearer picture. Let me look at the main routing logic that needs to be updated to support fallback configs for PL routing in the
/routing/evaluaterequest. Based on the issue description and the code I've reviewed, I need to modify the routing evaluation logic to support passing fallback configurations to the decision engine.Looking at the code in the
perform_decision_euclid_routingfunction, I can see that it sends aRoutingEvaluateRequestto the decision engine. This request only includes parameters from the DSL input but doesn't include fallback connectors.Let me search for where the routing evaluation happens in the payments flow to see exactly what I need to modify:
Assistant
Let me examine the specific structure of the API models to understand how to extend the routing evaluation request with fallback configs:
Assistant
Now let me check how fallback connectors are handled in the codebase by looking at the existing fallback handling logic:
Assistant
Let me check in the entire router module:
Assistant
Let me look at the fallback routing handling in the routing.rs file to understand how fallback connectors are currently managed:
Assistant
(no content)
Assistant
Let me examine the key file I identified earlier more closely to understand what I need to modify for the fallback configs:
Assistant
Now I'll look closer at the exact structure I need to change in the RoutingEvaluateRequest to support fallback configs. Based on my investigation so far, I need to:
- Update the
RoutingEvaluateRequeststruct to include fallback configurations - Modify the
perform_decision_euclid_routingfunction to accept and pass fallback configs - Update the conversion function
convert_backend_input_to_routing_eval
Let me make the changes:
- Update the
Assistant
I need to read the file first before editing it. Let me read the entire file to get the context:
Assistant
Let me continue reading to see the end of the file where the RoutingEvaluateRequest is defined:
Assistant
Let me look for the specific lines around the RoutingEvaluateRequest definition:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →