Repository navigation
feat: update TikTok Ads to include endpointPath - #4625
Conversation
Summary by CodeRabbit
WalkthroughAdds endpointPath metadata to TikTok Ads transform outputs (v1 and v2) and exports path constants from config; tests updated to expect endpointPath. No control-flow or error-handling changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Producer as Event Producer
participant Transformer as TikTok Transformer
participant API as TikTok API
Note over Transformer: derive full endpoint and path-only metadata
Producer->>Transformer: submit track/batch event
activate Transformer
Transformer->>Transformer: compute full endpoint (BASE_URL + path)
Transformer->>Transformer: set endpointPath (path constant)
Transformer-->>Producer: return request { endpoint, endpointPath, method, headers, body }
deactivate Transformer
Producer->>API: send HTTP request to endpoint
API-->>Producer: return HTTP response
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Suggestions for improvement: add a short note in the PR description about backward compatibility for downstream consumers (they should tolerate the added Pre-merge checks (1 passed, 2 warnings)❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (6)
📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
⏰ 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). (6)
✨ 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. Comment |
|
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 #4625 +/- ##
========================================
Coverage 91.78% 91.78%
========================================
Files 642 642
Lines 33941 33949 +8
Branches 8035 8045 +10
========================================
+ Hits 31152 31161 +9
+ Misses 2559 2536 -23
- Partials 230 252 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/v0/destinations/tiktok_ads/transform.js (1)
124-124: Optional: centralize endpointPath constants to avoid drift.Define path constants in config and reference them here to prevent string mismatches if endpoints evolve.
- response.endpointPath = '/pixel/track'; + response.endpointPath = TRACK_ENDPOINT_PATH;- batchedRequest.endpointPath = '/pixel/batch'; + batchedRequest.endpointPath = BATCH_ENDPOINT_PATH;Outside this file (config.js):
export const TRACK_ENDPOINT = '.../pixel/track/'; export const BATCH_ENDPOINT = '.../pixel/batch/'; +export const TRACK_ENDPOINT_PATH = '/pixel/track'; +export const BATCH_ENDPOINT_PATH = '/pixel/batch';Also applies to: 217-217
src/v0/destinations/tiktok_ads/transformV2.js (1)
131-131: Optional: source endpointPath from config for single-source-of-truth.Avoid hardcoding the same string twice.
- response.endpointPath = '/event/track'; + response.endpointPath = trackEndpointPathV2;- batchedRequest.endpointPath = '/event/track'; + batchedRequest.endpointPath = trackEndpointPathV2;Outside this file (config):
export const trackEndpointV2 = '.../event/track/'; +export const trackEndpointPathV2 = '/event/track';Also applies to: 416-416
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
test/integrations/destinations/tiktok_ads/processor/data.tsis excluded by!**/test/**test/integrations/destinations/tiktok_ads/router/data.tsis excluded by!**/test/**
📒 Files selected for processing (4)
src/v0/destinations/tiktok_ads/transform.js(2 hunks)src/v0/destinations/tiktok_ads/transform.test.js(2 hunks)src/v0/destinations/tiktok_ads/transformV2.js(2 hunks)src/v0/destinations/tiktok_ads/transformV2.test.js(2 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/tiktok_ads/transform.jssrc/v0/destinations/tiktok_ads/transformV2.jssrc/v0/destinations/tiktok_ads/transformV2.test.jssrc/v0/destinations/tiktok_ads/transform.test.js
🧠 Learnings (2)
📓 Common learnings
Learnt from: ItsSudip
PR: rudderlabs/rudder-transformer#4497
File: src/v0/destinations/tiktok_ads/transformV2.js:686-691
Timestamp: 2025-07-15T06:27:07.528Z
Learning: For TikTok Ads destination in src/v0/destinations/tiktok_ads/transformV2.js, there are plans for a future enhancement to group events by eventSource when batching to ensure all events in a batch have the same event_source value, as acknowledged by ItsSudip in PR #4497.
📚 Learning: 2025-07-15T06:27:07.528Z
Learnt from: ItsSudip
PR: rudderlabs/rudder-transformer#4497
File: src/v0/destinations/tiktok_ads/transformV2.js:686-691
Timestamp: 2025-07-15T06:27:07.528Z
Learning: For TikTok Ads destination in src/v0/destinations/tiktok_ads/transformV2.js, there are plans for a future enhancement to group events by eventSource when batching to ensure all events in a batch have the same event_source value, as acknowledged by ItsSudip in PR #4497.
Applied to files:
src/v0/destinations/tiktok_ads/transform.jssrc/v0/destinations/tiktok_ads/transformV2.jssrc/v0/destinations/tiktok_ads/transformV2.test.jssrc/v0/destinations/tiktok_ads/transform.test.js
🧬 Code graph analysis (1)
src/v0/destinations/tiktok_ads/transform.test.js (1)
src/v0/destinations/google_adwords_remarketing_lists/util.test.js (1)
expectedResponse(67-118)
⏰ 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). (7)
- 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: Code Coverage
- GitHub Check: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (9)
src/v0/destinations/tiktok_ads/transform.js (2)
124-124: endpointPath added for v1 track — LGTM.Matches test expectations and keeps response metadata explicit.
217-217: endpointPath added for v1 batch — LGTM.Consistent with track path naming.
src/v0/destinations/tiktok_ads/transformV2.js (3)
131-131: endpointPath set for v2 track — LGTM.Value '/event/track' matches the v2 track endpoint usage.
416-416: endpointPath set for v2 batch — LGTM.Correct to reuse '/event/track' for batched payloads.
131-131: Partial — endpointPath set & asserted for v1/v2 single + batch; component fixtures not found
Found assignments and assertions:
- src/v0/destinations/tiktok_ads/transform.js — response.endpointPath = '/pixel/track' (ln 124); batchedRequest.endpointPath = '/pixel/batch' (ln 217).
- src/v0/destinations/tiktok_ads/transform.test.js — expectedResponse.endpointPath = '/pixel/track' (ln 27); assertion expect(resp.endpointPath).toBe(...) (ln 125).
- src/v0/destinations/tiktok_ads/transformV2.js — response.endpointPath = '/event/track' (ln 131); batchedRequest.endpointPath = '/event/track' (ln 416).
- src/v0/destinations/tiktok_ads/transformV2.test.js — expectedResponse.endpointPath = '/event/track' (ln 27); assertion expect(resp.endpointPath).toBe(...) (ln 127).
Action: confirm whether component/router/processor fixtures exist for tiktok_ads; if they do, ensure those fixtures include endpointPath and add matching component-level assertions.
src/v0/destinations/tiktok_ads/transform.test.js (2)
27-27: Fixture updated with endpointPath — LGTM.Keeps baseOutputMessage aligned with transform output.
125-125: New assertion for endpointPath — LGTM.Validates presence and value without affecting existing checks.
src/v0/destinations/tiktok_ads/transformV2.test.js (2)
27-27: Fixture updated with endpointPath — LGTM.Matches transformV2 behavior.
127-127: Assertion added for endpointPath — LGTM.Ensures metadata parity for v2 track/batch.
2b4d054 to
5a8b51e
Compare
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/v0/destinations/tiktok_ads/config.js (3)
55-56: Reuse BASE_URL for v2; minor naming consistency noteUse the same BASE_URL for v2 to keep things consistent. Also, v1 path constants are SCREAMING_SNAKE_CASE while v2 path is camelCase; not blocking, but consider aligning when convenient.
-const trackEndpointV2 = `https://business-api.tiktok.com/open_api/v1.3${trackEndpointV2Path}/`; +const trackEndpointV2 = `${BASE_URL}${trackEndpointV2Path}/`;
3-6: Extract BASE_URL and replace literal TikTok base URL across code & testsHard-coded occurrences of "https://business-api.tiktok.com/open_api/v1.3" were found — define BASE_URL in src/v0/destinations/tiktok_ads/config.js and use it for all endpoints (config, transform files, and tests).
Files to update:
- src/v0/destinations/tiktok_ads/config.js — TRACK_ENDPOINT, BATCH_ENDPOINT, trackEndpointV2.
- src/v0/destinations/tiktok_ads/transformV2.js — lines ~314, 467, 547.
- src/v0/destinations/tiktok_ads/transform.test.js — line ~26.
- src/v0/destinations/tiktok_ads/transformV2.test.js — line ~26.
Recommended change (apply in config.js):
+const BASE_URL = 'https://business-api.tiktok.com/open_api/v1.3'; -const TRACK_ENDPOINT = `https://business-api.tiktok.com/open_api/v1.3${TRACK_ENDPOINT_PATH}/`; -const BATCH_ENDPOINT_PATH = '/pixel/batch'; -const BATCH_ENDPOINT = `https://business-api.tiktok.com/open_api/v1.3${BATCH_ENDPOINT_PATH}/`; +const TRACK_ENDPOINT = `${BASE_URL}${TRACK_ENDPOINT_PATH}/`; +const BATCH_ENDPOINT_PATH = '/pixel/batch'; +const BATCH_ENDPOINT = `${BASE_URL}${BATCH_ENDPOINT_PATH}/`;
61-61: Optional: add TRACK_ENDPOINT_V2_PATH alias for v2 naming parityconfig.js currently exports trackEndpointV2 (camelCase) but not an uppercase alias; transformV2.js also hardcodes '/event/track' in one place. Quick grep of src/v0/destinations/tiktok_ads shows no code in that folder concatenating endpoint+endpointPath (risk of double-path), but TRACK_ENDPOINT/BATCH_ENDPOINT are defined with the path + trailing slash — confirm the request-builder behavior if you restore/rename exports.
Apply in config.js (module.exports) and replace hardcoded '/event/track' in transformV2.js with the alias:
DESTINATION: 'TIKTOK_ADS', trackEndpointV2Path, trackEndpointV2, maxBatchSizeV2, + // Alias for consistency with TRACK_ENDPOINT_PATH/BATCH_ENDPOINT_PATH + TRACK_ENDPOINT_V2_PATH: trackEndpointV2Path, eventsWithRecommendedParams,Files to touch: src/v0/destinations/tiktok_ads/config.js, src/v0/destinations/tiktok_ads/transformV2.js.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
test/integrations/destinations/tiktok_ads/processor/data.tsis excluded by!**/test/**test/integrations/destinations/tiktok_ads/router/data.tsis excluded by!**/test/**
📒 Files selected for processing (5)
src/v0/destinations/tiktok_ads/config.js(2 hunks)src/v0/destinations/tiktok_ads/transform.js(3 hunks)src/v0/destinations/tiktok_ads/transform.test.js(2 hunks)src/v0/destinations/tiktok_ads/transformV2.js(3 hunks)src/v0/destinations/tiktok_ads/transformV2.test.js(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- src/v0/destinations/tiktok_ads/transform.test.js
- src/v0/destinations/tiktok_ads/transformV2.test.js
- src/v0/destinations/tiktok_ads/transform.js
- src/v0/destinations/tiktok_ads/transformV2.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/tiktok_ads/config.js
🧠 Learnings (1)
📚 Learning: 2025-07-15T06:27:07.528Z
Learnt from: ItsSudip
PR: rudderlabs/rudder-transformer#4497
File: src/v0/destinations/tiktok_ads/transformV2.js:686-691
Timestamp: 2025-07-15T06:27:07.528Z
Learning: For TikTok Ads destination in src/v0/destinations/tiktok_ads/transformV2.js, there are plans for a future enhancement to group events by eventSource when batching to ensure all events in a batch have the same event_source value, as acknowledged by ItsSudip in PR #4497.
Applied to files:
src/v0/destinations/tiktok_ads/config.js
🧬 Code graph analysis (1)
src/v0/destinations/tiktok_ads/config.js (1)
src/v0/util/index.js (1)
mappingConfig(541-541)
⏰ 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)
5a8b51e to
77719f2
Compare
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/v0/destinations/tiktok_ads/config.js (3)
3-6: Derive endpoints from path constants — consider DRYing base URLNice separation of URL vs path. To avoid repeating the base URL:
Apply:
+const BASE_URL = 'https://business-api.tiktok.com/open_api/v1.3'; -const TRACK_ENDPOINT_PATH = '/pixel/track'; -const TRACK_ENDPOINT = `https://business-api.tiktok.com/open_api/v1.3${TRACK_ENDPOINT_PATH}/`; +const TRACK_ENDPOINT_PATH = '/pixel/track'; +const TRACK_ENDPOINT = `${BASE_URL}${TRACK_ENDPOINT_PATH}/`; -const BATCH_ENDPOINT_PATH = '/pixel/batch'; -const BATCH_ENDPOINT = `https://business-api.tiktok.com/open_api/v1.3${BATCH_ENDPOINT_PATH}/`; +const BATCH_ENDPOINT_PATH = '/pixel/batch'; +const BATCH_ENDPOINT = `${BASE_URL}${BATCH_ENDPOINT_PATH}/`;
55-56: V2 track path constants — reuse BASE_URLKeep construction consistent with v1:
-const trackEndpointV2Path = '/event/track'; -const trackEndpointV2 = `https://business-api.tiktok.com/open_api/v1.3${trackEndpointV2Path}/`; +const trackEndpointV2Path = '/event/track'; +const trackEndpointV2 = `${BASE_URL}${trackEndpointV2Path}/`;
61-75: Exporting path constants — LGTM; minor naming consistencyExports look good. Optional: align casing between v1 (TRACK_ENDPOINT_PATH) and v2 (trackEndpointV2Path) for consistency across the module.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
test/integrations/destinations/tiktok_ads/dataDelivery/business.tsis excluded by!**/test/**test/integrations/destinations/tiktok_ads/dataDelivery/data.tsis excluded by!**/test/**test/integrations/destinations/tiktok_ads/dataDelivery/other.tsis excluded by!**/test/**test/integrations/destinations/tiktok_ads/network.tsis excluded by!**/test/**test/integrations/destinations/tiktok_ads/processor/data.tsis excluded by!**/test/**test/integrations/destinations/tiktok_ads/router/data.tsis excluded by!**/test/**
📒 Files selected for processing (5)
src/v0/destinations/tiktok_ads/config.js(2 hunks)src/v0/destinations/tiktok_ads/transform.js(3 hunks)src/v0/destinations/tiktok_ads/transform.test.js(3 hunks)src/v0/destinations/tiktok_ads/transformV2.js(3 hunks)src/v0/destinations/tiktok_ads/transformV2.test.js(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- src/v0/destinations/tiktok_ads/transform.js
- src/v0/destinations/tiktok_ads/transformV2.test.js
- src/v0/destinations/tiktok_ads/transform.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/tiktok_ads/config.jssrc/v0/destinations/tiktok_ads/transformV2.js
🧠 Learnings (1)
📚 Learning: 2025-07-15T06:27:07.528Z
Learnt from: ItsSudip
PR: rudderlabs/rudder-transformer#4497
File: src/v0/destinations/tiktok_ads/transformV2.js:686-691
Timestamp: 2025-07-15T06:27:07.528Z
Learning: For TikTok Ads destination in src/v0/destinations/tiktok_ads/transformV2.js, there are plans for a future enhancement to group events by eventSource when batching to ensure all events in a batch have the same event_source value, as acknowledged by ItsSudip in PR #4497.
Applied to files:
src/v0/destinations/tiktok_ads/config.jssrc/v0/destinations/tiktok_ads/transformV2.js
🧬 Code graph analysis (2)
src/v0/destinations/tiktok_ads/config.js (1)
src/v0/util/index.js (1)
mappingConfig(541-541)
src/v0/destinations/tiktok_ads/transformV2.js (1)
src/v0/destinations/tiktok_ads/config.js (1)
trackEndpointV2Path(55-55)
⏰ 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). (7)
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- 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/tiktok_ads/transformV2.js (3)
31-37: Import of trackEndpointV2Path — LGTMImport aligns with endpointPath usage below.
124-133: endpointPath added to single-event response — LGTM (test coverage confirmed)
transformV2.test defines expectedResponse.endpointPath and asserts expect(resp.endpointPath).toBe(expectedResponse.endpointPath), so the change is covered. Optional: add a negative test for missing/malformed endpointPath.
414-421: endpointPath added to batched response — LGTM; verify component testsLooks correct for batch path metadata; confirm component test fixtures include endpointPath.
Location: src/v0/destinations/tiktok_ads/transformV2.js (approx. lines 414–421)
Suggested search: rg -n --no-heading 'endpointPath' || true
- Add endpointPath to unit test expected responses - Update component test data to include endpointPath for all endpoints - Fix v1 endpoints: /pixel/track/ and /pixel/batch/ - Fix v2 endpoints: /event/track - All tests now pass with new endpointPath property
77719f2 to
feaf516
Compare
|
Allure Test reports for this run are available at:
|
|
| 'test-dest-response-key': 'successResponse', | ||
| }, | ||
| params, | ||
| endpoint: 'https://business-api.tiktok.com/open_api/v1.2/pixel/batch/', |
There was a problem hiding this comment.
@koladilip Ideally we shouldn't use the constants from the source code. other-wise, how will we make sure the changes done as part of this PR is not breaking the right formation of endpoint ?
There was a problem hiding this comment.
As a reviewer, I see for test cases to be intact. But here, making sure existing functionality is intact through test case itself is getting defeated
There was a problem hiding this comment.
@koladilip we are only using them for validations and if they fail to form correctly then they will still fail right?
There was a problem hiding this comment.
If there's a bug in this PR while formulating BATCH_ENDPOINT - how can the test case catch it if assertion also works on same constant ?
There was a problem hiding this comment.
Am good to use constants - but those constants has to be explicitly defined in test file - rather than referencing from source code



What are the changes introduced in this PR?
Updated TikTok Ads to include the new
endpointPathproperty that was added to the destination transformation responses.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
The TikTok Ads destination was updated to include
endpointPathproperties in the response objects. This PR updates all related tests to expect these new properties:transform.test.jsandtransformV2.test.jsto includeendpointPathin expected responsesprocessor/data.tsandrouter/data.tsto includeendpointPathfor all endpoint configurationsAny changes to existing capabilities/behaviour, mention the reason & what are the changes ?
No changes to existing capabilities. This is purely a test update to match the new
endpointPathproperty that was added to the TikTok Ads destination responses.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
Reviewer checklist