Fix: IAM with NOT_EQUAL_TO trigger always shows up #2509
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.
Description
One Line Summary
Fix NOT_EQUAL_TO IAM triggers incorrectly evaluating to true when the trigger key does not exist.
Details
Motivation
There is a bug where any In-App Message trigger using the NOT_EQUAL_TO operator (e.g., "soup" IS NOT "pea") evaluates to true even when the trigger key ("soup") has never been set. This results in IAMs showing immediately on app startup even when no relevant trigger data is present.
Scope
This fix only affects the logic for evaluating IAM triggers when the trigger key is missing.
Other trigger operators (EXISTS, NOT_EXISTS, EQUAL_TO, numeric operators, dynamic triggers) are unaffected.
OPTIONAL - Other
The logic now aligns with user expectations and internal trigger design semantics.
This avoids IAMs unintentionally firing at session start and ensures consistent evaluation when triggers are present or absent.
Testing
Unit testing
Added unit tests for TriggerController. A few test cases are specifically testing the NOT_EQUAL_TO semantics.
Manual testing
Tested with Emulator Pixel 9 API 35.
Step to reproduce:
After fix, the IAM only shows up when a trigger with key "soup" and value being anything different than "pea" is added.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is