Repository navigation
feat: add endpoint path to Braze response objects - #4677
Conversation
- Modified endpoint functions to return both endpoint URL and path - Updated identify, track, subscription group, and alias merge endpoints - Enhanced response structure for better debugging and monitoring
Summary by CodeRabbit
WalkthroughEndpoint resolver functions in Braze now return an object with endpoint and path. Call sites in transform, util, and identity resolution code are updated to extract and propagate both fields, including setting response.endpointPath. Tests are adjusted to mock and assert the new structure. One helper signature (buildResponse) is updated. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Msg as Message
participant Cfg as Destination Config
participant Res as Endpoint Resolver
participant Tx as Transform/Util
participant HTTP as HTTP Client
Msg->>Tx: Build request payload
Tx->>Cfg: Read baseEndpoint
Tx->>Res: get*EndPoint(baseEndpoint)
Res-->>Tx: { endpoint, path }
Note over Tx: Assign response.endpoint and response.endpointPath
Tx->>HTTP: POST endpoint (uses endpointPath for metadata)
HTTP-->>Tx: Response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Suggestions
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4677 +/- ##
========================================
Coverage 91.78% 91.79%
========================================
Files 642 642
Lines 33976 34006 +30
Branches 8034 8042 +8
========================================
+ Hits 31186 31215 +29
+ Misses 2560 2539 -21
- Partials 230 252 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/v0/destinations/braze/identityResolutionUtils.ts (1)
70-71: Use returned path instead of hardcoding endpointPath; normalize leading slashYou already resolve the identify endpoint via getIdentifyEndpoint. Also destructure path and pass it through to endpointPath to keep telemetry consistent with the rest of the Braze flows.
Apply:
- const { endpoint } = getIdentifyEndpoint(getEndpointFromConfig(destination)); + const { endpoint, path } = getIdentifyEndpoint(getEndpointFromConfig(destination)); @@ { destType: 'braze', feature: 'transformation', requestMethod: 'POST', module: 'router', - endpointPath: '/users/identify', + endpointPath: path?.startsWith('/') ? path : `/${path}`, },Please confirm there are no other hardcoded occurrences of '/users/identify' left in this package. I can provide a repo scan script if needed.
Also applies to: 79-95
src/v0/destinations/braze/transform.js (2)
202-206: Derive endpointPath from config instead of hardcoding; normalize leading slashAlign identify flow with the rest by using the returned path instead of a string literal. This prevents drift if the path changes in config.
- const { endpoint } = getIdentifyEndpoint(getEndpointFromConfig(destination)); + const { endpoint, path } = getIdentifyEndpoint(getEndpointFromConfig(destination)); @@ - endpointPath: '/users/identify', + endpointPath: path?.startsWith('/') ? path : `/${path}`,Also applies to: 219-221
389-392: Normalize endpointPath to a single conventionTo keep observability keys consistent with other destinations, ensure a leading slash or standardize in config.
- response.endpointPath = path; + response.endpointPath = path?.startsWith('/') ? path : `/${path}`;src/v0/destinations/braze/util.js (1)
444-447: Normalize endpointPath format (ensure leading slash) for consistent telemetrypath can be provided both with and without a leading
/, producing inconsistent telemetry keys — normalize before assigning to response.endpointPath. Example local fix:
response.endpointPath = path?.startsWith('/') ? path :/${path}Apply in src/v0/destinations/braze/util.js at the response.endpointPath assignments (around lines 444–447, 452–455, 561–564). Prefer standardizing config paths to include a leading slash if possible.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
test/integrations/destinations/braze/processor/data.tsis excluded by!**/test/**test/integrations/destinations/braze/router/data.tsis excluded by!**/test/**test/integrations/destinations/braze/router/identityResolution.tsis excluded by!**/test/**
📒 Files selected for processing (5)
src/v0/destinations/braze/config.js(1 hunks)src/v0/destinations/braze/identityResolutionUtils.test.ts(51 hunks)src/v0/destinations/braze/identityResolutionUtils.ts(2 hunks)src/v0/destinations/braze/transform.js(3 hunks)src/v0/destinations/braze/util.js(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit configuration file
Focus on ESLint errors (max 3) and warnings (max 5).
Files:
src/v0/destinations/braze/config.jssrc/v0/destinations/braze/transform.jssrc/v0/destinations/braze/util.js
🧠 Learnings (2)
📚 Learning: 2025-05-29T13:29:39.436Z
Learnt from: maheshkutty
PR: rudderlabs/rudder-transformer#4359
File: src/v0/util/index.js:2272-2272
Timestamp: 2025-05-29T13:29:39.436Z
Learning: The `combineBatchRequestsWithSameJobIds` function in `src/v0/util/index.js` is used by both Mixpanel and Google AdWords Offline Conversions destinations in production. The function assumes metadata is always an array in multiple operations (forEach, filter, sort, map) and needs defensive programming to handle non-array metadata cases to prevent runtime errors.
Applied to files:
src/v0/destinations/braze/util.js
📚 Learning: 2024-07-27T07:02:57.329Z
Learnt from: anantjain45823
PR: rudderlabs/rudder-transformer#2842
File: src/v1/sources/shopify/identifierEventsLayer.test.js:5-40
Timestamp: 2024-07-27T07:02:57.329Z
Learning: The `processIdentifierEvent` function in `identifierEventsLayer.test.js` is designed to succeed for any input, hence no negative test cases are required.
Applied to files:
src/v0/destinations/braze/identityResolutionUtils.test.ts
🧬 Code graph analysis (5)
src/v0/destinations/braze/identityResolutionUtils.ts (2)
src/v0/destinations/braze/transform.js (1)
getIdentifyEndpoint(202-202)src/v0/destinations/braze/util.js (1)
getEndpointFromConfig(55-78)
src/v0/destinations/braze/config.js (2)
src/v0/destinations/braze/transform.js (2)
getIdentifyEndpoint(202-202)getSubscriptionGroupEndPoint(389-389)src/v0/destinations/braze/util.js (3)
getTrackEndPoint(539-539)getSubscriptionGroupEndPoint(452-452)getAliasMergeEndPoint(444-444)
src/v0/destinations/braze/transform.js (4)
src/v0/destinations/google_adwords_offline_conversions/utils.js (3)
endpointDetails(239-242)endpointDetails(319-322)endpointDetails(400-403)src/v0/util/index.js (2)
defaultRequestConfig(462-476)path(11-11)src/v0/destinations/braze/util.js (2)
getEndpointFromConfig(55-78)getSubscriptionGroupEndPoint(452-452)src/adapters/network.js (1)
handleHttpRequest(424-429)
src/v0/destinations/braze/util.js (2)
src/v0/destinations/braze/transform.js (4)
response(55-55)response(388-388)response(454-454)getSubscriptionGroupEndPoint(389-389)src/v0/destinations/snapchat_custom_audience/networkHandler.js (1)
response(44-51)
src/v0/destinations/braze/identityResolutionUtils.test.ts (4)
src/adapters/utils/networkUtils.js (1)
getDynamicErrorType(87-95)src/v0/destinations/braze/util.js (6)
collectStatsForAliasFailure(783-815)getEndpointFromConfig(55-78)_(2-2)i(120-120)i(148-148)i(540-540)src/v0/destinations/braze/transform.js (1)
getIdentifyEndpoint(202-202)src/types/controlPlaneConfig.ts (1)
Destination(31-49)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Code Coverage
- GitHub Check: test_and_publish
- GitHub Check: UT Tests
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
src/v0/destinations/braze/transform.js (1)
54-69: buildResponse: good migration to endpointDetailsAccepts endpointDetails and sets endpoint and endpointPath cleanly. Call sites are updated accordingly.
src/v0/destinations/braze/identityResolutionUtils.test.ts (1)
153-164: Tests & mocks are consistent — no change required nowgetIdentifyEndpoint() returns path 'users/identify' (no leading slash); callers pass endpointPath '/users/identify' to handleHttpRequest and tests mock the former while asserting the latter — current state is consistent. If you later standardize on a leading slash in config.path, update the mocked getIdentifyEndpoint return values to '/users/identify' (or instead normalize in callers and adjust expectations).
src/v0/destinations/braze/config.js (1)
12-17: Standardize returned path strings with a leading slashReturn leading-slash paths from braze config; braze callers set response.endpoint from the full URL and only assign response.endpointPath = path (no extra concatenation), so this change is safe and aligns endpointPath formatting across the codebase.
function getIdentifyEndpoint(baseEndpoint) { return { endpoint: `${baseEndpoint}/users/identify`, - path: 'users/identify', + path: '/users/identify', }; } function getTrackEndPoint(baseEndpoint) { return { endpoint: `${baseEndpoint}/users/track`, - path: 'users/track', + path: '/users/track', }; } function getSubscriptionGroupEndPoint(baseEndpoint) { return { endpoint: `${baseEndpoint}/v2/subscription/status/set`, - path: 'v2/subscription/status/set', + path: '/v2/subscription/status/set', }; } function getAliasMergeEndPoint(baseEndpoint) { return { endpoint: `${baseEndpoint}/users/merge`, - path: 'users/merge', + path: '/users/merge', }; }
|

What are the changes introduced in this PR?
Enhanced Braze destination endpoint functions to return both the full endpoint URL and the path component for better debugging and monitoring capabilities.
What is the related Linear task?
Resolves https://linear.app/rudderstack/issue/INT-4102/add-endpoint-path-details-in-rudder-transformer-for-top-15
Please explain the objectives of your changes below
Modified endpoint functions (identify, track, subscription group, and alias merge) to return structured objects containing both the complete endpoint URL and the path component. This improves debugging capabilities and provides better visibility into which specific Braze API endpoints are being called.
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
The endpoint functions now return objects with
endpointandpathproperties instead of just the URL string. This is a non-breaking change as theendpointproperty contains the same URL that was previously returned.Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
Modified endpoint utility functions in
config.jsto return structured response objects.Any technical or performance related pointers to consider with the change?
No performance impact. The change only affects the structure of returned data, not the actual API calls.
@coderabbitai review
Developer checklist
Reviewer checklist