Make WinbackOfferEligibilityCalculator testable#6866
Conversation
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.
Reviewed by Cursor Bugbot for commit d4d5922. Configure here.
|
| Name | Version | Download | Change | Install | Change | Approval |
|---|---|---|---|---|---|---|
| RevenueCat com.revenuecat.PaywallsTester |
1.0 (1) | 18.1 MB | ⬆️ 50.9 kB (0.28%) | 64.9 MB | ⬆️ 197.2 kB (0.31%) | N/A |
| BinarySizeTest com.revenuecat.binary-size-test.local-source |
1.0 (1) | 4.1 MB | ⬆️ 17.9 kB (0.44%) | 12.4 MB | ⬆️ 44.0 kB (0.36%) | ⏳ Needs approval |
| BinarySizeTest com.revenuecat.binary-size-test.cocoapods |
1.0 (1) | 6.2 MB | ⬆️ 25.0 kB (0.4%) | 27.3 MB | ⬆️ 93.6 kB (0.35%) | ⏳ Needs approval |
| BinarySizeTest com.revenuecat.binary-size-test.spm |
1.0 (1) | 4.2 MB | ⬆️ 17.1 kB (0.41%) | 10.8 MB | ⬆️ 39.5 kB (0.37%) | ⏳ Needs approval |
RevenueCat 1.0 (1)
com.revenuecat.PaywallsTester
⚖️ Compare build
⏱️ Analyze build performance
Total install size change: ⬆️ 197.2 kB (0.31%)
Total download size change: ⬆️ 50.9 kB (0.28%)
Largest size changes
| Item | Install Size Change |
|---|---|
| DYLD.String Table | ⬆️ 73.2 kB |
| 📝 RCInstallmentsInfo.Objc Metadata | ⬆️ 8.8 kB |
| Code Signature | ⬆️ 5.1 kB |
| DYLD.Exports | ⬆️ 4.6 kB |
| RevenueCat.ProductsManager.ProductsManager | ⬆️ 3.7 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.local-source
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 44.0 kB (0.36%)
Total download size change: ⬆️ 17.9 kB (0.44%)
Largest size changes
| Item | Install Size Change |
|---|---|
| DYLD.String Table | ⬆️ 3.2 kB |
| 📝 RevenueCat.WinBackOfferEligibilityCalculator.winbackOffersByID(fo... | ⬆️ 2.2 kB |
| 📝 RCInstallmentsInfo.Objc Metadata | ⬆️ 2.1 kB |
| DYLD.Exports | ⬆️ 1.8 kB |
| Swift.Sequence.compactMap | ⬇️ -1.4 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.cocoapods
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 93.6 kB (0.35%)
Total download size change: ⬆️ 25.0 kB (0.4%)
Largest size changes
| Item | Install Size Change |
|---|---|
| DYLD.String Table | ⬆️ 35.4 kB |
| Code Signature | ⬆️ 2.3 kB |
| 📝 RevenueCat.WinBackOfferEligibilityCalculator.winbackOffersByID(fo... | ⬆️ 2.3 kB |
| 📝 RCInstallmentsInfo.Objc Metadata | ⬆️ 2.1 kB |
| DYLD.Exports | ⬆️ 1.7 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.spm
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 39.5 kB (0.37%)
Total download size change: ⬆️ 17.1 kB (0.41%)
Largest size changes
| Item | Install Size Change |
|---|---|
| 📝 RevenueCat.WinBackOfferEligibilityCalculator.winbackOffersByID(fo... | ⬆️ 2.2 kB |
| 📝 RCInstallmentsInfo.Objc Metadata | ⬆️ 2.1 kB |
| DYLD.Exports | ⬆️ 1.8 kB |
| Swift.Sequence.compactMap | ⬇️ -1.4 kB |
| Code Signature | ⬆️ 1.2 kB |
🛸 Powered by Emerge Tools
Comment trigger: Size diff threshold of 100.00kB exceeded
|
I got verbal approval for this from @JZDesign in slack - will go ahead and merge through to the dev branch |
6f763f0
into
winback-offer-eligibility





Description
Make the
WinbackOfferEligibilityCalculatortestable by removing its direct dependencies on StoreKit classes.Note
Medium Risk
Changes how win-back offers are resolved for subscriptions (purchase-relevant), but it is largely a structural refactor with new coverage; incorrect adapter mapping could change which offers are returned.
Overview
Refactors win-back offer eligibility so
WinBackOfferEligibilityCalculatorruns on internal, StoreKit-free protocols instead ofProduct/StoreProducttypes directly. A newWinBackEligibilityAdapters.swiftmaps real StoreKit subscription data into those protocols at the public entry point; eligibility rules (purchased ownership, renewal IDs, billing-plan filtering on iOS 26.4+) stay the same but are easier to unit test.Adds
WinBackOfferEligibilityCalculatorTestswith mocks covering empty/error paths, offer ordering, missing offers, and billing-plan / pricing-term filtering when the newer APIs are available.Reviewed by Cursor Bugbot for commit 7c2c53a. Bugbot is set up for automated code reviews on this repo. Configure here.