Skip to content

Conversation

@aniketburman014
Copy link
Contributor

@aniketburman014 aniketburman014 commented Feb 5, 2026

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Targeting key support for Superposition experiments

Superposition uses a targeting key to split traffic across experiment variants. Previously, the targeting key was always passed as None, so experiment-based config resolution wasn't functional.

Added targeting_key as a type parameter in the config! macro so each config declares which ID type is used for traffic splitting. The macro-generated method accepts the ID directly and converts it to a String before passing it to Superposition's OpenFeature evaluation context.

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?

  1. Set up an experiment in Superposition on requires_cvv with two variants (e.g., 50/50 split)
  2. Create multiple customers with different customer IDs
  3. Create a payment method for each customer
  4. Get payment token for each customer
  5. Check logs — different customer IDs should resolve to different requires_cvv values
  6. Repeat a payment for the same customer — should get the same variant every time
Screenshot 2026-02-11 at 2 03 20 PM Screenshot 2026-02-11 at 2 03 31 PM

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

@aniketburman014 aniketburman014 requested review from a team as code owners February 5, 2026 07:49
@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 5, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payment_methods/cards.rs  84% smaller
  crates/router/src/core/configs.rs  72% smaller
  crates/router/src/core/configs/dimension_config.rs  49% smaller
  crates/external_services/src/superposition.rs  38% smaller
  Cargo.lock Unsupported file format
  crates/external_services/Cargo.toml Unsupported file format
  crates/router/src/core/payments/helpers.rs  0% smaller

@aniketburman014 aniketburman014 changed the title framework changes feat(superposition): Introduce targeting key support for Superposition experiment traffic splitting Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant