Skip to content

fix: Guard against nil customerID in AppsFlyer updateCustomerUserIDIfNeededForUser#694

Open
nickolas-dimitrakas wants to merge 1 commit intoworkstation/9.0-Releasefrom
fix/appsflyer-nil-check-customer-id
Open

fix: Guard against nil customerID in AppsFlyer updateCustomerUserIDIfNeededForUser#694
nickolas-dimitrakas wants to merge 1 commit intoworkstation/9.0-Releasefrom
fix/appsflyer-nil-check-customer-id

Conversation

@nickolas-dimitrakas
Copy link
Copy Markdown
Contributor

@nickolas-dimitrakas nickolas-dimitrakas commented Mar 31, 2026

Background

What Has Changed

  • Guard setCustomerUserID: with customerId.length so it is only called when a valid, non-empty CUID is available, consistent with the existing guard pattern used in routeCommerceEvent: and routeEvent:
  • Add FilteredMParticleUserMock for testing identity lifecycle callbacks
  • Add unit tests for onIdentifyComplete, onLoginComplete, onLogoutComplete, and onModifyComplete covering MPID mode, CustomerId mode, legacy mode, and nil/empty CUID scenarios

Checklist

  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have tested this locally.

Reference Issue (For employees only. Ignore if you are an outside contributor)

  • NO JIRA

@nickolas-dimitrakas nickolas-dimitrakas requested a review from a team as a code owner March 31, 2026 21:01
@cursor
Copy link
Copy Markdown

cursor bot commented Mar 31, 2026

PR Summary

Low Risk
Low risk: adds a simple length guard around setCustomerUserID and introduces unit tests to validate behavior across identity callbacks.

Overview
Prevents the AppsFlyer kit from overwriting/clearing an existing AppsFlyer customer user ID by only calling setCustomerUserID when customerIDForAppsFlyer returns a non-empty value in updateCustomerUserIDIfNeededForUser.

Adds a FilteredMParticleUserMock and new unit tests validating that identity callbacks (onIdentifyComplete, onLoginComplete, onLogoutComplete, onModifyComplete) set the customer user ID in MPID/CustomerId modes, and do not set it when the customer ID is missing/empty or when running in legacy mode.

Written by Cursor Bugbot for commit 280d922. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

📦 SDK Size Impact Report

Measures how much the SDK adds to an app's size (with-SDK minus without-SDK).

Metric Target Branch This PR Change
App Bundle Impact 1.66 MB 1.66 MB +N/A
Executable Impact 896 bytes 896 bytes +N/A
XCFramework Size 5.47 MB 5.47 MB +N/A

➡️ SDK size impact change is minimal.

Raw measurements

Target branch (workstation/9.0-Release):

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1788,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1704,"sdk_executable_impact_bytes":896,"xcframework_size_kb":5604}

This PR:

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1788,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1704,"sdk_executable_impact_bytes":896,"xcframework_size_kb":5604}

@nickolas-dimitrakas nickolas-dimitrakas force-pushed the fix/appsflyer-nil-check-customer-id branch from cdf0c99 to a9dc7f2 Compare March 31, 2026 21:17
…lback tests

Revert to customerId.length guard per AppsFlyer's documented pattern of
skipping setCustomerUserID when no valid CUID is available, rather than
passing an empty string. Add unit tests for identity lifecycle callbacks
(onIdentifyComplete, onLoginComplete, onLogoutComplete, onModifyComplete)
covering MPID mode, CustomerId mode, legacy mode, and nil/empty scenarios.

Made-with: Cursor
@nickolas-dimitrakas nickolas-dimitrakas force-pushed the fix/appsflyer-nil-check-customer-id branch from a9dc7f2 to 280d922 Compare March 31, 2026 21:40
@nickolas-dimitrakas nickolas-dimitrakas self-assigned this Mar 31, 2026
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.

1 participant