Skip to content

feat(sdk): identifier-based percentage rollout via RolloutEvaluator #35

Description

@trinhvandat

Context (P2 — product)

util/RolloutEvaluator (MurmurHash3 deterministic bucketing on identifier:flagKey) already exists but nothing calls it — the SDK API takes no identifier and FlagEnvironmentState has no rollout percentage. This is the gateway to the v2 targeting roadmap.

Scope

  • Liquibase changeset: rollout_percent (0–100, default 100) on flag_environment_state
  • Admin API: set rollout percent via the flag-state update endpoint (validation 0–100)
  • SDK API: optional identifier query param (or header) on evaluation; EvaluationServiceImpl applies RolloutEvaluator.evaluate(...)
  • Contract decision documented: without identifier, rollout<100 behavior (current evaluator returns true — confirm or change)
  • Interacts with evaluation caching (feat(perf): evaluation caching (Caffeine) + ETag/304 on SDK endpoint #30): identifier-dependent results must not be cached per-environment blindly — cache the state, evaluate per request

Acceptance criteria

  • Same identifier+flagKey always gets the same result at a fixed percent (property test)
  • Bucket distribution roughly uniform across 10k identifiers (statistical test with tolerance)
  • SDK response shape change is backward compatible (additive only)
  • New changeset only

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions