refactor: reduce filteredMparticleUser cognitive complexity for Sonar - #1336
Conversation
PR SummaryLow Risk Overview Kit blocking and forwarder attribute/identity filters still run in the same order. Array attributes continue to be copied so kits cannot mutate store values. Adds Jest coverage for missing store data, kit-blocked keys/identities, factory vs method-argument filters, and identity-type-to-name mapping. Reviewed by Cursor Bugbot for commit 64bda99. Bugbot is set up for automated code reviews on this repo. Configure here. |
902aa71 to
45900ca
Compare
8716d89 to
53eeece
Compare
53eeece to
824c5df
Compare
Match Sonar and keep the same allow-when-missing-blocker behavior for attributes and identities.
Add Jest coverage for MPID, attribute/list copies, kit blocking, and identity mapping so the filtered user object is not only hit via forwarder integration tests.
Match existing Jest it() naming in this repo.
…ters Drop the overlapping identity mapping test, split kit-block vs omit-blocker, and assert factory-then-method list filters plus Rokt-style missing userIdentityFilters.
824c5df to
346350a
Compare
Co-authored-by: Cris Ryan Tan <crisryantan@gmail.com>
Co-authored-by: Cris Ryan Tan <crisryantan@gmail.com>
fix types Co-authored-by: Cris Ryan Tan <crisryantan@gmail.com>
Optional kitBlocker? before required key fails TS1016. Match isIdentityAllowed: KitBlocker | undefined, same runtime.
|
…#1336) * refactor: reduce filteredMparticleUser cognitive complexity for Sonar * refactor: use optional chaining for kit blocker allow checks Match Sonar and keep the same allow-when-missing-blocker behavior for attributes and identities. * test: unit-cover filteredMparticleUser kit and forwarder filtering Add Jest coverage for MPID, attribute/list copies, kit blocking, and identity mapping so the filtered user object is not only hit via forwarder integration tests. * test: prefix filteredMparticleUser cases with should Match existing Jest it() naming in this repo. * test: dedupe filteredMparticleUser cases and cover dual forwarder filters Drop the overlapping identity mapping test, split kit-block vs omit-blocker, and assert factory-then-method list filters plus Rokt-style missing userIdentityFilters. * Apply suggestion from @crisryantan Co-authored-by: Cris Ryan Tan <crisryantan@gmail.com> * Apply suggestion from @crisryantan Co-authored-by: Cris Ryan Tan <crisryantan@gmail.com> * Apply suggestion from @crisryantan fix types Co-authored-by: Cris Ryan Tan <crisryantan@gmail.com> * fix: type kitBlocker as possibly undefined before required key Optional kitBlocker? before required key fails TS1016. Match isIdentityAllowed: KitBlocker | undefined, same runtime. --------- Co-authored-by: Cris Ryan Tan <crisryantan@gmail.com>
|
🎉 This PR is included in version 2.79.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |



Background
filteredMparticleUserJS → TS migration PR.What Has Changed
isAttributeKeyAllowed,buildUserAttributesCopy,buildFilteredUserIdentities, etc.)continue/ helper extraction to satisfy Sonar cognitive complexity limitsScreenshots/Video
Checklist
Additional Notes
refactor/SDKE-1193-migrate-filteredMparticleUser-to-TS(migration-only).development(or merge the stack in order).Reference Issue (For employees only. Ignore if you are an outside contributor)