fix: start Ramps V2 init when remote feature flags hydrate cp-7.71.0#27778
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. |
Subscribe to RemoteFeatureFlagController:stateChange and retry unified buy V2 startup when flags become available after async fetch (e.g. fresh install). Register order subscriptions once; RampsController.init remains idempotent for repeated calls. Add unit test for flag hydration after stateChange. Made-with: Cursor
7a7a09f to
7df1623
Compare
…tion Made-with: Cursor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - draft PR All E2E tests pre-selected. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27778 +/- ##
==========================================
+ Coverage 77.80% 82.44% +4.63%
==========================================
Files 4802 4801 -1
Lines 123906 123800 -106
Branches 27594 27595 +1
==========================================
+ Hits 96410 102065 +5655
+ Misses 20523 14665 -5858
- Partials 6973 7070 +97 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
|
✅ E2E Fixture Validation — Schema is up to date |




Description
On a fresh install,
RemoteFeatureFlagControllerloads flags asynchronously while Engine builds controllers.rampsControllerInitpreviously read the unified buy V2 flag only once; if flags were not in state yet,RampsController.init()never ran, so buy token lists stayed empty until a full app restart.This change subscribes to
RemoteFeatureFlagController:stateChange(already delegated onRampsControllerInitMessenger) and re-runs the same V2 startup path when remote flag state updates. Order-status subscriptions are registered at most once.RampsController.init()remains idempotent for repeated calls.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-3350
Manual testing steps
Screenshots/Recordings
Fix Ramps controller not initializing on fresh install - Watch Video
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Adds a new subscription-driven initialization path triggered by
RemoteFeatureFlagController:stateChange, which can change startup behavior and potentially cause repeated init/polling if underlying idempotency assumptions are wrong.Overview
Ensures Unified Buy V2 startup runs even when remote feature flags hydrate after Engine/controller initialization by subscribing to
RemoteFeatureFlagController:stateChangeand re-checking the V2 flag.Refactors V2 startup into a helper that conditionally calls
RampsController.init()/startOrderPolling()and registers order-status subscriptions only once. Updates tests to cover the “flag off at startup then enabled on stateChange” scenario and to includesubscribein the thrown-state mock.Written by Cursor Bugbot for commit 78ff800. This will update automatically on new commits. Configure here.