chore: implement rewards version guard#27664
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Fix bug Fetch client minimum version from backend Fix lint
d34c22a to
d48e6ad
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag Selection Rationale:
No E2E tests specifically for Rewards were found in the test directories, so these tags cover the closest related test suites. The risk is medium because the changes are additive but include a refactoring of the Redux reset logic that could introduce regressions in state management. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| unlockedRewards: action.payload.rewards.unlockedRewards, | ||
| campaigns: action.payload.rewards.campaigns, | ||
| campaignParticipantStatuses: | ||
| action.payload.rewards.campaignParticipantStatuses, |
There was a problem hiding this comment.
Rehydration sets campaigns to undefined for upgrading users
High Severity
The persist/REHYDRATE handler now explicitly assigns campaigns and campaignParticipantStatuses from the persisted payload. For users upgrading from an older app version where these fields were never persisted, action.payload.rewards.campaigns will be undefined. Since explicit undefined values override spread defaults, the resulting state will have campaigns: undefined instead of campaigns: [] (from ...initialState). Any downstream code calling .map(), .length, or iterating over campaigns will throw a runtime error.
| state.versionGuardMinimumMobileVersion, | ||
| versionGuardLoading: state.versionGuardLoading, | ||
| versionGuardError: state.versionGuardError, | ||
| }); |
There was a problem hiding this comment.
Subscription ID change now resets previously preserved state fields
Medium Severity
The setCandidateSubscriptionId reducer was refactored from a whitelist (reset specific fields) to a blacklist (Object.assign with initialState, preserve listed fields). This silently changes behavior: campaigns, campaignParticipantStatuses, seasonStatusLoading, seasonStatusError, and several other loading/error fields are now reset on subscription change when they were previously preserved. Notably, campaigns is likely not subscription-scoped, so clearing it causes unnecessary data loss and potential UI flicker.
|
✅ E2E Fixture Validation — Schema is up to date |
|





Description
https://consensyssoftware.atlassian.net/browse/RWDS-1119
Fetch minimum required client versions from backend and prompt user to update if app version is not met
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Adds a backend-driven minimum-version check that can block entry into the Rewards flow and introduces new API/messenger wiring plus Redux state to support it. Risk is moderate because it changes navigation behavior and introduces a new network call/caching path in the Rewards controller/data service.
Overview
Adds a Rewards version guard: the app fetches minimum client version requirements from a new public Rewards API endpoint and stores them in Redux, then uses
selectIsRewardsVersionBlockedto determine if the current app version is allowed.When blocked,
RewardsNavigatornow short-circuits normal navigation/rendering and shows a newRewardsUpdateRequiredscreen with an update CTA (App Store/Play Store) and new MetaMetrics events for view/click tracking.Extends the Rewards engine stack (data service + controller + messenger + types) with
getClientVersionRequirements, adds version-guard reducers/selectors and tests, and refactors candidate subscription ID reset logic to preserve the new version-guard fields (plus other non-subscription-scoped state).Written by Cursor Bugbot for commit 3c9d911. This will update automatically on new commits. Configure here.