Service Layer low complexity mobile
0
Dependencies
1
Dependents
2
Entities
0
Integrations

Description

A pure service that evaluates phase-based rollout conditions for a feature flag given the current app version and date. Returns whether a flag should be considered active based on its configured minimum app version and optional activation date thresholds.

Feature: Organization-scoped Feature Flags

rollout-evaluator

Summaries

The Rollout Condition Evaluator ensures that new features are only surfaced to users whose app version and timing context meet the configured launch criteria, eliminating the risk of exposing unfinished or incompatible functionality to users who have not yet updated. This protects brand reputation, reduces support ticket volume from confused users on older app versions, and gives product and commercial teams confidence to configure phased launches without engineering intervention. Its purely logical, dependency-free design means it can be audited independently, reducing compliance and QA overhead. The result is faster, safer feature launches with measurable reduction in rollout-related incidents.

The Rollout Condition Evaluator is a low-complexity, zero-dependency pure service, making it the lowest-risk component in the feature flag system and an ideal early deliverable. It has no network, database, or platform dependencies, so it can be fully unit-tested in isolation with 100% branch coverage in a short time. Its interfaces are stable—`evaluate`, `isVersionSufficient`, and `isDateReached`—and unlikely to require changes unless rollout condition types are extended. It carries no deployment risk and can be developed and signed off before the repository or cache layers are complete.

Schedule it as an early sprint task to unblock provider development.

RolloutEvaluator is a stateless pure-Dart service with no injected dependencies. `evaluate(flag, appVersion, now)` is the primary entry point and returns `true` only when both `isVersionSufficient` and `isDateReached` pass. `isVersionSufficient` must implement semantic version comparison (split on `.`, parse to List, compare element-wise) rather than lexicographic string comparison, since `'2.10.0' > '2.9.0'` fails lexicographically. `isDateReached` returns `true` when `activationDate` is null (no date gate) or when `now.isAfter(activationDate)`.

Keep this class free of Flutter imports so it can be tested with `dart test` without a device. FeatureFlagProvider calls this synchronously inside its map-building loop—no async, no side effects.

Responsibilities

  • Compare current semantic app version against flag's minimum required version
  • Check current date against the flag's optional activation date
  • Return a boolean indicating whether rollout conditions are met

Interfaces

evaluate(FeatureFlag flag, String appVersion, DateTime now) → bool
isVersionSufficient(String currentVersion, String minVersion) → bool
isDateReached(DateTime? activationDate, DateTime now) → bool

Relationships

Dependents (1)

Components that depend on this component

Related Data Entities (2)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/organizations/{organization_id}/feature-flags/rollout 5 endpoints
POST /api/v1/organizations/{organization_id}/feature-flags/rollout/evaluate Evaluate whether a flag is active given a specific app version and datetime
POST /api/v1/organizations/{organization_id}/feature-flags/rollout/evaluate-version Check if an app version meets the minimum version requirement for a flag
GET /api/v1/organizations/{organization_id}/feature-flags/rollout/{flag_key} Get the rollout condition for a specific flag
PUT /api/v1/organizations/{organization_id}/feature-flags/rollout/{flag_key} Set or update the rollout condition for a flag
DELETE /api/v1/organizations/{organization_id}/feature-flags/rollout/{flag_key} Remove the rollout condition from a flag (immediate rollout if enabled)