Design a Feature Configuration Personalization Service
Select the highest-priority feature configurations for users based on mutable group membership.
Design a service where a feature has prioritized JSON configurations and each configuration targets one or more user groups. A user may belong to multiple groups. getConfigsForFeature(featureName, userId, topConfigCount) returns at most the requested number of qualifying configurations.
Support adding and removing group members plus creating and updating configurations. For this exercise, assume results use priority descending and then configuration ID for a deterministic tie, a negative topConfigCount is rejected, and no match returns an empty list.
Define the model, contracts, and one consistency approach for high scale, then implement the selection method or precise executable pseudocode.