Skip to content

feat: onboard google developer token - #4613

Merged
utsabc merged 12 commits into
developfrom
feat.onboard-google-developer-token
Sep 23, 2025
Merged

utsabc merged 12 commits into
developfrom
feat.onboard-google-developer-token

Conversation

@utsabc

@utsabc utsabc commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

This pull request refactors how the Google Ads Developer Token is handled in the Google AdWords integrations. Instead of extracting the token from each message's metadata, the code now consistently uses the GOOGLE_ADS_DEVELOPER_TOKEN environment variable across all relevant destinations. Corresponding test data has been updated to reflect this change, and a Jest setup file has been added for test configuration.

Environment Variable Refactor:

  • Refactored all Google AdWords destination modules (google_adwords_enhanced_conversions, google_adwords_offline_conversions, google_adwords_remarketing_lists) to use the GOOGLE_ADS_DEVELOPER_TOKEN from environment variables instead of reading from message metadata. This affects config files, utility functions, and all request builders. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

Test Data and Configuration Updates:

Testing Infrastructure:

  • Added a Jest setup file (test/setup.ts) to the Jest configuration to ensure consistent test environment setup.

@utsabc
utsabc requested review from a team and sivashanmukh as code owners September 8, 2025 12:04
@utsabc
utsabc requested review from a team, krishna2020 and vinayteki95 September 8, 2025 12:04
@coderabbitai

coderabbitai Bot commented Sep 8, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Centralized configuration for Google Ads developer token via environment variable with clear error messaging if missing.
  • Refactor

    • Unified authentication handling across Google Ads Enhanced Conversions, Offline Conversions, and Remarketing Lists for more consistent delivery.
  • Tests

    • Enabled a global Jest setup file to initialize test environment before runs.
  • Documentation

    • Added guidelines for handling PR review comments to streamline review workflows.

Walkthrough

Centralizes Google Ads developer token retrieval via a new getDeveloperToken() (reads GOOGLE_ADS_DEVELOPER_TOKEN), removes per-message developer-token extraction across Enhanced Conversions, Offline Conversions, and Remarketing Lists, updates responseBuilder signature and tests, enables Jest setupFiles, and adds a PR-review guideline document.

Changes

Cohort / File(s) Summary
Jest setup configuration
jest.config.js, jest.config.typescript.js
Enable setupFiles: ['<rootDir>/test/setup.ts'] so Jest loads a global setup file before tests.
Google Ads utils
src/v0/util/googleUtils/index.js
Add getDeveloperToken() reading GOOGLE_ADS_DEVELOPER_TOKEN from env and throwing PlatformError if unset; export it.
Enhanced Conversions (Google Ads)
src/v0/destinations/google_adwords_enhanced_conversions/transform.js, src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js, src/v0/destinations/google_adwords_enhanced_conversions/config.js
Remove per-message developer-token usage; networkHandler uses getDeveloperToken() for Google Ads SDK initialization; minor formatting change in config.
Offline Conversions (Google Ads)
src/v0/destinations/google_adwords_offline_conversions/utils.js, src/v0/destinations/google_adwords_offline_conversions/networkHandler.js
Stop setting developer-token in utils; networkHandler now sets headers['developer-token'] = getDeveloperToken().
Remarketing Lists (Google Ads)
src/v0/destinations/google_adwords_remarketing_lists/transform.js, src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js, src/v0/destinations/google_adwords_remarketing_lists/util.js, src/v0/destinations/google_adwords_remarketing_lists/util.test.js, src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js
Remove per-message developer token extraction and passing; update responseBuilder signature to drop developerToken; update tests; networkHandler injects token via getDeveloperToken().
Process documentation
.cursor/rules/pr-review-comments.mdc
Add PR review comments handling guideline with a stepwise workflow to process PR comments sequentially.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Transformer
  participant Dest as DestinationLogic
  participant NH as NetworkHandler
  participant GU as googleUtils.getDeveloperToken
  participant GAds as GoogleAdsAPI

  Transformer->>Dest: build payload (no per-message token)
  Dest->>NH: make request / init SDK
  NH->>GU: getDeveloperToken()
  GU-->>NH: developerToken or throw
  alt token present
    NH->>GAds: send/init with headers['developer-token']
    GAds-->>NH: response
    NH-->>Dest: return response
  else missing token
    NH-->>Dest: throw PlatformError (missing env token)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • sivashanmukh
  • krishna2020
  • vinayteki95

