[Rules] Render default paywall instead of fallback for unsupported conditions#3175
Merged
vegaro merged 9 commits intoMar 5, 2026
Conversation
…ed rules When an unsupported condition is encountered, instead of falling back to the generic fallback paywall, the SDK now renders the same components paywall with only base condition overrides applied, stripping all rule-based overrides. Also renames IntroOfferCondition/PromoOfferCondition to IntroOfferRule/PromoOfferRule and adds Condition.isRule to distinguish rule conditions from base conditions.
c5d8028 to
8ca3d9b
Compare
Generated by 🚫 Danger |
Merged
5 tasks
Member
|
As discussed in private, we need to handle this globally (not per component) |
…component The unsupported condition check now scans the entire component tree before building styles. If any component has an unsupported condition, all rule-based overrides are stripped across the entire paywall via a stripRules flag passed through StyleFactory to toPresentedOverrides. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
facumenzella
reviewed
Mar 5, 2026
Comment on lines
+96
to
+98
| public data class Unsupported( | ||
| val originalType: String, | ||
| ) : Condition { override val isRule: Boolean get() = true } |
Member
Author
There was a problem hiding this comment.
good, will change, I had some doubts as well
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed:
Unsupported.isRuleis false, bypassing stripRules filteringComponentOverride.Condition.Unsupportednow overridesisRuleto true sostripRulescorrectly removes unsupported-condition overrides.
Or push these changes by commenting:
@cursor push 50ed4e7368
Preview (50ed4e7368)
diff --git a/purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/common/ComponentOverride.kt b/purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/common/ComponentOverride.kt
--- a/purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/common/ComponentOverride.kt
+++ b/purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/common/ComponentOverride.kt
@@ -95,7 +95,7 @@
@Serializable
public data class Unsupported(
val originalType: String,
- ) : Condition
+ ) : Condition { override val isRule: Boolean get() = true }
}
}
facumenzella
reviewed
Mar 5, 2026
facumenzella
reviewed
Mar 5, 2026
|
|
||
| @Test | ||
| fun `Should fall back to legacy paywall if override contains unsupported condition`() { | ||
| fun `Should render default paywall with legacy overrides when unsupported condition is present`() { |
Member
There was a problem hiding this comment.
Could we add an integration test here to verify the global strip behavior, not just that we stay on PaywallValidationResult.Components?
facumenzella
approved these changes
Mar 5, 2026
facumenzella
left a comment
Member
There was a problem hiding this comment.
Just a few nits, looks great
7 of 25 checks passed
vegaro
added a commit
that referenced
this pull request
Mar 5, 2026
…nditions (#3175) When an unsupported condition is encountered, instead of falling back to the generic fallback paywall, the SDK now renders the same components paywall with only base condition overrides applied, stripping all rule-based overrides. Also renames `IntroOfferCondition`/`PromoOfferCondition` to `IntroOfferRule`/`PromoOfferRule` and adds `Condition.isRule` to distinguish rule conditions from base conditions. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Alters runtime paywall rendering/override selection when unknown conditions are encountered, which may change UI behavior for some configurations. Logic is well-covered by new traversal and override-filtering tests, but impacts core presentation paths. > > **Overview** > **Unsupported condition handling is softened:** when any `ComponentOverride.Condition.Unsupported` is detected anywhere in the components tree, the SDK now renders the components paywall but *strips all overrides that use rule-based conditions* (plus the unsupported ones), leaving only base-condition overrides. > > This introduces `Condition.isRule` and renames `IntroOfferCondition`/`PromoOfferCondition` to `IntroOfferRule`/`PromoOfferRule`, updates condition evaluation/serialization accordingly, removes the `UnsupportedCondition` validation error pathway, and adds a recursive `containsUnsupportedCondition()` scan with expanded unit test coverage. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ba8a4cb. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

When an unsupported condition is encountered, instead of falling back to the generic fallback paywall, the SDK now renders the same components paywall with only base condition overrides applied, stripping all rule-based overrides.
Also renames
IntroOfferCondition/PromoOfferConditiontoIntroOfferRule/PromoOfferRuleand addsCondition.isRuleto distinguish rule conditions from base conditions.Note
Medium Risk
Alters runtime paywall rendering/override selection when unknown conditions are encountered, which may change UI behavior for some configurations. Logic is well-covered by new traversal and override-filtering tests, but impacts core presentation paths.
Overview
Unsupported condition handling is softened: when any
ComponentOverride.Condition.Unsupportedis detected anywhere in the components tree, the SDK now renders the components paywall but strips all overrides that use rule-based conditions (plus the unsupported ones), leaving only base-condition overrides.This introduces
Condition.isRuleand renamesIntroOfferCondition/PromoOfferConditiontoIntroOfferRule/PromoOfferRule, updates condition evaluation/serialization accordingly, removes theUnsupportedConditionvalidation error pathway, and adds a recursivecontainsUnsupportedCondition()scan with expanded unit test coverage.Written by Cursor Bugbot for commit ba8a4cb. This will update automatically on new commits. Configure here.