Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gaec migration #1783

Merged
merged 1 commit into from
Nov 6, 2024
Merged

feat: gaec migration #1783

merged 1 commit into from
Nov 6, 2024

Conversation

aashishmalik
Copy link
Contributor

@aashishmalik aashishmalik commented Nov 5, 2024

What are the changes introduced in this PR?

Write a brief explainer on your code changes.

What is the related Linear task?

Resolves INT-XXX

Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

N/A

Any new dependencies introduced with this change?

N/A

Any new checks got introduced or modified in test suites. Please explain the changes.

N/A


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?

  • I have executed schemaGenerator tests and updated schema if needed

  • Are sensitive fields marked as secret in definition config?

  • My test cases and placeholders use only masked/sample values for sensitive fields

  • Is the PR limited to 10 file changes & one task?

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.

Summary by CodeRabbit

  • New Features

    • Introduced a new structured selection mechanism for account configuration, replacing direct input fields with a "Select account" option.
    • Added new properties to the configuration schema, enhancing validation and ensuring necessary data is provided.
  • Bug Fixes

    • Improved user experience by streamlining the configuration interface and removing outdated fields.
  • Documentation

    • Updated configuration requirements and validation rules for Google Ads Enhanced Conversions.

Copy link

coderabbitai bot commented Nov 5, 2024

Walkthrough

The changes focus on updating the configuration files for Google Ads Enhanced Conversions. The db-config.json file modifies the defaultConfig array by removing certain entries and adding configData. The schema.json introduces stricter validation rules, requiring configData, and adds new properties like requireHash and listOfConversions. The ui-config.json file alters the user interface by replacing input fields, streamlining account selection, and integrating new dependencies. Overall, these modifications enhance configuration management and user experience.

Changes

File Path Change Summary
src/configurations/destinations/google_adwords_enhanced_conversions/db-config.json - Updated defaultConfig: Removed "customerId" and "subAccount"; added "configData".
- Remaining entries: "rudderAccountId", "listOfConversions", "requireHash".
src/configurations/destinations/google_adwords_enhanced_conversions/schema.json - Added properties: "configData" (string), "requireHash" (boolean), and "listOfConversions" (array of objects).
- Modified: Required properties now include "configData"; disallowed additional properties.
src/configurations/destinations/google_adwords_enhanced_conversions/ui-config.json - Updated field type from "textInput" to "nestedSelect" for account selection.
- Changed field label from "Customer ID" to "Select account".
- Updated configuration key from "customerId" to "configData".
- Revised prerequisites and added "apiDependencies": ["rudderAccountId"].

Suggested reviewers

  • lvrach
  • am6010
  • AchuthaSourabhC
  • ssbeefeater
  • debanjan97
  • cisse21
  • ruchiramoitra
  • 1abhishekpandey
  • ItsSudip
  • sandeepdsvs
  • shrouti1507
  • krishna2020

🐰 In the fields where bunnies play,
New configs hop in, brightening the day.
With configData now in sight,
Enhanced conversions take flight!
A nested select for accounts to choose,
Streamlined paths, no more to lose!
Hooray for changes, let’s all cheer,
For a smoother journey, year after year! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (300f547) to head (53f1f79).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##           develop     #1783   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           53        53           
  Branches         7         7           
=========================================
  Hits            53        53           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aashishmalik aashishmalik force-pushed the feat.gaec-migration branch 4 times, most recently from d05f09b to 929ec90 Compare November 5, 2024 14:40
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (4)
src/configurations/destinations/google_adwords_enhanced_conversions/db-config.json (1)

45-45: Document the migration process.

Since this is part of the GAEC migration (INT-XXX), please add documentation that covers:

  1. The new configuration structure using configData
  2. Migration steps for existing implementations
  3. Any required changes in the destination setup process
src/configurations/destinations/google_adwords_enhanced_conversions/ui-config.json (1)

16-29: Consider adding validation feedback.

The current implementation could benefit from additional UX improvements:

  1. Add loading state indication during API calls
  2. Include error state handling for API failures
  3. Add validation feedback for selected accounts

