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

chore(release): pull release/v1.86.0 into main #3925

Merged
merged 24 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
53d2bef
feat: add support for getting anonymousId by note attributes array
yashasvibajpai Nov 19, 2024
e6077b2
chore: github action for unchanged commits fixed
vinayteki95 Nov 20, 2024
b5726d2
chore(release): pull main into develop post release v1.85.0 (#3891)
krishna2020 Nov 20, 2024
cd5e505
Merge branch 'develop' into chore.github-action-for-unchanged-commits
krishna2020 Nov 20, 2024
6ec379d
chore: github action for unchanged commits fixed (#3895)
vinayteki95 Nov 20, 2024
ed9fe55
chore(release): pull main into develop post release v1.85.1 (#3902)
krishna2020 Nov 21, 2024
a0d4efc
chore: allow only anonymousId set from note attributes
yashasvibajpai Nov 21, 2024
83c8f52
chore: add unit tests
yashasvibajpai Nov 25, 2024
5f80756
Merge branch 'develop' into feat.id.stitching.changes.shopify.pixel.app
yashasvibajpai Nov 26, 2024
70fa123
chore: address initialization comment
yashasvibajpai Dec 2, 2024
481d149
chore: update default case handling in facebook destinations (#3908)
sanpj2292 Dec 3, 2024
3eb5c55
chore: update function as per review suggestion
yashasvibajpai Dec 3, 2024
8a2a5c5
Merge branch 'develop' into feat.id.stitching.changes.shopify.pixel.app
krishna2020 Dec 5, 2024
b3f7140
chore: fix sonar issues
yashasvibajpai Dec 5, 2024
d7f390c
feat: add support for getting anonymousId by note attributes array (#…
krishna2020 Dec 6, 2024
4a77eda
chore: update repo name for staging deployment also (#3916)
yashasvibajpai Dec 6, 2024
f44f148
chore: add metrics for mailjet (#3917)
utsabc Dec 6, 2024
313710c
fix: remove redundant ids and userIdentifier when gbraid or wbraid ar…
ItsSudip Dec 6, 2024
12621c8
fix: skipping users events for snowpipe streaming (#3836)
achettyiitr Dec 9, 2024
ebcf84e
fix: braze subscription group fixes (#3901)
aashishmalik Dec 9, 2024
a246293
chore(release): 1.86.0
web-flow Dec 9, 2024
aa352ab
fix: removed console statement (#3927)
aashishmalik Dec 10, 2024
31e422c
chore: fix build workflow (#3928)
utsabc Dec 10, 2024
6a0f475
chore: fix build workflow (#3929)
utsabc Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Transformer Docker Image

Check warning on line 1 in .github/workflows/build-push-docker-image.yml

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.

on:
workflow_call:
Expand Down Expand Up @@ -96,15 +96,15 @@
with:
ref: ${{ needs.get_sha.outputs.sha }}
fetch-depth: 1

- name: Setup Docker Buildx
uses: docker/[email protected]


- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Setup Docker Buildx
uses: docker/[email protected]

- name: Build Docker Image
uses: docker/[email protected]
Expand Down Expand Up @@ -149,16 +149,16 @@
with:
ref: ${{ needs.get_sha.outputs.sha }}
fetch-depth: 1

- name: Setup Docker Buildx
uses: docker/[email protected]


- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Setup Docker Buildx
uses: docker/[email protected]

- name: Build Docker Image
uses: docker/[email protected]
with:
Expand Down Expand Up @@ -198,15 +198,15 @@
needs: [build-transformer-image-amd64, build-transformer-image-arm64]

steps:
- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Create multi-arch manifest
run: |
docker buildx imagetools create -t ${{ inputs.push_tags }} ${{ inputs.push_tags }}-amd64 ${{ inputs.push_tags }}-arm64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dt-test-and-report-code-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: DT Tests

Check warning on line 1 in .github/workflows/dt-test-and-report-code-coverage.yml

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.
on:
workflow_call:
secrets:
Expand Down Expand Up @@ -33,7 +33,7 @@
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
fetch-depth: 0

- name: Setup Node
uses: actions/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/prepare-for-staging-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Prepare for Staging Environment Deployment

Check warning on line 1 in .github/workflows/prepare-for-staging-deploy.yml

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.

on:
pull_request:
Expand Down Expand Up @@ -78,6 +78,7 @@
runs-on: ubuntu-latest
needs: [generate-tag-names, build-transformer-image, build-user-transformer-image]
env:
TF_IMAGE_REPOSITORY: rudderstack/rudder-transformer
TAG_NAME: ${{ needs.generate-tag-names.outputs.tag_name }}
UT_TAG_NAME: ${{ needs.generate-tag-names.outputs.tag_name_ut }}
steps:
Expand Down Expand Up @@ -113,6 +114,7 @@
git checkout -b $BRANCH_NAME

cd helm-charts/shared-services/per-az/environment/staging
yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" staging.yaml
yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" staging.yaml
yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" staging.yaml
git add staging.yaml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Verify

Check warning on line 1 in .github/workflows/verify.yml

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.

on:
pull_request:
Expand Down Expand Up @@ -35,8 +35,8 @@

- name: Filter JS/TS Files
run: |
echo "${{ steps.files.outputs.added_modified }}" | tr ' ' '\n' | grep -E '\.(js|ts|jsx|tsx)$' > changed_files.txt
if [ ! -s changed_files.txt ]; then
changed_files=$(echo "${{ steps.files.outputs.added_modified }}" | tr ' ' '\n' | grep -E '\.(js|ts|jsx|tsx)$' || true)
if [ -z "$changed_files" ]; then
echo "No JS/TS files to format or lint."
exit 0
fi
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.86.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.85.1...v1.86.0) (2024-12-09)


### Features

* add support for getting anonymousId by note attributes array ([53d2bef](https://github.com/rudderlabs/rudder-transformer/commit/53d2bef38ad5d7bc5504111ec797b3c3973546dd))
* add support for getting anonymousId by note attributes array ([#3893](https://github.com/rudderlabs/rudder-transformer/issues/3893)) ([d7f390c](https://github.com/rudderlabs/rudder-transformer/commit/d7f390cb471e44afb276484b8b804d1f257c539c))


### Bug Fixes

* braze subscription group fixes ([#3901](https://github.com/rudderlabs/rudder-transformer/issues/3901)) ([ebcf84e](https://github.com/rudderlabs/rudder-transformer/commit/ebcf84e07bf121d882c99df973af265a915a1ce1))
* remove redundant ids and userIdentifier when gbraid or wbraid are there ([#3910](https://github.com/rudderlabs/rudder-transformer/issues/3910)) ([313710c](https://github.com/rudderlabs/rudder-transformer/commit/313710ca725538e5ffe357216d9c88e444f995c8))
* skipping users events for snowpipe streaming ([#3836](https://github.com/rudderlabs/rudder-transformer/issues/3836)) ([12621c8](https://github.com/rudderlabs/rudder-transformer/commit/12621c8eee641f5a03a997e95ed016cff0eefde7))

### [1.85.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.85.0...v1.85.1) (2024-11-21)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.85.1",
"version": "1.86.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
18 changes: 18 additions & 0 deletions src/util/prometheus.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,24 @@ class Prometheus {
type: 'counter',
labelNames: ['destination_id'],
},
{
name: 'braze_batch_subscription_size',
help: 'braze_batch_subscription_size',
type: 'gauge',
labelNames: ['destination_id'],
},
{
name: 'braze_batch_subscription_combined_size',
help: 'braze_batch_subscription_combined_size',
type: 'gauge',
labelNames: ['destination_id'],
},
{
name: 'mailjet_packing_size',
help: 'mailjet_packing_size',
type: 'gauge',
labelNames: ['group'],
},
{
name: 'hs_batch_size',
help: 'hs_batch_size',
Expand Down
151 changes: 140 additions & 11 deletions src/v0/destinations/braze/braze.util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
getPurchaseObjs,
setAliasObject,
handleReservedProperties,
combineSubscriptionGroups,
} = require('./util');
const { processBatch } = require('./util');
const {
Expand Down Expand Up @@ -958,7 +959,9 @@ describe('processBatch', () => {
attributes: [{ id: i, name: 'test', xyz: 'abc' }],
events: [{ id: i, event: 'test', xyz: 'abc' }],
purchases: [{ id: i, purchase: 'test', xyz: 'abc' }],
subscription_groups: [{ id: i, group: 'test', xyz: 'abc' }],
subscription_groups: [
{ subscription_group_id: i, group: 'test', subscription_state: 'abc' },
],
merge_updates: [{ id: i, alias: 'test', xyz: 'abc' }],
},
},
Expand All @@ -972,7 +975,7 @@ describe('processBatch', () => {

// Assert that the response is as expected
expect(result.length).toBe(1); // One successful batched request and one failure response
expect(result[0].batchedRequest.length).toBe(6); // Two batched requests
expect(result[0].batchedRequest.length).toBe(8); // Two batched requests
expect(result[0].batchedRequest[0].body.JSON.partner).toBe('RudderStack'); // Verify partner name
expect(result[0].batchedRequest[0].body.JSON.attributes.length).toBe(75); // First batch contains 75 attributes
expect(result[0].batchedRequest[0].body.JSON.events.length).toBe(75); // First batch contains 75 events
Expand All @@ -981,10 +984,12 @@ describe('processBatch', () => {
expect(result[0].batchedRequest[1].body.JSON.attributes.length).toBe(25); // Second batch contains remaining 25 attributes
expect(result[0].batchedRequest[1].body.JSON.events.length).toBe(25); // Second batch contains remaining 25 events
expect(result[0].batchedRequest[1].body.JSON.purchases.length).toBe(25); // Second batch contains remaining 25 purchases
expect(result[0].batchedRequest[2].body.JSON.subscription_groups.length).toBe(50); // First batch contains 50 subscription group
expect(result[0].batchedRequest[3].body.JSON.subscription_groups.length).toBe(50);
expect(result[0].batchedRequest[4].body.JSON.merge_updates.length).toBe(50); // First batch contains 50 merge_updates
expect(result[0].batchedRequest[5].body.JSON.merge_updates.length).toBe(50); // First batch contains 25 merge_updates
expect(result[0].batchedRequest[2].body.JSON.subscription_groups.length).toBe(25); // First batch contains 25 subscription group
expect(result[0].batchedRequest[3].body.JSON.subscription_groups.length).toBe(25); // Second batch contains 25 subscription group
expect(result[0].batchedRequest[4].body.JSON.subscription_groups.length).toBe(25); // Third batch contains 25 subscription group
expect(result[0].batchedRequest[5].body.JSON.subscription_groups.length).toBe(25); // Fourth batch contains 25 subscription group
expect(result[0].batchedRequest[6].body.JSON.merge_updates.length).toBe(50); // First batch contains 50 merge_updates
expect(result[0].batchedRequest[7].body.JSON.merge_updates.length).toBe(50); // First batch contains 25 merge_updates
});

test('processBatch handles more than 75 attributes, events, and purchases with non uniform distribution', () => {
Expand Down Expand Up @@ -1055,7 +1060,9 @@ describe('processBatch', () => {
batchedRequest: {
body: {
JSON: {
subscription_groups: [{ id: i, group: 'test', xyz: 'abc' }],
subscription_groups: [
{ subscription_group_id: i, group: 'test', subscription_state: 'abc' },
],
},
},
},
Expand Down Expand Up @@ -1093,7 +1100,7 @@ describe('processBatch', () => {
// Assert that the response is as expected
expect(result.length).toBe(1); // One successful batched request and one failure response
expect(result[0].metadata.length).toBe(490); // Check the total length is same as input jobs (120 + 160 + 100 + 70 +40)
expect(result[0].batchedRequest.length).toBe(6); // Two batched requests
expect(result[0].batchedRequest.length).toBe(7); // Two batched requests
expect(result[0].batchedRequest[0].body.JSON.partner).toBe('RudderStack'); // Verify partner name
expect(result[0].batchedRequest[0].body.JSON.attributes.length).toBe(75); // First batch contains 75 attributes
expect(result[0].batchedRequest[0].body.JSON.events.length).toBe(75); // First batch contains 75 events
Expand All @@ -1103,9 +1110,10 @@ describe('processBatch', () => {
expect(result[0].batchedRequest[1].body.JSON.events.length).toBe(45); // Second batch contains remaining 45 events
expect(result[0].batchedRequest[1].body.JSON.purchases.length).toBe(75); // Second batch contains remaining 75 purchases
expect(result[0].batchedRequest[2].body.JSON.purchases.length).toBe(10); // Third batch contains remaining 10 purchases
expect(result[0].batchedRequest[3].body.JSON.subscription_groups.length).toBe(50); // First batch contains 50 subscription group
expect(result[0].batchedRequest[4].body.JSON.subscription_groups.length).toBe(20); // Second batch contains 20 subscription group
expect(result[0].batchedRequest[5].body.JSON.merge_updates.length).toBe(40); // First batch contains 40 merge_updates
expect(result[0].batchedRequest[3].body.JSON.subscription_groups.length).toBe(25); // First batch contains 25 subscription group
expect(result[0].batchedRequest[4].body.JSON.subscription_groups.length).toBe(25); // Second batch contains 25 subscription group
expect(result[0].batchedRequest[5].body.JSON.subscription_groups.length).toBe(20); // Third batch contains 20 subscription group
expect(result[0].batchedRequest[6].body.JSON.merge_updates.length).toBe(40); // First batch contains 50 merge_updates
});

test('check success and failure scenarios both for processBatch', () => {
Expand Down Expand Up @@ -1751,3 +1759,124 @@ describe('handleReservedProperties', () => {
});
});
});

describe('combineSubscriptionGroups', () => {
it('should merge external_ids, emails, and phones for the same subscription_group_id and subscription_state', () => {
const input = [
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
external_ids: ['id1', 'id2'],
emails: ['[email protected]', '[email protected]'],
phones: ['+1234567890', '+0987654321'],
},
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
external_ids: ['id2', 'id3'],
emails: ['[email protected]', '[email protected]'],
phones: ['+1234567890', '+1122334455'],
},
];

const expectedOutput = [
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
external_ids: ['id1', 'id2', 'id3'],
emails: ['[email protected]', '[email protected]', '[email protected]'],
phones: ['+1234567890', '+0987654321', '+1122334455'],
},
];

const result = combineSubscriptionGroups(input);
expect(result).toEqual(expectedOutput);
});

it('should handle groups with missing external_ids, emails, or phones', () => {
const input = [
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
external_ids: ['id1'],
},
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
emails: ['[email protected]'],
},
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
phones: ['+1234567890'],
},
];

const expectedOutput = [
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
external_ids: ['id1'],
emails: ['[email protected]'],
phones: ['+1234567890'],
},
];

const result = combineSubscriptionGroups(input);
expect(result).toEqual(expectedOutput);
});

it('should handle multiple unique subscription groups', () => {
const input = [
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
external_ids: ['id1'],
},
{
subscription_group_id: 'group2',
subscription_state: 'Unsubscribed',
external_ids: ['id2'],
emails: ['[email protected]'],
},
];

const expectedOutput = [
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
external_ids: ['id1'],
},
{
subscription_group_id: 'group2',
subscription_state: 'Unsubscribed',
external_ids: ['id2'],
emails: ['[email protected]'],
},
];

const result = combineSubscriptionGroups(input);
expect(result).toEqual(expectedOutput);
});

it('should not include undefined fields in the output', () => {
const input = [
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
external_ids: ['id1'],
},
];

const expectedOutput = [
{
subscription_group_id: 'group1',
subscription_state: 'Subscribed',
external_ids: ['id1'],
},
];

const result = combineSubscriptionGroups(input);
expect(result).toEqual(expectedOutput);
});
});
2 changes: 1 addition & 1 deletion src/v0/destinations/braze/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const IDENTIFY_BRAZE_MAX_REQ_COUNT = 50;
// https://www.braze.com/docs/api/endpoints/user_data/post_user_delete/

const ALIAS_BRAZE_MAX_REQ_COUNT = 50;
const SUBSCRIPTION_BRAZE_MAX_REQ_COUNT = 50;
const SUBSCRIPTION_BRAZE_MAX_REQ_COUNT = 25;

const DEL_MAX_BATCH_SIZE = 50;
const DESTINATION = 'braze';
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/braze/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ function processGroup(message, destination) {
);
}
subscriptionGroup.subscription_state = message.traits.subscriptionState;
subscriptionGroup.external_id = [message.userId];
subscriptionGroup.external_ids = [message.userId];
const phone = getFieldValueFromMessage(message, 'phone');
const email = getFieldValueFromMessage(message, 'email');
if (phone) {
Expand Down
Loading
Loading