Skip to content

Conversation

@cmonfortep
Copy link
Contributor

@cmonfortep cmonfortep commented Dec 17, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1212502267333651?focus=true

Description

Supports BE v2 features endpoint
Enables FE V2 messaging
Introduces FF for transition

Steps to test this PR

Feature 1

  • Fresh install internal release (or remove applicationIdSuffix ".debug" in build.gradle) so it can obtain subscripton products and plans from Play Store
  • skip onboarding
  • Navigate to settings
  • Ensure Subscription option visible
  • Purchase Subscription
  • Ensure all behave as usual (including duck.ai visibility)

Feature 2

  • Continue from Feature 1 test
  • Go to feature flag inventory -> enable tierMessagingEnabled
  • Go to settings
  • Ensure Subscription settings still present

Feature 3

  • Fresh install internal release (or remove applicationIdSuffix ".debug" in build.gradle) so it can obtain subscripton products and plans from Play Store
  • skip onboarding
  • Navigate to settings
  • Ensure Subscription option visible
  • Go to feature flag inventory -> enable tierMessagingEnabled
  • Go to settings
  • Ensure Subscription option visible
  • Purchase Subscription
  • Ensure all behave as usual (including duck.ai visibility)

UI changes

Before After
!(Upload before screenshot) (Upload after screenshot)

Note

Introduces tier-based subscriptions with V2 features and minimal-risk fallback.

  • Adds featuresV2 fetch via SubscriptionsCachedService and maps to Entitlement; persists per-plan entitlements in new subscriptionEntitlements store with Moshi adapters
  • New FF tierMessagingEnabled (default ON) to: fetch/store V2 entitlements, expose FE capability in getFeatureConfig, and serve new getSubscriptionTierOptions JS message
  • Updates SubscriptionsManager/SubscriptionOffer to use entitlements (and tier) while keeping features as a derived, backward-compatible view; getFeatures() now maps from entitlements
  • AuthRepository.getFeatures gracefully falls back to V1 features when V2 absent; legacy feature derivation retained when flag OFF
  • Removes unused useClientWithCacheForFeatures FF; expands tests across manager, repository, fetcher, messaging, and UI view models to cover V2 and fallback paths

Written by Cursor Bugbot for commit 28bc230. This will update automatically on new commits. Configure here.

@cmonfortep
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

return@withContext subscriptionsDataStore.subscriptionFeatures
?.let(featuresAdapter::fromJson)
?.get(basePlanId) ?: emptySet()
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing V2 fallback when tier flag toggled OFF

The flag transition logic has an asymmetry that could cause issues during rollback. When tierMessagingEnabled is ON, getFeatures falls back from V2 to V1 if V2 is empty. However, when the flag is OFF, it only reads from V1 with no fallback to V2. Combined with the fetcher which exclusively populates V2 when flag is ON (and V1 when flag is OFF), this means: if a user's app ran with the flag ON (V2 populated, V1 empty), and the flag is later toggled OFF remotely, getFeatures returns an empty set until the app restarts and the fetcher repopulates V1. This could temporarily hide subscription offers from affected users during emergency flag rollbacks.


Please tell me if this was useful or not with a 👍 or 👎.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected scenario: Users are in legacy version, we will enable FF for v2.

  • Transition should work
  • We offer a fallback to cover FF change during runtime

Moving from v2 -> v1, not expected. If happens, restarting the app will fix. I think tradeoff is acceptable

@cmonfortep cmonfortep force-pushed the feature/cristian/migrate_subscription_v2_messaging branch from 2178318 to 8e20b1c Compare December 17, 2025 17:18
* with the new tier-based payload structure supporting Plus/Pro tiers.
* The flag is exposed to FE via getFeatureConfig.
*/
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planning to change this to True before merging. Keeping false to facilitate testing scenario.

Copy link
Contributor

@lmac012 lmac012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works as expected 👌

@cmonfortep cmonfortep force-pushed the feature/cristian/migrate_subscription_v2_messaging branch from 8e20b1c to f9ac1f5 Compare January 4, 2026 10:31
@cmonfortep cmonfortep force-pushed the feature/cristian/migrate_subscription_v2_messaging branch from f9ac1f5 to 28bc230 Compare January 4, 2026 11:07
@cmonfortep cmonfortep merged commit 9f13c9f into develop Jan 4, 2026
10 checks passed
@cmonfortep cmonfortep deleted the feature/cristian/migrate_subscription_v2_messaging branch January 4, 2026 14:22
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.

2 participants