Enable and Configure Feature Flags per Organisation
The feature flag admin screen lists all available feature flags with their current state (enabled/disabled) for the admin's organisation. Each flag has a description explaining what it controls and any dependencies. The rollout evaluator supports gradual rollout percentages for testing with a subset of users before full activation. Feature gate widgets throughout the app conditionally render UI based on the evaluated flag state, which is cached locally and refreshed from Supabase on session start.
User Story
Acceptance Criteria
- Given I open the feature flags screen, when the list loads, then I see all feature flags with clear descriptions, current state for my org, and any dependency warnings
- Given I disable the 'expense_reimbursement' feature flag, when a coordinator in my org opens the add menu, then the expense registration option is not displayed
- Given I enable a feature flag with a rollout percentage of 20%, when users in my org open the app, then approximately 20% see the new feature based on deterministic user-ID-based evaluation
- Given a feature flag has a dependency on another flag (e.g., 'driver_declarations' requires 'expense_reimbursement'), when I attempt to enable it while the dependency is disabled, then the system shows a warning and offers to enable the dependency first
- Given I toggle a feature flag, when the change is saved, then connected clients receive the updated flag state within 30 seconds without requiring an app restart
- Given the Supabase connection is unavailable, when the app starts, then locally cached flag values are used as fallback with no user-visible error
Business Value
Different organisations are in different phases of adoption — HLF needs driver declarations while NHF does not; Blindeforbundet needs encrypted assignment dispatch while others do not. Feature flags allow phased rollouts that match each organisation's readiness, preventing premature exposure to complex workflows that could undermine user confidence. Gradual rollout percentages reduce risk of introducing breaking changes to all users simultaneously, protecting engagement metrics during the critical early adoption phase.
Components
- FeatureGate Widget ui
- Feature Flag Admin Screen ui
- Feature Flag Provider infrastructure
- Rollout Condition Evaluator service
- Feature Flag Repository data
- Feature Flag Local Cache data
- Feature Flag Key Constants infrastructure
- Feature Flag Initializer infrastructure
- Feature Flag Provider infrastructure