Skip to content

fix (moengage): handled obj-case find method fuzzy traits method calling#846

Merged
joe-ayoub-segment merged 2 commits intosegmentio:masterfrom
moengage:fix/moengage-obj-case-find-traits
Apr 16, 2026
Merged

fix (moengage): handled obj-case find method fuzzy traits method calling#846
joe-ayoub-segment merged 2 commits intosegmentio:masterfrom
moengage:fix/moengage-obj-case-find-traits

Conversation

@adityagupta-7
Copy link
Copy Markdown
Contributor

@adityagupta-7 adityagupta-7 commented Mar 26, 2026

What does this PR do?

  • it fixes an issue occurring for moengage user attribute tracking. obj-case library's find method does fuzzy matching of property. for example, userName will get matched with username. but because there is no identify.userName() in segment, it was causing error.

Are there breaking changes in this PR?

  • No

Testing

  • Testing completed successfully
  • Have added new tests regarding obj-case find method's fuzzy matching.

Existing Unit Tests

Since the existing unit tests for several integrations are not in good shape, developers are expected to fix
them for the integration they are working/touch on.
Please ensure the following before submitting a PR:

  • Fixed all the existing unit tests for the integration touched.

Any background context you want to provide?

  • We were expecting userName to be tracked as custom user attribute as it would be a custom trait from segment. But because obj-case's find method fuzzy matches keys, identify.userName() (for example) was getting executed which causes error. Now, we with these changes, we can track userName and user_name as standard user attribute along with the expected username.

Is there parity with the server-side/android/iOS integration components (if applicable)?

  • N/A

Does this require a new integration setting? If so, please explain how the new setting works

  • No

Links to helpful docs and other external resources

@joe-ayoub-segment
Copy link
Copy Markdown
Contributor

deployed to stage. Verified correct code in stage (minimized).
image

@joe-ayoub-segment
Copy link
Copy Markdown
Contributor

joe-ayoub-segment commented Apr 16, 2026

Proof of successful test in stage during call with Aditya

image

@joe-ayoub-segment joe-ayoub-segment merged commit 9257f39 into segmentio:master Apr 16, 2026
5 checks passed
@sayan-das-in sayan-das-in requested a review from Copilot April 16, 2026 13:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a MoEngage identify trait-mapping bug caused by obj-case’s fuzzy key matching, which previously could trigger calls to non-existent identify.<trait>() methods and throw errors.

Changes:

  • Update MoEngage semantic trait mapping to use obj-case.find(...)’s returned mapping value and the iterated trait value, avoiding dynamic identify[key]() calls.
  • Add unit tests covering semantic trait mapping across different casing/separator conventions (camelCase, snake_case, kebab-case).
  • Bump the MoEngage integration version and add a changelog entry.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
integrations/moengage/lib/index.js Fixes semantic trait mapping logic to safely handle fuzzy-matched keys without calling missing identify[key]() methods.
integrations/moengage/test/index.test.js Adds coverage for case/separator variations of common semantic traits.
integrations/moengage/package.json Bumps integration version to 1.0.9.
integrations/moengage/HISTORY.md Adds a 1.0.9 changelog entry describing the fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread integrations/moengage/lib/index.js
Comment thread integrations/moengage/lib/index.js
Comment thread integrations/moengage/HISTORY.md
AnkitSegment added a commit that referenced this pull request Apr 17, 2026
commit 3e04f5f
Author: Ankit Gupta <ankit.gupta@segment.com>
Date:   Fri Apr 17 14:01:41 2026 +0530

    Update package version

commit a2b2265
Author: Ankit Gupta <ankit.gupta@segment.com>
Date:   Fri Apr 17 13:50:41 2026 +0530

    Updated dynamic sdk from static

