[Conditions] Update JSON keys#3168
Conversation
|
The backward-compat scenario that motivates this PR — old-format JSON like This works because Same gap for Opened #3172 against this branch adding those tests. |
…#3172) ## Summary - Adds tests verifying that old-format JSON with extra `operator`+`value` fields (e.g. `{"type": "intro_offer", "operator": "=", "value": true}`) correctly deserializes to the plain `IntroOffer`/`PromoOffer` objects, silently ignoring the extra fields. - This is the key backward-compat scenario that #3168 exists to solve, and it wasn't explicitly tested. ## Test plan - [x] `ComponentOverridesTests` pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: test-only change that adds coverage for backward-compatible JSON deserialization behavior without modifying production code. > > **Overview** > Adds parameterized test cases in `ComponentOverridesTests` to verify backward compatibility: legacy `intro_offer`/`promo_offer` condition JSON that includes extra `operator`/`value` fields is accepted and deserializes to `Condition.IntroOffer`/`Condition.PromoOffer` (silently ignoring the extra fields). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2a1a829. 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>
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, enable autofix in the Cursor dashboard.
|
Nit (pre-existing, not introduced by this PR): the Not a blocker, but worth a comment or a TODO if it's intentional defense-in-depth. |
facumenzella
left a comment
There was a problem hiding this comment.
Let's try this out!! a few nits
Right, that's changing and not going to |
d26ef51
into
cesar/conditional-configurability
Updates conditions to not reuse the old
intro_offerandpromo_offerones. This way old SDKs behave as expected when a newer paywall with conditions sends some of the new ones.Note
Medium Risk
Medium risk because it changes condition JSON deserialization keys and runtime evaluation for offer-based overrides, which could cause overrides to stop applying if payloads or clients are mismatched. Backward compatibility is partially maintained for legacy
intro_offer/promo_offerobjects, but new payloads must use the renamed*_conditiontypes.Overview
Updates the paywall override condition schema to avoid reusing legacy condition keys.
intro_offer/promo_offerare now plain boolean conditions (no operator/value), while new typesintro_offer_conditionandpromo_offer_conditioncarryoperator+value.Renames the JSON
typekeys for parameterized conditions fromselected_packageandvariabletoselected_package_conditionandvariable_condition, and updatesConditionSerializermappings plus UI-side condition evaluation to match. Tests are adjusted to cover legacy payload tolerance (extra fields ignored forintro_offer/promo_offer) and the new*_conditiontypes.Written by Cursor Bugbot for commit 918d463. This will update automatically on new commits. Configure here.