Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle subaccount case in gaec #3876

Open
wants to merge 2 commits into
base: hotfix/13112024
Choose a base branch
from

Conversation

aashishmalik
Copy link
Contributor

@aashishmalik aashishmalik commented Nov 13, 2024

What are the changes introduced in this PR?

handle subaccount is false but loginCustomerId is present in config

What is the related Linear task?

Resolves INT-XXX

Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

N/A

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

Any technical or performance related pointers to consider with the change?

N/A

@coderabbitai review


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

@devops-github-rudderstack
Copy link
Contributor

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.02%. Comparing base (d76c37d) to head (4c674df).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           hotfix/13112024    #3876      +/-   ##
===================================================
- Coverage            89.04%   89.02%   -0.03%     
===================================================
  Files                  610      610              
  Lines                32982    32958      -24     
  Branches              7797     7787      -10     
===================================================
- Hits                 29370    29340      -30     
+ Misses                3329     3305      -24     
- Partials               283      313      +30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

const filteredLoginCustomerId = removeHyphens(loginCustomerId);
response.headers['login-customer-id'] = filteredLoginCustomerId;
if (
(isDefined(Config.subAccount) && Config.subAccount === true) ||
Copy link
Collaborator

@krishna2020 krishna2020 Nov 13, 2024

Choose a reason for hiding this comment

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

This logic is based on new UI - so it shouldn't depend on old UI field of subAccount but should depend on new UI field configData

Copy link
Collaborator

Choose a reason for hiding this comment

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

And raise PR to hotfix branch

Copy link
Collaborator

@krishna2020 krishna2020 Nov 13, 2024

Choose a reason for hiding this comment

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

In that case, if configDetails object is not null, you shouldn't execute old logic - right now code is messed up where both old & new flows will be executed once UI is migrated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

{ rudderAccountId: '25u5whFH7gVTnCiAjn4ykoCLGoC', listOfConversions: ['Page View', 'Product Added'], authStatus: 'active', subAccount: false, configData: '{"customerId": "1234567890"}', customerId: '1234567890', loginCustomerId: '12345', },

updated code, once migration is done will remove old code that is kept as to be backward compatible

@aashishmalik aashishmalik changed the base branch from main to hotfix/13112024 November 13, 2024 11:23
if (isDefinedAndNotNull(configData)) {
const configDetails = JSON.parse(configData);
configDetails = JSON.parse(configData);
customerId = configDetails.customerId;
if (isDefined(configDetails.loginCustomerId)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this code piece is not needed

@@ -45,8 +45,9 @@ const responseBuilder = async (metadata, message, { Config }, payload) => {
let { customerId, loginCustomerId } = Config;
const { configData } = Config;

let configDetails = {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

why let --> you are not updating the variable twice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

earlier was reassigning it so used let, now using ternary condition and const

@@ -70,6 +71,7 @@ const responseBuilder = async (metadata, message, { Config }, payload) => {
'developer-token': getValueFromMessage(metadata, 'secret.developer_token'),
};
response.params = { event, customerId: filteredCustomerId };

if (subAccount) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

here add additional condition to execute this logic only if !isDefined(configDetails.loginCustomerId)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Copy link

sonarcloud bot commented Nov 13, 2024

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