You are working on the hyperswitch repository (Rust payment processing system).
REPOSITORY SETUP:
Repository: juspay/hyperswitch
Working directory: ./repos/hyperswitch_pool_1 (already cloned)
Base commit: 04dc14a93022d03d74b02ae244ee8bb8afa50c27
Task ID: juspay__hyperswitch-8000
Version: v1.114.0
TASK DESCRIPTION:
Bug: Feat(euclid): Hyperswitch integration with decision engine
Description
This PR integrates the Euclid-based decision engine with Hyperswitch’s dynamic routing infrastructure. It enables dual routing logic: legacy DSL-based evaluation and decision-engine-backed configurations. The integration ensures routing algorithms can be authored, activated, and evaluated via Euclid and linked seamlessly to merchant profiles.
Outcomes
Adds support for storing and linking decision-engine routing IDs (decision_engine_routing_id) in the existing routing_algorithm table.
Enables creation and linking of Euclid routing configurations during algorithm creation and configuration linking flows.
Enhances observability with logging and tracing of decision engine interactions.
Preserves backward compatibility with existing static/dynamic routing mechanisms.
Diff Hunk Explanation
crates/api_models/src/routing.rs
Added decision_engine_routing_id to RoutingDictionaryRecord to expose the DE mapping in API responses.
Updated RoutingAlgorithmKind with PartialEq to aid in logic branching.
crates/diesel_models/src/routing_algorithm.rs
Included new optional field decision_engine_routing_id to map to Euclid's algorithm record.
crates/diesel_models/src/schema.rs
Altered routing_algorithm schema to include decision_engine_routing_id VARCHAR(64).
crates/router/src/core/payments/routing.rs
Imported perform_decision_euclid_routing into static routing flow for test execution and future use.
crates/router/src/core/routing.rs
On routing creation, checks if the algorithm is a Euclid (Advanced) type, then creates it in the decision engine and stores the returned ID.
On routing configuration linking, activates the respective routing config in the decision engine using .
Assistant
I'll help you implement the Euclid-based decision engine integration with Hyperswitch's dynamic routing infrastructure. Let me first understand the current state and create a focused plan for the implementation.
Assistant
Let me first explore the repository structure to understand the codebase better and locate the relevant files mentioned in the task.
Assistant
(no content)
Assistant
Let me also check the schema file and migration:
Assistant
(no content)
Assistant
Let me search for migration files more broadly:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
This PR integrates the Euclid-based decision engine with Hyperswitch’s dynamic routing infrastructure. It enables dual routing logic: legacy DSL-based evaluation and decision-engine-backed configurations. The integration ensures routing algorithms can be authored, activated, and evaluated via Euclid and linked seamlessly to merchant profiles.
Outcomes
Adds support for storing and linking decision-engine routing IDs (decision_engine_routing_id) in the existing routing_algorithm table.
Enables creation and linking of Euclid routing configurations during algorithm creation and configuration linking flows.
Enhances observability with logging and tracing of decision engine interactions.
Preserves backward compatibility with existing static/dynamic routing mechanisms.
Diff Hunk Explanation
crates/api_models/src/routing.rs
Added decision_engine_routing_id to RoutingDictionaryRecord to expose the DE mapping in API responses.
Updated RoutingAlgorithmKind with PartialEq to aid in logic branching.
crates/diesel_models/src/routing_algorithm.rs
Included new optional field decision_engine_routing_id to map to Euclid's algorithm record.
crates/diesel_models/src/schema.rs
Altered routing_algorithm schema to include decision_engine_routing_id VARCHAR(64).
crates/router/src/core/payments/routing.rs
Imported perform_decision_euclid_routing into static routing flow for test execution and future use.
crates/router/src/core/routing.rs
On routing creation, checks if the algorithm is a Euclid (Advanced) type, then creates it in the decision engine and stores the returned ID.
On routing configuration linking, activates the respective routing config in the decision engine using ActivateRoutingConfigRequest.
Enhances retrieve_merchant_routing_dictionary to fetch and append decision engine routing configs by profile ID.
crates/router/src/core/routing/transformers.rs
Ensures decision_engine_routing_id is preserved and transformed when converting between internal and API models.