-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Android] "What’s New" promo message: Matching rules and excusion rules at card item level #7360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/ana/android_whats_new_promo_message_prompt_dispatcher_modal_coordinator
Are you sure you want to change the base?
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
2549ea7 to
f4be73c
Compare
384bda0 to
12cfe3c
Compare
1045448 to
51a045a
Compare
12cfe3c to
8528578
Compare
51a045a to
661ffa2
Compare
8528578 to
839f2eb
Compare
| val itemExclusion = if (cardItem.exclusionRules.isEmpty()) { | ||
| EvaluationResult.Fail | ||
| } else { | ||
| cardItem.exclusionRules.evaluateExclusionRules(message.id, rules) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Card item percentile rules use parent message ID
When evaluating card item rules in filterCardsListMessage, message.id is passed to evaluateMatchingRules and evaluateExclusionRules instead of cardItem.id. These functions use this ID for percentile cohort lookups via remoteMessagingCohortStore.getPercentile(messageId). This means all card items within a message share the same percentile cohort value, so if rules with targetPercentile are used on card items, they cannot have independent percentage-based rollouts - they'll all pass or fail together based on the message's percentile. If independent per-card percentile targeting is intended, the card item's own id would need to be passed instead.
Please tell me if this was useful or not with a 👍 or 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is probably correct. If there's a rule used by an item, we should pass the cardItem.id. We use that id to store the percentile and keep the logic deterministic.
The message will have its own percentile to decide % for the message. The item percentile should belong to them.
cmonfortep
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| } | ||
|
|
||
| @Test | ||
| fun whenCardsListMessageWithAllCardItemsFailingRulesThenReturnsNull() = runBlocking { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense, but checking with iOS if that was captured on the requirements.
| } | ||
|
|
||
| @Test | ||
| fun whenNonCardsListMessageThenReturnsMessageUnmodified() = runBlocking { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand the purpose of this test.
| val itemExclusion = if (cardItem.exclusionRules.isEmpty()) { | ||
| EvaluationResult.Fail | ||
| } else { | ||
| cardItem.exclusionRules.evaluateExclusionRules(message.id, rules) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is probably correct. If there's a rule used by an item, we should pass the cardItem.id. We use that id to store the percentile and keep the logic deterministic.
The message will have its own percentile to decide % for the message. The item percentile should belong to them.

Task/Issue URL: https://app.asana.com/1/137249556945/task/1212464602611971?focus=true
Description
Added support for per-card item matching and exclusion rules in the remote messaging system. This enhancement allows for more granular control over which card items are displayed within a CardsList message.
Steps to test this PR
Check the instructions for testing in the description of the task -> https://app.asana.com/1/137249556945/task/1212464602611971?focus=true
CardsList filtering
NO UI changes
Note
Adds per-card matching/exclusion rules for
CardsListmessages and filters list items accordingly, with JSON mapping updates and comprehensive tests.CardItemfields:matchingRules,exclusionRulesinremote-messaging-api.RemoteMessagingConfigMatcher, processContent.CardsListby evaluating eachCardItem'smatchingRules/exclusionRules.listItems; returnnullif all items are filtered; non-CardsListmessages unchanged.JsonListItemwithmatchingRules/exclusionRulesand map them inJsonRemoteMessageMapper.CardItemfields.Written by Cursor Bugbot for commit 839f2eb. This will update automatically on new commits. Configure here.