Skip to content

Conversation

@praveek
Copy link
Contributor

@praveek praveek commented Aug 4, 2025

Currently readyForEvent in Identity extension checks whether non empty configuration shared state is present for each incoming event. This usually works fine because Core sets a valid cached Configuration when the app starts. However, we found an edge case: if the app launches for the very first time with no internet connection and no pre-bundled configuration, the SDK might start with an empty configuration.

This leads to a scenario where Identity hangs, even after the network is restored and a valid configuration is later downloaded. This is because the readyForEvent continues to validate against the initially empty Configuration state as newer shared states having higher versions.

One potential solution would be to simply verify whether the shared state is set, without checking its contents. However, this is also unnecessary, as readyForEvent is invoked for every event (including unrelated ones), resulting in unnecessary reading of configuration shared state.

To resolve this, the code has been updated to eliminate the shared state checks for events unrelated to the Identity extension.

This was injected in iOS and later ported to Android.

@codecov
Copy link

codecov bot commented Aug 4, 2025

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.65%. Comparing base (e293431) to head (a3b603a).
⚠️ Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
...e/marketing/mobile/identity/IdentityExtension.java 88.89% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #789      +/-   ##
============================================
- Coverage     75.67%   75.65%   -0.01%     
+ Complexity     2348     2345       -3     
============================================
  Files           219      219              
  Lines         10902    10897       -5     
  Branches       1414     1411       -3     
============================================
- Hits           8249     8244       -5     
+ Misses         2026     2024       -2     
- Partials        627      629       +2     
Flag Coverage Δ
android-functional-tests 28.61% <0.00%> (+<0.01%) ⬆️
android-unit-tests 64.47% <88.89%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...e/marketing/mobile/identity/IdentityExtension.java 84.15% <88.89%> (+0.60%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

} else {
return true;
}
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for a valid Configuration is still needed for the block above (lines 213-232) for appendToUrl and getUrlVariables. The logic for that block relied on the Configuration state check if the block evaluated to true and did not return false due to the Analytics state check. If the current Configuration state is not set then appendToUrl/getUrlVariables won't necessarily fail, but they may not include the org ID in their responses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add an explicit configuration check but the behaviour now is same as before. The forceSyncIdentifiers call only succeeds if the SDK has a valid configuration that includes an org-id. Right now, we only check the shared state in the context of the specific event, and the call is assumed to always pass if forceSyncIdentifiers succeeds. In this particular case, we had a valid (but empty) configuration, which will allow the call to proceed, but the org-id was still missing.

I think we should reconsider the broader approach of how we validate states in readyForEvent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see your point. Adding this check back for configuration is just checking the configuration wasn't cleared which isn't really possible, so it's not necessary. Sorry for the confusion, you can roll back your last commit if you want.

@praveek praveek requested a review from kevinlind August 5, 2025 23:48
} else {
return true;
}
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see your point. Adding this check back for configuration is just checking the configuration wasn't cleared which isn't really possible, so it's not necessary. Sorry for the confusion, you can roll back your last commit if you want.

@praveek praveek merged commit 7b2dc9e into adobe:dev Aug 15, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants