Skip to content

feat: update TikTok Ads to include endpointPath - #4625

Merged
koladilip merged 1 commit into
developfrom
fix/tiktok-ads-endpoint-path-tests
Sep 12, 2025
Merged

koladilip merged 1 commit into
developfrom
fix/tiktok-ads-endpoint-path-tests

Conversation

@koladilip

@koladilip koladilip commented Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Updated TikTok Ads to include the new endpointPath property 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 endpointPath properties in the response objects. This PR updates all related tests to expect these new properties:

  • Unit Tests: Updated transform.test.js and transformV2.test.js to include endpointPath in expected responses
  • Component Tests: Updated processor/data.ts and router/data.ts to include endpointPath for all endpoint configurations

Any 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 endpointPath property 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

  • 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.

@koladilip
koladilip requested review from a team and sivashanmukh as code owners September 11, 2025 07:27
@koladilip
koladilip requested review from a team, krishna2020 and manish339k September 11, 2025 07:27
@coderabbitai

coderabbitai Bot commented Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • TikTok Ads integration responses now include endpointPath for both single and batch requests, improving visibility and troubleshooting of request destinations.
  • Tests

    • Updated test suites to validate presence and correctness of endpointPath in responses for both v1 and v2 flows.

Walkthrough

Adds 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

Cohort / File(s) Summary
Implementation: TikTok Ads v1
src/v0/destinations/tiktok_ads/transform.js
Sets response.endpointPath for track (TRACK_ENDPOINT_PATH) and batched requests (BATCH_ENDPOINT_PATH) alongside existing endpoint.
Implementation: TikTok Ads v2
src/v0/destinations/tiktok_ads/transformV2.js, src/v0/destinations/tiktok_ads/config.js
Exposes trackEndpointV2Path and uses path constants to set response.endpointPath / batchedRequest.endpointPath; config composes full endpoint URLs from BASE_URL + path and exports path constants (TRACK_ENDPOINT_PATH, BATCH_ENDPOINT_PATH, trackEndpointV2Path).
Tests: TikTok Ads v1 & v2
src/v0/destinations/tiktok_ads/transform.test.js, src/v0/destinations/tiktok_ads/transformV2.test.js
Test fixtures and expectations updated to include endpointPath; assertions added to validate resp.endpointPath.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • sivashanmukh
  • krishna2020
  • manish339k

Suggestions for improvement: add a short note in the PR description about backward compatibility for downstream consumers (they should tolerate the added endpointPath), and consider a brief unit test asserting absence/fallback behavior if config paths are missing.

Pre-merge checks (1 passed, 2 warnings)

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description covers most template sections and includes the Linear task and objectives, but it incorrectly states the change is "purely a test update" while the changeset shows runtime modifications adding endpointPath in src/v0/destinations/tiktok_ads/transform.js, transformV2.js and new path exports in config.js. This factual mismatch makes the description incomplete and potentially misleading for reviewers. Because accuracy about what changed is required by the template, the description fails the check. Update the PR description to list all modified code files (at minimum src/v0/destinations/tiktok_ads/transform.js, transformV2.js, config.js, and the updated tests), explicitly mention the new exports (TRACK_ENDPOINT_PATH, BATCH_ENDPOINT_PATH, trackEndpointV2Path) and that responses now include endpointPath, and correct the "Any changes to existing capabilities" section to note this non-breaking response-field addition; finally confirm CI/tests passed and adjust the developer checklist accordingly so reviewers can quickly verify scope and impact.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "feat: update TikTok Ads to include endpointPath" succinctly and accurately summarizes the primary change—adding endpointPath to TikTok Ads transformation responses. It is concise, uses the conventional "feat" prefix, and avoids irrelevant noise or file lists. Therefore it meets the repository's title guidelines and is acceptable as-is.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 77719f2 and feaf516.

⛔ Files ignored due to path filters (6)
  • test/integrations/destinations/tiktok_ads/dataDelivery/business.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/dataDelivery/data.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/dataDelivery/other.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/network.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/router/data.ts is 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 (5)
  • src/v0/destinations/tiktok_ads/transformV2.js
  • src/v0/destinations/tiktok_ads/transform.js
  • src/v0/destinations/tiktok_ads/config.js
  • src/v0/destinations/tiktok_ads/transformV2.test.js
  • src/v0/destinations/tiktok_ads/transform.test.js
⏰ 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)
  • 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)
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/tiktok-ads-endpoint-path-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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@koladilip koladilip changed the title fix: update TikTok Ads tests to include endpointPath feat: update TikTok Ads to include endpointPath Sep 11, 2025
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Sep 11, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.78%. Comparing base (63bd4e3) to head (feaf516).
⚠️ Report is 10 commits behind head on develop.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6b30364 and 2b4d054.

⛔ Files ignored due to path filters (2)
  • test/integrations/destinations/tiktok_ads/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/router/data.ts is 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.js
  • src/v0/destinations/tiktok_ads/transformV2.js
  • src/v0/destinations/tiktok_ads/transformV2.test.js
  • src/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.js
  • src/v0/destinations/tiktok_ads/transformV2.js
  • src/v0/destinations/tiktok_ads/transformV2.test.js
  • src/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.

@koladilip
koladilip force-pushed the fix/tiktok-ads-endpoint-path-tests branch from 2b4d054 to 5a8b51e Compare September 11, 2025 17:51
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 note

Use 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 & tests

Hard-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 parity

config.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

📥 Commits

Reviewing files that changed from the base of the PR and between 2b4d054 and 5a8b51e.

⛔ Files ignored due to path filters (2)
  • test/integrations/destinations/tiktok_ads/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/router/data.ts is 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)

@koladilip
koladilip force-pushed the fix/tiktok-ads-endpoint-path-tests branch from 5a8b51e to 77719f2 Compare September 12, 2025 04:47
maheshkutty
maheshkutty previously approved these changes Sep 12, 2025
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 URL

Nice 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_URL

Keep 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 consistency

Exports 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5a8b51e and 77719f2.

⛔ Files ignored due to path filters (6)
  • test/integrations/destinations/tiktok_ads/dataDelivery/business.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/dataDelivery/data.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/dataDelivery/other.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/network.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/tiktok_ads/router/data.ts is 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.js
  • src/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.js
  • src/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 — LGTM

Import 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 tests

Looks 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
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@sonarqubecloud

Copy link
Copy Markdown

@koladilip
koladilip merged commit dbacf0a into develop Sep 12, 2025
@koladilip
koladilip deleted the fix/tiktok-ads-endpoint-path-tests branch September 12, 2025 08:45
'test-dest-response-key': 'successResponse',
},
params,
endpoint: 'https://business-api.tiktok.com/open_api/v1.2/pixel/batch/',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@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 ?

@krishna2020 krishna2020 Sep 12, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@koladilip we are only using them for validations and if they fail to form correctly then they will still fail right?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Am good to use constants - but those constants has to be explicitly defined in test file - rather than referencing from source code

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.

5 participants