Skip to content

Move evaluator and assigner to shared package#5

Merged
williamgrosset merged 1 commit intomainfrom
move-evaluator-assigner-to-shared
Feb 28, 2026
Merged

Move evaluator and assigner to shared package#5
williamgrosset merged 1 commit intomainfrom
move-evaluator-assigner-to-shared

Conversation

@williamgrosset
Copy link
Copy Markdown
Owner

Summary

  • Moves evaluateTargetingRules and assignVariants from decision-service/src/services/ into @experiments/shared, so both the decision-service and the upcoming client-side React SDK can import rule evaluation and variant assignment from a single source of truth.
  • Updates the decision-service to import assignVariants from @experiments/shared instead of its local copy.
  • Relocates the corresponding unit tests (evaluator.test.ts, assigner.test.ts) to packages/shared/test/.

Changes

File Change
packages/shared/src/evaluator.ts Moved from decision-service (import paths updated to local shared types)
packages/shared/src/assigner.ts Moved from decision-service (imports evaluateTargetingRules locally, getBucket and types from shared)
packages/shared/src/index.ts Exports evaluateTargetingRules and assignVariants
packages/shared/test/evaluator.test.ts Moved from decision-service/test/ (import paths updated)
packages/shared/test/assigner.test.ts Moved from decision-service/test/ (import paths updated)
decision-service/src/routes/decide.ts Imports assignVariants from @experiments/shared instead of local ../services/assigner.js
decision-service/package.json Adds --passWithNoTests flag since all tests moved to shared

Verification

  • All 24 shared package unit tests pass (13 evaluator + 9 assigner + 2 hashing)
  • All 10 experiment-service unit tests pass
  • Build succeeds across all packages (shared, api-gateway, decision-service, experiment-service, dashboard)
  • Zero logic changes — code was moved verbatim with only import path adjustments

Promotes evaluateTargetingRules and assignVariants into @experiments/shared
so both the decision-service and the upcoming React SDK can import from the
same source of truth. Moves the corresponding unit tests alongside the code.
@williamgrosset williamgrosset merged commit 51349e1 into main Feb 28, 2026
3 checks passed
@williamgrosset williamgrosset deleted the move-evaluator-assigner-to-shared branch February 28, 2026 07:51
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