From 9f5b95a3104869d3503840ae926561f86a0459a3 Mon Sep 17 00:00:00 2001 From: Jae Kim Date: Tue, 26 May 2026 11:47:10 -0700 Subject: [PATCH 1/6] [AI-FSSDK] [FSSDK-12670] Block ODP identify event for single identifier --- lib/odp/odp_manager.spec.ts | 12 ++++-------- lib/odp/odp_manager.ts | 9 +++++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/odp/odp_manager.spec.ts b/lib/odp/odp_manager.spec.ts index 9ae0daf69..3cc8c4532 100644 --- a/lib/odp/odp_manager.spec.ts +++ b/lib/odp/odp_manager.spec.ts @@ -618,7 +618,7 @@ describe('DefaultOdpManager', () => { expect(identifiers).toEqual(new Map([['fs_user_id', 'user'], ['vuid', 'vuid_a']])); }); - it('sends identified event when called with just fs_user_id in first parameter', async () => { + it('does not send identified event when called with just fs_user_id (single identifier)', async () => { const eventManager = getMockOdpEventManager(); eventManager.onRunning.mockReturnValue(Promise.resolve()); @@ -634,12 +634,10 @@ describe('DefaultOdpManager', () => { await odpManager.onRunning(); odpManager.identifyUser('user'); - expect(mockSendEvents).toHaveBeenCalledOnce(); - const { identifiers } = mockSendEvents.mock.calls[0][0]; - expect(identifiers).toEqual(new Map([['fs_user_id', 'user']])); + expect(mockSendEvents).not.toHaveBeenCalled(); }); - it('sends identified event when called with just vuid in first parameter', async () => { + it('does not send identified event when called with just vuid (single identifier)', async () => { const eventManager = getMockOdpEventManager(); eventManager.onRunning.mockReturnValue(Promise.resolve()); @@ -655,9 +653,7 @@ describe('DefaultOdpManager', () => { await odpManager.onRunning(); odpManager.identifyUser('vuid_a'); - expect(mockSendEvents).toHaveBeenCalledOnce(); - const { identifiers } = mockSendEvents.mock.calls[0][0]; - expect(identifiers).toEqual(new Map([['vuid', 'vuid_a']])); + expect(mockSendEvents).not.toHaveBeenCalled(); }); it('should reject onRunning() if stopped in new state', async () => { diff --git a/lib/odp/odp_manager.ts b/lib/odp/odp_manager.ts index 7525d0efb..de474427c 100644 --- a/lib/odp/odp_manager.ts +++ b/lib/odp/odp_manager.ts @@ -15,7 +15,7 @@ */ import { v4 as uuidV4} from 'uuid'; -import { LoggerFacade } from '../logging/logger'; +import { LoggerFacade, LogLevel } from '../logging/logger'; import { OdpIntegrationConfig, odpIntegrationsAreEqual } from './odp_config'; import { OdpEventManager } from './event_manager/odp_event_manager'; @@ -212,7 +212,7 @@ export class DefaultOdpManager extends BaseService implements OdpManager { identifyUser(userId: string, vuid?: string): void { const identifiers = new Map(); - + let finalUserId: Maybe = userId; let finalVuid: Maybe = vuid; @@ -229,6 +229,11 @@ export class DefaultOdpManager extends BaseService implements OdpManager { identifiers.set(ODP_USER_KEY.FS_USER_ID, finalUserId); } + if (identifiers.size < 2) { + this.logger.log(LogLevel.Debug, 'ODP identify event is not dispatched (only one identifier provided).'); + return; + } + const event = new OdpEvent(ODP_DEFAULT_EVENT_TYPE, ODP_EVENT_ACTION.IDENTIFIED, identifiers); this.sendEvent(event); } From d915792766ca1686d8627f88f361d9ae90680dfb Mon Sep 17 00:00:00 2001 From: Jae Kim Date: Wed, 27 May 2026 09:38:43 -0700 Subject: [PATCH 2/6] [FSSDK-12670] Address review feedback: fix log message --- lib/odp/odp_manager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/odp/odp_manager.ts b/lib/odp/odp_manager.ts index de474427c..af180b6ae 100644 --- a/lib/odp/odp_manager.ts +++ b/lib/odp/odp_manager.ts @@ -230,7 +230,7 @@ export class DefaultOdpManager extends BaseService implements OdpManager { } if (identifiers.size < 2) { - this.logger.log(LogLevel.Debug, 'ODP identify event is not dispatched (only one identifier provided).'); + this.logger.log(LogLevel.Debug, 'ODP identify event is not dispatched (fewer than 2 valid identifiers).'); return; } From 7157a236c79e310bb6057c1ad5538d76bb7f33ad Mon Sep 17 00:00:00 2001 From: Jae Kim Date: Wed, 27 May 2026 10:00:12 -0700 Subject: [PATCH 3/6] [FSSDK-12670] Retrigger CI From 7bf6ec3044110162914f1f0c035c2b7e50ae51c4 Mon Sep 17 00:00:00 2001 From: Jae Kim Date: Wed, 27 May 2026 13:49:06 -0700 Subject: [PATCH 4/6] [FSSDK-12670] Add comment explaining the < 2 identifiers guard Co-Authored-By: Claude Opus 4.6 --- lib/odp/odp_manager.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/odp/odp_manager.ts b/lib/odp/odp_manager.ts index af180b6ae..4fedaf734 100644 --- a/lib/odp/odp_manager.ts +++ b/lib/odp/odp_manager.ts @@ -229,6 +229,8 @@ export class DefaultOdpManager extends BaseService implements OdpManager { identifiers.set(ODP_USER_KEY.FS_USER_ID, finalUserId); } + // Identify requires 2+ identifiers to link (e.g., vuid + fs_user_id). + // A single identifier has no cross-reference value and generates unnecessary traffic. if (identifiers.size < 2) { this.logger.log(LogLevel.Debug, 'ODP identify event is not dispatched (fewer than 2 valid identifiers).'); return; From 3cd4a5d5a47126b8af2e15af29cb52f01913df3b Mon Sep 17 00:00:00 2001 From: Jae Kim Date: Wed, 27 May 2026 16:38:03 -0700 Subject: [PATCH 5/6] [FSSDK-12670] retrigger CI From 90c30495e6ccc82d60ec3b7e90b355c6fb12f025 Mon Sep 17 00:00:00 2001 From: Raju Ahmed Date: Mon, 1 Jun 2026 18:33:46 +0600 Subject: [PATCH 6/6] fixes --- lib/message/log_message.ts | 1 + lib/odp/odp_manager.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/message/log_message.ts b/lib/message/log_message.ts index 2e9180535..39a5e33fd 100644 --- a/lib/message/log_message.ts +++ b/lib/message/log_message.ts @@ -69,6 +69,7 @@ export const INVALIDATE_CMAB_CACHE = 'Invalidating CMAB cache for user %s and ru export const CMAB_CACHE_HIT = 'Cache hit for user %s and rule %s.'; export const CMAB_CACHE_ATTRIBUTES_MISMATCH = 'CMAB cache attributes mismatch for user %s and rule %s, fetching new decision.'; export const CMAB_CACHE_MISS = 'Cache miss for user %s and rule %s.'; +export const ODP_IDENTIFY_NOT_DISPATCHED= 'ODP identify event is not dispatched (fewer than 2 valid identifiers).' export const messages: string[] = []; diff --git a/lib/odp/odp_manager.ts b/lib/odp/odp_manager.ts index 4fedaf734..2eb9c2e16 100644 --- a/lib/odp/odp_manager.ts +++ b/lib/odp/odp_manager.ts @@ -32,6 +32,7 @@ import { Maybe } from '../utils/type'; import { sprintf } from '../utils/fns'; import { SERVICE_STOPPED_BEFORE_RUNNING } from '../service'; import { Platform } from '../platform_support'; +import { ODP_IDENTIFY_NOT_DISPATCHED } from '../message/log_message'; export interface OdpManager extends Service { updateConfig(odpIntegrationConfig: OdpIntegrationConfig): boolean; @@ -232,7 +233,7 @@ export class DefaultOdpManager extends BaseService implements OdpManager { // Identify requires 2+ identifiers to link (e.g., vuid + fs_user_id). // A single identifier has no cross-reference value and generates unnecessary traffic. if (identifiers.size < 2) { - this.logger.log(LogLevel.Debug, 'ODP identify event is not dispatched (fewer than 2 valid identifiers).'); + this.logger?.debug(ODP_IDENTIFY_NOT_DISPATCHED); return; }