From 3247a74a12c65bfeb513184f6696c8307a0c50cb Mon Sep 17 00:00:00 2001 From: Raju Ahmed Date: Fri, 26 Jun 2026 22:46:48 +0600 Subject: [PATCH] [AI-FSSDK] [FSSDK-12750] Use attribute id instead of key for CMAB prediction requests --- .../decision_service/cmab/cmab_service.spec.ts | 14 +++++++------- lib/core/decision_service/cmab/cmab_service.ts | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/core/decision_service/cmab/cmab_service.spec.ts b/lib/core/decision_service/cmab/cmab_service.spec.ts index 38ee205e4..fa3c3615f 100644 --- a/lib/core/decision_service/cmab/cmab_service.spec.ts +++ b/lib/core/decision_service/cmab/cmab_service.spec.ts @@ -96,8 +96,8 @@ describe('DefaultCmabService', () => { expect(ruleIdArg).toEqual(ruleId); expect(userIdArg).toEqual(userContext.getUserId()); expect(attributesArg).toEqual({ - country: 'US', - age: '25', + '66': 'US', + '77': '25', }); }); @@ -124,13 +124,13 @@ describe('DefaultCmabService', () => { expect(mockCmabClient.fetchDecision).toHaveBeenCalledTimes(2); expect(mockCmabClient.fetchDecision.mock.calls[0][2]).toEqual({ - country: 'US', - age: '25', - language: 'en', + '66': 'US', + '77': '25', + '88': 'en', }); expect(mockCmabClient.fetchDecision.mock.calls[1][2]).toEqual({ - country: 'US', - gender: 'male' + '66': 'US', + '99': 'male' }); }); diff --git a/lib/core/decision_service/cmab/cmab_service.ts b/lib/core/decision_service/cmab/cmab_service.ts index 004a146c0..2e613b4fd 100644 --- a/lib/core/decision_service/cmab/cmab_service.ts +++ b/lib/core/decision_service/cmab/cmab_service.ts @@ -182,9 +182,9 @@ export class DefaultCmabService implements CmabService { cmabAttributeIds.forEach((aid) => { const attribute = projectConfig.attributeIdMap[aid]; - + if (userAttributes.hasOwnProperty(attribute.key)) { - filteredAttributes[attribute.key] = userAttributes[attribute.key]; + filteredAttributes[aid] = userAttributes[attribute.key]; } });