commit 9257f39
Author: Aditya Gupta <97892100+adityagupta-7@users.noreply.github.com>
Date:   Thu Apr 16 13:57:44 2026 +0530

    fix (moengage): handled obj-case find method fuzzy traits method calling (#846)

    * fix: handled obj-case find method fuzzy traits method calling

    * fix: updated history md file

commit d41432e
Author: Ankit Gupta <139338151+AnkitSegment@users.noreply.github.com>
Date:   Thu Mar 5 10:05:00 2026 +0530

    Upgrade aws-sdk v2 to @aws-sdk/client-s3 v3  (#844)

    * Upgraded new aws version from v2 to v3

    * Removed git command from pipeline

    * updated upload-assets file

    * updated upload-assets file

commit 8019caa
Author: Joe Ayoub <45374896+joe-ayoub-segment@users.noreply.github.com>
Date:   Wed Feb 11 15:28:33 2026 +0000

    Updating GTM tests (#841)

    * Updating GTM tests

    * updating tests

commit 81cf68d
Author: Joe Ayoub <45374896+joe-ayoub-segment@users.noreply.github.com>
Date:   Tue Feb 10 06:31:10 2026 +0000

    Gtm bugfix2 (#840)

    * fixing bug for gtm custom domain

    * package bump

commit 5729cd6
Author: Joe Ayoub <45374896+joe-ayoub-segment@users.noreply.github.com>
Date:   Mon Feb 2 07:59:15 2026 +0000

    Bump Google Tag Manager to v2.5.2 (#839)

    Version bump to deploy the fullURLpath changes from commit 78fd671. The previous commit modified code but didn't bump the version, causing the new code to overwrite cached 2.5.1 assets that have a 1-year immutable cache policy.

    Co-authored-by: Claude (us.anthropic.claude-sonnet-4-5-20250929-v1:0) <noreply@anthropic.com>

commit 78fd671
Author: Joe Ayoub <45374896+joe-ayoub-segment@users.noreply.github.com>
Date:   Tue Jan 27 06:44:16 2026 +0000

    STRATCONN-6010 - [GTM - Classic] - full domain with file path (#838)

commit 503687d
Author: Joe Ayoub <45374896+joe-ayoub-segment@users.noreply.github.com>
Date:   Mon Jan 26 07:44:07 2026 +0000

    STRATCONN-5638 - [GTM] - domain configuration support (#836)

commit b62fc34
Author: Arjun Bhandage <abhandage@twilio.com>
Date:   Tue Jan 20 16:48:01 2026 +0530

    (non-prod) STRATCONN-6104: fix the pipeline to run all tests on master and remove publish step (#834)

    * chore: specify yarn package manager version in package.json

    * test

    * test

    * fix: enhance CI pipeline with master-specific build and test steps, remove publish step

    * Apply suggestions from code review

    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

    * fix: correct argument order in test-master script for consistency

    * address comment

    ---------

    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

commit 8ea51e1
Author: VWO Integration <53477775+vwointegration@users.noreply.github.com>
Date:   Wed Sep 10 13:25:09 2025 +0530

    feat: add experiment name to VWO tracking data (#829)

    Co-authored-by: Rohit Tyagi <rohittyagi@WINDELLAP-1217.local>

commit 2470fd9
Author: Arjun Bhandage <abhandage@twilio.com>
Date:   Wed Jul 30 17:34:03 2025 +0530

    STRATCONN-5792: Remove vulnerable dependency from several destinations. (#828)

    * STRATCONN-5792: Remove vulnerable dependency from several destinations.

    * update

    * untouch other dependencies

commit adef8c3
Author: Ankit Gupta <139338151+AnkitSegment@users.noreply.github.com>
Date:   Wed Jul 16 12:14:04 2025 +0530

    Updated twitter ads version to 2.5.3 (#827)

commit 04cbb18
Author: Ankit Gupta <139338151+AnkitSegment@users.noreply.github.com>
Date:   Wed Jul 16 12:05:22 2025 +0530

    [Main] Update bing ads version 2.0.3 (#826)

    * Updated condition for undefined consentSettings

    * Update the version

commit af58163
Author: Ankit Gupta <139338151+AnkitSegment@users.noreply.github.com>
Date:   Wed Jul 16 11:55:41 2025 +0530

    Updated condition for undefined consentSettings (#825)

commit ec9a19d
Author: Arjun Bhandage <abhandage@twilio.com>
Date:   Thu Jul 10 14:56:34 2025 +0530

    STRATCONN-5950: Upgrade twitter-ads sdk (#824)

    * STRATCONN-5950: Upgrade twitter-ads sdk

    * update version

commit 8ab0178
Author: Ankit Gupta <139338151+AnkitSegment@users.noreply.github.com>
Date:   Wed Apr 30 19:11:59 2025 +0530

    [STRATCONN-5687] Added support for bing ads consent mode (#822)

    * Updated Bing ads consent

    * Updated Bing ads consent

    * Updated unit test cases and handle other cases

    * Updated unit test cases

    ---------

    Co-authored-by: Daniel Jackins <djackins@twilio.com>
    Co-authored-by: Harsh Joshi <harsh.joshi@segment.com>

commit 786b989
Author: Ankit Gupta <139338151+AnkitSegment@users.noreply.github.com>
Date:   Thu Apr 24 15:12:53 2025 +0530

    Revert "Added adStorage consent in bing ads (#819)" (#820)

    This reverts commit 5954107.

commit 5954107
Author: Ankit Gupta <139338151+AnkitSegment@users.noreply.github.com>
Date:   Tue Apr 22 16:07:07 2025 +0530

    Added adStorage consent in bing ads (#819)
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