Suggestions for improvements:

  • Add unit/integration tests covering getDeveloperToken() error path (missing env var) to prevent runtime surprises.
  • Document the required GOOGLE_ADS_DEVELOPER_TOKEN in repository README or deployment/runbook.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
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 (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "feat: onboard google developer token" is concise, follows conventional-commit style, and accurately summarizes the primary change of migrating Google Ads developer token handling to an onboarded/environment-variable approach across AdWords destinations and tests. It is specific enough for a reviewer to understand the main intent without listing files or including noise. No edits are strictly necessary.
Description Check ✅ Passed The pull request description clearly explains the refactor, lists affected Google AdWords destinations, notes updates to tests and fixtures, and documents the added Jest setup file, so it covers the core changes and testing implications from the diff. However, it does not include the repository-required "Related Linear task" (Resolves INT-XXX) entry from the template and the Developer checklist items are not marked; these are required template elements. Please add the Linear task reference, complete the developer checklist, and surface any runtime/deployment notes for the new GOOGLE_ADS_DEVELOPER_TOKEN environment variable in docs.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat.onboard-google-developer-token

📜 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 fcec8bc and 5e80bb0.

⛔ Files ignored due to path filters (2)
  • test/integrations/destinations/google_adwords_offline_conversions/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/router/data.ts is excluded by !**/test/**
📒 Files selected for processing (1)
  • src/v0/destinations/google_adwords_offline_conversions/utils.js (0 hunks)
💤 Files with no reviewable changes (1)
  • src/v0/destinations/google_adwords_offline_conversions/utils.js

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.

@utsabc utsabc changed the title Feat.onboard google developer token feat: onboard google developer token Sep 8, 2025
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Sep 8, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.79%. Comparing base (e7628ec) to head (5e80bb0).
⚠️ Report is 12 commits behind head on develop.

Files with missing lines Patch % Lines
src/v0/util/googleUtils/index.js 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4613   +/-   ##
========================================
  Coverage    91.78%   91.79%           
========================================
  Files          642      642           
  Lines        33974    33998   +24     
  Branches      8043     8035    -8     
========================================
+ Hits         31184    31207   +23     
- Misses        2538     2561   +23     
+ Partials       252      230   -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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/v0/destinations/google_adwords_remarketing_lists/config.js (1)

27-41: Token export: add validation and minimize leak surface.

Same concerns as other configs: validate presence and avoid exporting raw secrets on shared config objects. Prefer a getter as shown in the enhanced_conversions/config.js suggestion.

Consider a shared helper (e.g., src/v0/destinations/google_ads/token.js) exporting getDeveloperToken() to DRY this across all Google Ads destinations.

🧹 Nitpick comments (1)
src/v0/destinations/google_adwords_offline_conversions/config.js (1)

71-71: Do not expose secrets on module.exports unless necessary.

If any code logs or serializes this config object, the token may leak. Prefer exporting a function that returns the token.

📜 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 3192141 and 0d048cd.

⛔ Files ignored due to path filters (12)
  • test/integrations/destinations/google_adwords_enhanced_conversions/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_enhanced_conversions/router/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/dataDelivery/business.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/dataDelivery/oauth.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/network.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/router/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/dataDelivery/business.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/network.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/router/data.ts is excluded by !**/test/**
  • test/setup.ts is excluded by !**/test/**
📒 Files selected for processing (8)
  • jest.config.typescript.js (1 hunks)
  • src/v0/destinations/google_adwords_enhanced_conversions/config.js (1 hunks)
  • src/v0/destinations/google_adwords_enhanced_conversions/transform.js (2 hunks)
  • src/v0/destinations/google_adwords_offline_conversions/config.js (2 hunks)
  • src/v0/destinations/google_adwords_offline_conversions/utils.js (2 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/config.js (2 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (2 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/transform.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/google_adwords_enhanced_conversions/transform.js
  • jest.config.typescript.js
  • src/v0/destinations/google_adwords_remarketing_lists/config.js
  • src/v0/destinations/google_adwords_offline_conversions/config.js
  • src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js
  • src/v0/destinations/google_adwords_offline_conversions/utils.js
  • src/v0/destinations/google_adwords_enhanced_conversions/config.js
  • src/v0/destinations/google_adwords_remarketing_lists/transform.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/google_adwords_remarketing_lists/recordTransform.js
🧬 Code graph analysis (5)
src/v0/destinations/google_adwords_remarketing_lists/config.js (2)
src/v0/destinations/google_adwords_enhanced_conversions/config.js (1)
  • process (12-12)
src/v0/destinations/google_adwords_offline_conversions/config.js (1)
  • process (50-50)
src/v0/destinations/google_adwords_offline_conversions/config.js (2)
src/v0/destinations/google_adwords_enhanced_conversions/config.js (1)
  • process (12-12)
src/v0/destinations/google_adwords_remarketing_lists/config.js (1)
  • process (27-27)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (2)
src/v0/destinations/google_adwords_remarketing_lists/transform.js (7)
  • require (1-5)
  • require (7-12)
  • require (14-14)
  • require (15-19)
  • require (20-20)
  • require (21-21)
  • developerToken (124-124)
src/v0/destinations/google_adwords_remarketing_lists/util.js (5)
  • require (3-3)
  • require (4-11)
  • require (13-13)
  • require (14-14)
  • require (15-22)
src/v0/destinations/google_adwords_enhanced_conversions/config.js (2)
src/v0/destinations/google_adwords_offline_conversions/config.js (1)
  • process (50-50)
src/v0/destinations/google_adwords_remarketing_lists/config.js (1)
  • process (27-27)
src/v0/destinations/google_adwords_remarketing_lists/transform.js (2)
src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (7)
  • require (1-6)
  • require (7-14)
  • require (15-15)
  • require (16-20)
  • require (21-21)
  • require (22-26)
  • developerToken (74-74)
src/v0/destinations/google_adwords_remarketing_lists/util.test.js (4)
  • require (1-1)
  • require (2-2)
  • require (3-3)
  • developerToken (6-6)
⏰ 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 Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • 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 (go)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
src/v0/destinations/google_adwords_offline_conversions/utils.js (2)

33-33: LGTM: Clean import addition

The addition of GOOGLE_ADS_DEVELOPER_TOKEN to the config import maintains the existing import structure and follows the centralization pattern.


188-188: LGTM: Proper header configuration

The replacement of metadata-based token retrieval with the centralized constant in the request headers is correctly implemented and improves maintainability.

src/v0/destinations/google_adwords_remarketing_lists/transform.js (2)

15-19: LGTM: Clean import restructuring

The addition of GOOGLE_ADS_DEVELOPER_TOKEN to the config import maintains consistency with the established pattern across all Google Ads destinations.


124-124: LGTM: Consistent token assignment

The replacement of getValueFromMessage(metadata, 'secret.developer_token') with the centralized constant provides better consistency and maintainability across the codebase.

Comment thread jest.config.typescript.js Resolved
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js (1)

28-30: Guard against undefined consent to avoid runtime TypeError

Object.keys(params.consent) will throw if consent is undefined.

-  if (Object.keys(params.consent).length > 0) {
+  if (params.consent && Object.keys(params.consent).length > 0) {
     customerMatchUserListMetadata.consent = params.consent;
   }
src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (1)

285-287: Typo in destType ("gogole" → "google") impacts observability tags

This breaks consistency in metrics/log labeling and any filtering on destType.

-    destType: 'gogole_adwords_offline_conversions',
+    destType: 'google_adwords_offline_conversions',
src/v0/destinations/google_adwords_remarketing_lists/util.js (1)

33-57: responseBuilder signature change — OK; default consent and fix brace style

  • Default consent to {} so downstream code can safely read keys.
  • Add braces to satisfy common ESLint "curly" rule and improve readability.
-  response.params = {
-    listId: audienceId,
-    customerId: filteredCustomerId,
-    consent: consentBlock,
-  };
+  response.params = {
+    listId: audienceId,
+    customerId: filteredCustomerId,
+    consent: consentBlock || {},
+  };

-  if (Config.subAccount)
-    if (Config.loginCustomerId) {
-      const filteredLoginCustomerId = removeHyphens(Config.loginCustomerId);
-      response.headers['login-customer-id'] = filteredLoginCustomerId;
-    } else throw new ConfigurationError(`loginCustomerId is required as subAccount is true.`);
+  if (Config.subAccount) {
+    if (Config.loginCustomerId) {
+      const filteredLoginCustomerId = removeHyphens(Config.loginCustomerId);
+      response.headers['login-customer-id'] = filteredLoginCustomerId;
+    } else {
+      throw new ConfigurationError(`loginCustomerId is required as subAccount is true.`);
+    }
+  }
🧹 Nitpick comments (3)
src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js (1)

11-11: Injecting developer-token in headers — OK; avoid mutating input headers

Good move to pull from env. Consider cloning headers to prevent side effects on the request object.

-  headers['developer-token'] = getDeveloperToken();
+  const hdrs = { ...headers, 'developer-token': getDeveloperToken() };

-  const firstResponse = await createJob({ endpoint, headers, method, params, metadata });
+  const firstResponse = await createJob({ endpoint, headers: hdrs, method, params, metadata });

-  const secondResponse = await addUserToJob({ endpoint, headers, method, jobId, body, metadata });
+  const secondResponse = await addUserToJob({ endpoint, headers: hdrs, method, jobId, body, metadata });

-  const thirdResponse = await runTheJob({ endpoint, headers, method, jobId, metadata });
+  const thirdResponse = await runTheJob({ endpoint, headers: hdrs, method, jobId, metadata });

Also applies to: 115-116

src/v0/destinations/google_adwords_offline_conversions/config.js (1)

1-1: Guarded getter for GOOGLE_ADS_DEVELOPER_TOKEN — solid; consider de-duplication

Implementation matches the pattern used in other modules and fails fast with a clear message. Consider centralizing this getter in a shared Google Ads helper to remove duplication across destinations.

Also applies to: 51-60, 80-81

src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (1)

17-22: Env-backed token wiring — good; call getter once and reuse

Import and usage look correct. Minor polish: avoid calling getDeveloperToken() twice.

-  headers['developer-token'] = getDeveloperToken();
-  params.developerToken = getDeveloperToken();
+  const devToken = getDeveloperToken();
+  headers['developer-token'] = devToken;
+  params.developerToken = devToken;

Also applies to: 212-214

📜 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 0d048cd and df7c015.

⛔ Files ignored due to path filters (12)
  • test/integrations/destinations/google_adwords_enhanced_conversions/dataDelivery/business.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_enhanced_conversions/dataDelivery/oauth.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_enhanced_conversions/network.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_enhanced_conversions/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_enhanced_conversions/router/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/dataDelivery/business.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/dataDelivery/oauth.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/network.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/processor/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_offline_conversions/router/data.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/network.ts is excluded by !**/test/**
  • test/integrations/destinations/google_adwords_remarketing_lists/processor/data.ts is excluded by !**/test/**
📒 Files selected for processing (13)
  • jest.config.js (1 hunks)
  • src/v0/destinations/google_adwords_enhanced_conversions/config.js (2 hunks)
  • src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js (2 hunks)
  • src/v0/destinations/google_adwords_enhanced_conversions/transform.js (0 hunks)
  • src/v0/destinations/google_adwords_offline_conversions/config.js (3 hunks)
  • src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (2 hunks)
  • src/v0/destinations/google_adwords_offline_conversions/utils.js (0 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/config.js (3 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js (2 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js (1 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/transform.js (0 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/util.js (1 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/util.test.js (0 hunks)
💤 Files with no reviewable changes (4)
  • src/v0/destinations/google_adwords_remarketing_lists/util.test.js
  • src/v0/destinations/google_adwords_offline_conversions/utils.js
  • src/v0/destinations/google_adwords_enhanced_conversions/transform.js
  • src/v0/destinations/google_adwords_remarketing_lists/transform.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/v0/destinations/google_adwords_remarketing_lists/config.js
  • src/v0/destinations/google_adwords_remarketing_lists/recordTransform.js
  • src/v0/destinations/google_adwords_enhanced_conversions/config.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js

⚙️ CodeRabbit configuration file

Focus on ESLint errors (max 3) and warnings (max 5).

Files:

  • jest.config.js
  • src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js
  • src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js
  • src/v0/destinations/google_adwords_remarketing_lists/util.js
  • src/v0/destinations/google_adwords_offline_conversions/networkHandler.js
  • src/v0/destinations/google_adwords_offline_conversions/config.js
🧬 Code graph analysis (5)
src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js (1)
src/v0/destinations/google_adwords_enhanced_conversions/config.js (1)
  • getDeveloperToken (14-22)
src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js (1)
src/v0/destinations/google_adwords_remarketing_lists/config.js (1)
  • getDeveloperToken (28-36)
src/v0/destinations/google_adwords_remarketing_lists/util.js (2)
src/v0/destinations/google_adwords_enhanced_conversions/transform.js (2)
  • responseBuilder (35-77)
  • accessToken (50-50)
src/v0/destinations/google_adwords_remarketing_lists/util.test.js (3)
  • accessToken (5-5)
  • body (6-29)
  • consentBlock (42-45)
src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (2)
src/adapters/network.js (1)
  • headers (386-386)
src/v0/destinations/google_adwords_offline_conversions/config.js (1)
  • getDeveloperToken (51-59)
src/v0/destinations/google_adwords_offline_conversions/config.js (2)
src/v0/destinations/google_adwords_enhanced_conversions/config.js (4)
  • require (1-1)
  • require (2-2)
  • getDeveloperToken (14-22)
  • process (15-15)
src/v0/destinations/google_adwords_remarketing_lists/config.js (4)
  • require (1-1)
  • require (2-2)
  • getDeveloperToken (28-36)
  • process (29-29)
⏰ 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: UT Tests
  • GitHub Check: test_and_publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (3)
jest.config.js (1)

134-134: Ensure the setup file exists and update Jest config

  • The referenced <rootDir>/test/setup.ts is missing—either add that file or correct the path to your actual setup file.
  • To avoid TS transform issues in setupFiles, move your setup to setupFilesAfterEnv in both jest.config.js and jest.config.typescript.js, or convert it to JS. For example:
-  setupFiles: ['<rootDir>/test/setup.ts'],
+  setupFilesAfterEnv: ['<rootDir>/test/setup.js'],

Likely an incorrect or invalid review comment.

src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js (1)

13-13: Centralized token usage via getDeveloperToken — LGTM

Constructor now sources the token from env through the guarded getter. Matches the new config contract and fails fast if missing.

Also applies to: 90-90

src/v0/destinations/google_adwords_remarketing_lists/util.js (1)

33-33: responseBuilder calls updated to 5-arg signature; no developerToken usage detected

koladilip
koladilip previously approved these changes Sep 11, 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: 1

🧹 Nitpick comments (1)
src/v0/util/googleUtils/index.js (1)

142-158: Harden token retrieval: trim and validate non-empty input.

Avoid accepting whitespace-only values; fail fast on blank tokens.

Apply this diff:

-const getDeveloperToken = () => {
-  const { GOOGLE_ADS_DEVELOPER_TOKEN } = process.env;
-  if (GOOGLE_ADS_DEVELOPER_TOKEN) {
-    return GOOGLE_ADS_DEVELOPER_TOKEN;
-  }
-  throw new ConfigurationError(
-    'GOOGLE_ADS_DEVELOPER_TOKEN is not set, please reach out to support',
-  );
-};
+const getDeveloperToken = () => {
+  const raw = process.env.GOOGLE_ADS_DEVELOPER_TOKEN;
+  const token = raw && raw.trim();
+  if (!token) {
+    throw new ConfigurationError('GOOGLE_ADS_DEVELOPER_TOKEN is required');
+  }
+  return token;
+};

Also ensure downstream logging redacts this header/value in network adapters.

Happy to add a unit test asserting the error on missing/blank tokens—want me to draft it?

📜 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 df7c015 and 0061d43.

📒 Files selected for processing (6)
  • .cursor/rules/pr-review-comments.mdc (1 hunks)
  • src/v0/destinations/google_adwords_enhanced_conversions/config.js (1 hunks)
  • src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js (2 hunks)
  • src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (2 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js (2 hunks)
  • src/v0/util/googleUtils/index.js (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .cursor/rules/pr-review-comments.mdc
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js
  • src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js
  • src/v0/destinations/google_adwords_offline_conversions/networkHandler.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/google_adwords_enhanced_conversions/config.js
  • src/v0/util/googleUtils/index.js
🧬 Code graph analysis (1)
src/v0/util/googleUtils/index.js (3)
src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (8)
  • require (4-8)
  • require (9-9)
  • require (10-14)
  • require (15-15)
  • require (17-17)
  • require (18-18)
  • require (19-22)
  • require (24-24)
src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js (6)
  • require (1-1)
  • require (3-3)
  • require (4-4)
  • require (5-8)
  • require (10-10)
  • require (11-11)
src/v0/destinations/google_adwords_remarketing_lists/transform.js (2)
  • require (1-5)
  • process (140-140)
⏰ 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 ARM64
  • GitHub Check: Build User 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 (2)
src/v0/destinations/google_adwords_enhanced_conversions/config.js (1)

12-12: No functional change — OK to keep.

Blank line insertion only; no ESLint concerns introduced.

src/v0/util/googleUtils/index.js (1)

7-7: Good choice using ConfigurationError.

Consistent with existing error semantics.

Comment thread src/v0/util/googleUtils/index.js Resolved
Comment thread .cursor/rules/pr-review-comments.mdc Resolved
Comment thread src/v0/util/googleUtils/index.js Resolved
Comment thread test/setup.ts Resolved
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

ItsSudip
ItsSudip previously approved these changes Sep 15, 2025
koladilip
koladilip previously approved these changes Sep 16, 2025
@utsabc
utsabc dismissed stale reviews from koladilip and ItsSudip via 0cd7569 September 23, 2025 04:32
@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 (1)
src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (1)

18-18: Consolidate googleUtils requires into one import

Avoid duplicate requires from the same module; it’s cleaner and can prevent linter warnings in some setups.

Apply:

-const { getDeveloperToken } = require('../../util/googleUtils');
+const { getDeveloperToken, getAuthErrCategory } = require('../../util/googleUtils');

…and remove the separate getAuthErrCategory require at Line 24.

Also applies to: 24-24

📜 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 3170639 and 0cd7569.

📒 Files selected for processing (3)
  • src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js (2 hunks)
  • src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (2 hunks)
  • src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js
  • src/v0/destinations/google_adwords_remarketing_lists/networkHandler.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/google_adwords_offline_conversions/networkHandler.js
🧬 Code graph analysis (1)
src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (2)
src/v0/util/googleUtils/index.js (1)
  • getDeveloperToken (149-155)
src/adapters/network.js (1)
  • headers (372-372)
⏰ 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: UT Tests
  • GitHub Check: test_and_publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (2)
src/v0/destinations/google_adwords_offline_conversions/networkHandler.js (2)

208-209: Header injection looks correct and aligns with the “headers-only” approach

Matches prior feedback to keep the developer token only in request headers.


208-209: Harden header mutation (default + avoid mutating request.headers)

File: src/v0/destinations/google_adwords_offline_conversions/networkHandler.js Lines: 208-209

headers['developer-token'] = getDeveloperToken() will throw if request.headers is undefined and mutating the incoming headers can produce side‑effects. Default and copy:

  • Minimal (safer default): const { method, endpoint, headers = {}, params, body, metadata } = request;
  • Optional (avoid mutation; pass forward): const headersWithToken = { ...headers, 'developer-token': getDeveloperToken() };

Verification: ripgrep did not locate adapter code that guarantees headers is always present — verify adapter behavior or apply the change above.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
23 New Code Smells (required ≤ 1)
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@utsabc
utsabc merged commit 893da92 into develop Sep 23, 2025
@utsabc
utsabc deleted the feat.onboard-google-developer-token branch September 23, 2025 15:20
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.

4 participants