Consider adding these properties to enhance user feedback:

 {
   "type": "nestedSelect",
   "label": "Select account",
   "apiName": "getConfigData",
   "configKey": "configData",
   "placeholder": "Select account details",
+  "loadingLabel": "Fetching accounts...",
+  "errorLabel": "Failed to load accounts. Please try again.",
+  "validation": {
+    "required": true,
+    "messages": {
+      "required": "Please select an account"
+    }
+  },
   "preRequisites": {
src/configurations/destinations/google_adwords_enhanced_conversions/schema.json (2)

12-15: Add documentation for requireHash property.

The purpose and implications of this flag aren't clear. Please add:

  • Description field explaining when hashing is required
  • Documentation about the impact of this setting
  • Examples of when it should be true/false
       "requireHash": {
         "type": "boolean",
-        "default": true
+        "default": true,
+        "description": "Specify whether enhanced conversion values should be hashed before sending to Google Ads"
       },

16-27: Enhance validation for listOfConversions.

The current implementation could benefit from additional constraints:

  1. No limits on array size could lead to performance issues
  2. Pattern allows very short strings that might be invalid
  3. Missing description of expected conversion format
       "listOfConversions": {
         "type": "array",
+        "minItems": 1,
+        "maxItems": 100,
+        "description": "List of conversion actions to be tracked",
         "items": {
           "type": "object",
           "properties": {
             "conversions": {
               "type": "string",
-              "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
+              "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{3,100})$",
+              "description": "Conversion action ID or template expression"
             }
           },
+          "required": ["conversions"],
+          "additionalProperties": false
         }
       },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 300f547 and 53f1f79.

📒 Files selected for processing (3)
  • src/configurations/destinations/google_adwords_enhanced_conversions/db-config.json (1 hunks)
  • src/configurations/destinations/google_adwords_enhanced_conversions/schema.json (1 hunks)
  • src/configurations/destinations/google_adwords_enhanced_conversions/ui-config.json (1 hunks)
🔇 Additional comments (5)
src/configurations/destinations/google_adwords_enhanced_conversions/db-config.json (2)

45-45: Ensure secure handling of sensitive data.

The consolidation of account configuration into configData requires careful handling of sensitive information. Please verify:

  1. The configData field is properly encrypted in storage
  2. No sensitive information is exposed in logs
#!/bin/bash
# Description: Check if configData is included in the secretKeys array
# in any related configuration files

echo "Checking for proper handling of configData..."
rg -A 10 '"secretKeys":\s*\[' \
  --glob 'src/configurations/destinations/google_adwords_enhanced_conversions/*.json'

45-45: ⚠️ Potential issue

Verify backward compatibility of the configuration changes.

The removal of direct configuration fields (customerId, subAccount, loginCustomerId) in favor of configData could potentially impact existing implementations. Please ensure:

  1. Existing destinations continue to work after this change
  2. A migration path exists for existing configurations
✅ Verification successful

Based on the comprehensive analysis of the configuration files, I can now provide the final response:

Configuration changes are backward compatible and well-structured

The changes to the Google Ads Enhanced Conversions configuration are safe and backward compatible for the following reasons:

  1. The removed fields (customerId, subAccount, loginCustomerId) are now encapsulated within the new configData field, which has a default value that maintains the customer ID structure: {"customerId": "123"}
  2. The configuration is obtained through an API endpoint (getConfigData), ensuring proper account selection through the UI
  3. The schema enforces proper validation with required fields and maintains the same pattern validation
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for existing usage of removed fields in other configuration files
# and deployment manifests to assess the impact.

echo "Checking for usage of removed fields..."
rg -l "customerId|subAccount|loginCustomerId" \
  --type json \
  --glob '!**/node_modules/**' \
  --glob '!**/dist/**' \
  --glob '!**/build/**'

Length of output: 900


Script:

#!/bin/bash
# Let's try a more comprehensive search to understand the configuration changes

# 1. Search for any references to the removed fields in the entire codebase
echo "Searching for references to removed fields..."
rg -A 5 "customerId|subAccount|loginCustomerId" \
  --type-add 'config:*.{json,js,ts,jsx,tsx}' \
  --type config \
  --glob '!**/node_modules/**' \
  --glob '!**/dist/**' \
  --glob '!**/build/**'

# 2. Check the specific destination configuration structure
echo -e "\nChecking destination configuration structure..."
cat src/configurations/destinations/google_adwords_enhanced_conversions/db-config.json

# 3. Look for any migration or upgrade related files
echo -e "\nSearching for migration documentation..."
fd -e md -e txt . | xargs rg -l "google.*enhanced.*conversion.*migrat|GAEC.*migrat"

Length of output: 65656


Script:

#!/bin/bash
# Let's check the schema and UI configuration to understand how configData is structured

echo "Checking schema and UI configuration..."
cat src/configurations/destinations/google_adwords_enhanced_conversions/schema.json
echo -e "\nChecking UI configuration..."
cat src/configurations/destinations/google_adwords_enhanced_conversions/ui-config.json

# Also check for any related test files that might show the migration path
echo -e "\nChecking for related test files..."
fd -t f -e json -e js -e ts . | grep -i "google.*adwords.*enhanced.*conversion.*test"

Length of output: 16657

src/configurations/destinations/google_adwords_enhanced_conversions/ui-config.json (2)

16-20: Improved UI for account selection.

The change from text input to a nested select with API integration is a good improvement that will reduce user error and provide a better user experience.


24-25: Verify migration path for existing configurations.

The change from manual Customer ID input to API-based selection needs careful consideration for existing configurations.

Let's verify the presence of existing configurations that might be affected:

Also applies to: 28-29

✅ Verification successful

Migration path for existing configurations is handled appropriately

The git history shows that this is a new destination configuration file (added in commit 53f1f79) where the customerId field was directly replaced with the API-based account selection in the same commit. Since this is the initial commit adding this destination, there are no existing configurations that would be affected by this change.

The change from manual Customer ID input to API-based selection is safe because:

  1. This is a new destination being introduced
  2. The change was made in the initial commit itself
  3. The API endpoint will handle the customer ID selection through configData field, maintaining backward compatibility through the schema default value: {"customerId": "123"}
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for existing configurations using the old customerId field
rg -l '"customerId"' src/configurations/destinations/google_adwords_enhanced_conversions/

Length of output: 91


Script:

#!/bin/bash
# Let's check the git history for any changes related to customerId in this configuration
git log -p -- src/configurations/destinations/google_adwords_enhanced_conversions/ui-config.json

# Also search for any references to customerId in the entire codebase
rg "customerId" -A 2 -B 2

Length of output: 57066

src/configurations/destinations/google_adwords_enhanced_conversions/schema.json (1)

5-6: ⚠️ Potential issue

Breaking changes detected in schema requirements.

The changes introduce two breaking changes that contradict the PR objectives:

  1. Making configData required will break existing configurations that don't have this field
  2. Setting additionalProperties to false will reject configurations with any custom fields

Consider:

  • Adding a migration plan for existing configurations
  • Documenting these breaking changes in the PR description
  • Potentially making these changes backward compatible

Let's verify if there are existing configurations that would break:

@aashishmalik aashishmalik merged commit 6e42f7f into develop Nov 6, 2024
12 checks passed
@aashishmalik aashishmalik deleted the feat.gaec-migration branch November 6, 2024 05:07
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.

3 participants