Repository navigation
feat: introduce endpointPath for iterable - #4599
Conversation
Summary by CodeRabbit
WalkthroughAdds an optional Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor SDK as Event
participant TR as transform.js
participant UT as util.js
participant BP as BatchProcessors
participant RB as ResponseBuilder
SDK->>TR: send message
TR->>UT: getCategoryWithEndpoint(message)
UT-->>TR: { name, action, endpoint, endpointPath }
alt batched
TR->>BP: process*Batch(..., endpoint, endpointPath)
BP->>BP: combineBatchedAndNonBatchedEvents(...)\nset batchedRequest.endpoint & endpointPath
BP-->>RB: batched request (with endpointPath)
else non-batched
TR-->>RB: single request (with endpoint & endpointPath)
end
RB-->>SDK: ProcessorTransformationOutput { endpointPath, ... }
note right of UT: endpointPath newly propagated alongside endpoint
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Suggested improvements: add a small unit test asserting ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/types/destinationTransformation.ts (1)
40-53: Add endpointPath to BatchedRequest to keep batch typings consistentcombineBatchedAndNonBatchedEvents now sets batchedRequest.endpointPath. To avoid TS friction for processor/batch paths, include endpointPath in BatchedRequest too.
export type BatchedRequest< TPayload = Record<string, unknown>, THeaders = Record<string, unknown>, TParams = Record<string, unknown>, > = { body: BatchedRequestBody<TPayload>; version: string; type: string; method: string; endpoint: string; + endpointPath?: string; headers: THeaders; params: TParams; files: Record<string, never>; };
🧹 Nitpick comments (6)
src/v0/destinations/iterable/transform.js (1)
95-99: Default endpointPath if category.endpointPath is missingDefensive fallback avoids undefined when a category forgets to set endpointPath. Low risk and future-proof.
response.endpoint = category.action === 'catalogs' ? getCatalogEndpoint(category, message) : category.endpoint; - response.endpointPath = category.endpointPath; + const pathFromEndpoint = + (typeof category.endpoint === 'string' && category.endpoint.split('/api/')[1]) || undefined; + response.endpointPath = category.endpointPath || pathFromEndpoint;src/v0/destinations/iterable/util.test.js (1)
892-956: Good assertions for endpointPath; consider adding batch-path checksNice coverage for getCategoryUsingEventName. Add tests to assert endpointPath is set on batched responses too (users/bulkUpdate, events/trackBulk) from processUpdateUserBatch/processTrackBatch.
src/v0/destinations/iterable/util.js (4)
68-72: LGTM: expose endpointPath alongside endpointSourced from categoryConfig.endpoint keeps it region-agnostic. Consider trimming leading slashes to normalize paths (nit).
const getCategoryWithEndpoint = (categoryConfig, dataCenter) => ({ ...categoryConfig, endpoint: constructEndpoint(dataCenter, categoryConfig), - endpointPath: categoryConfig.endpoint, + endpointPath: String(categoryConfig.endpoint).replace(/^\/+/, ''), });
451-458: Avoid scattering batch path literalsThese path strings will get reused; move them to config (e.g., BATCH_ENDPOINT_PATHS) or constants in this module.
- const endpointPath = 'users/bulkUpdate'; + const endpointPath = BATCH_ENDPOINT_PATHS.IDENTIFY; // e.g., { IDENTIFY: 'users/bulkUpdate' }
528-538: Catalog batch: propagate stable endpointPathReading endpointPath from message keeps throttling key stable across items. LGTM. Consider asserting it exists and defaulting to 'catalogs' if absent.
620-627: Same constantization for track bulk pathMirror the identify-bulk suggestion: centralize 'events/trackBulk' to avoid typos and ease future changes.
- const endpointPath = 'events/trackBulk'; + const endpointPath = BATCH_ENDPOINT_PATHS.TRACK; // e.g., { TRACK: 'events/trackBulk' }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (7)
test/integrations/destinations/iterable/dataDelivery/business.tsis excluded by!**/test/**test/integrations/destinations/iterable/processor/aliasTestData.tsis excluded by!**/test/**test/integrations/destinations/iterable/processor/identifyTestData.tsis excluded by!**/test/**test/integrations/destinations/iterable/processor/pageScreenTestData.tsis excluded by!**/test/**test/integrations/destinations/iterable/processor/trackTestData.tsis excluded by!**/test/**test/integrations/destinations/iterable/router/data.tsis excluded by!**/test/**test/integrations/testUtils.tsis excluded by!**/test/**
📒 Files selected for processing (4)
src/types/destinationTransformation.ts(2 hunks)src/v0/destinations/iterable/transform.js(1 hunks)src/v0/destinations/iterable/util.js(6 hunks)src/v0/destinations/iterable/util.test.js(4 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/iterable/transform.jssrc/v0/destinations/iterable/util.test.jssrc/v0/destinations/iterable/util.js
🧠 Learnings (1)
📚 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/iterable/util.js
🧬 Code graph analysis (1)
src/v0/destinations/iterable/util.js (1)
src/v0/destinations/iterable/config.js (1)
constructEndpoint(74-77)
🔇 Additional comments (3)
src/types/destinationTransformation.ts (2)
71-79: LGTM: optional endpointPath on ProcessorTransformationOutputThe new field is optional and non-breaking. Good addition for router throttling.
153-160: LGTM: optional endpointPath on ProxyV0RequestKeeps proxy requests aligned with the new router needs. ProxyV1 inherits it via Omit — all good.
src/v0/destinations/iterable/util.js (1)
319-335: No changes needed—metadata and nonBatchedRequests are always arrays
All internal callers build and pass a metadata array and explicit nonBatchedRequests array tocombineBatchedAndNonBatchedEvents, so the suggested guards and default value aren’t required here.
e2989d5 to
2462709
Compare
|
Allure Test reports for this run are available at:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4599 +/- ##
========================================
Coverage 91.78% 91.79%
========================================
Files 642 642
Lines 33931 33935 +4
Branches 8032 8041 +9
========================================
+ Hits 31145 31149 +4
+ Misses 2556 2534 -22
- Partials 230 252 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2462709 to
59065ab
Compare
|
Allure Test reports for this run are available at:
|
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/v0/destinations/iterable/util.js (1)
313-318: Update JSDoc parameter documentation for consistency.The JSDoc comment should be updated to reflect the new parameter signature including
endpointPath./** * Combines batched and non batched requests * @param {*} apiKey * @param {*} metadata - * @param {*} endpoint + * @param {*} endpoint + * @param {*} endpointPath * @param {*} destination * @param {*} eventResponse - * @param {*} transformedEvents + * @param {*} nonBatchedRequests * @returns */Also applies to: 319-327
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (7)
test/integrations/destinations/iterable/dataDelivery/business.tsis excluded by!**/test/**test/integrations/destinations/iterable/processor/aliasTestData.tsis excluded by!**/test/**test/integrations/destinations/iterable/processor/identifyTestData.tsis excluded by!**/test/**test/integrations/destinations/iterable/processor/pageScreenTestData.tsis excluded by!**/test/**test/integrations/destinations/iterable/processor/trackTestData.tsis excluded by!**/test/**test/integrations/destinations/iterable/router/data.tsis excluded by!**/test/**test/integrations/testUtils.tsis excluded by!**/test/**
📒 Files selected for processing (4)
src/types/destinationTransformation.ts(2 hunks)src/v0/destinations/iterable/transform.js(1 hunks)src/v0/destinations/iterable/util.js(6 hunks)src/v0/destinations/iterable/util.test.js(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/v0/destinations/iterable/transform.js
- src/v0/destinations/iterable/util.test.js
🧰 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/iterable/util.js
🧠 Learnings (1)
📚 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/iterable/util.js
🧬 Code graph analysis (1)
src/v0/destinations/iterable/util.js (1)
src/v0/destinations/iterable/config.js (1)
constructEndpoint(74-77)
⏰ 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). (8)
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- 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: Code Coverage
- GitHub Check: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (7)
src/types/destinationTransformation.ts (2)
76-76: LGTM! Proper addition of optional endpointPath field.The optional
endpointPathfield is correctly added toProcessorTransformationOutput, maintaining backward compatibility while enabling the new throttling functionality described in the PR objectives.
157-157: LGTM! Consistent endpointPath addition to proxy request type.The optional
endpointPathfield is properly added toProxyV0Request, ensuring consistency across the transformation pipeline from processor output to proxy requests.src/v0/destinations/iterable/util.js (5)
68-72: LGTM! Clean implementation of endpointPath derivation.The
getCategoryWithEndpointfunction correctly addsendpointPathusing the original category endpoint value, providing the stable path representation needed for throttling while preserving the full constructed endpoint.
329-330: LGTM! Proper assignment of endpoint properties.Both
endpointandendpointPathare correctly assigned to the batched request, enabling downstream throttling logic to use the stable path representation.
451-452: LGTM! Consistent endpointPath handling in update user batch processing.The endpointPath is properly defined as a constant and used both for endpoint construction and passed to the batching function, ensuring consistency between the actual endpoint and the throttling path.
Also applies to: 457-457
530-530: LGTM! Proper extraction and propagation of endpointPath for catalog batching.The endpointPath is correctly extracted from the message and passed through to the batching function, maintaining the stable path representation for catalog operations.
Also applies to: 537-537
620-621: LGTM! Consistent endpointPath implementation for track event batching.Similar to the update user batch processing, the endpointPath is properly defined and used consistently for track events, ensuring uniform handling across all batch types.
Also applies to: 626-626



What are the changes introduced in this PR?
Introducing
endpointPathin iterable's transformed message responses.endpointPathfield contains a stable representation of the request's target endpoint and will be used by rudder-server for applying throttling during the delivery stage of router.The idea behind using a new
endpointPathfield instead of the existingendpoint, is that while theendpointcan change depending on the destination's region (eu/us) or other event information (e.g. including dynamic path & query parameters in the final endpoint url),endpointPathremains stable.What is the related Linear task?
resolves PIPE-2337