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

fix: gaec schema #1787

Merged
merged 1 commit into from
Nov 7, 2024
Merged

fix: gaec schema #1787

merged 1 commit into from
Nov 7, 2024

Conversation

aashishmalik
Copy link
Contributor

@aashishmalik aashishmalik commented Nov 6, 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

    • Enhanced Google AdWords configuration now allows additional properties for greater flexibility.
    • Introduced new validation configurations, including rudderAccountId, listOfConversions, authStatus, and configData.
    • Updated UI placeholders for clearer guidance on input formats in the advanced mapping section.
  • Bug Fixes

    • Improved validation rules and error messages for existing configurations, ensuring stricter adherence to expected formats.

Copy link

coderabbitai bot commented Nov 6, 2024

Walkthrough

The pull request modifies the JSON schema for Google AdWords enhanced conversions by changing the additionalProperties attribute from false to true, allowing for extra properties in the configuration object. Additionally, it introduces a new configuration object in the validation JSON file, which includes fields like rudderAccountId, listOfConversions, authStatus, and configData. The validation rules for existing properties have been enhanced to ensure stricter adherence to expected formats and patterns.

Changes

File Change Summary
src/configurations/destinations/google_adwords_enhanced_conversions/schema.json Changed additionalProperties from false to true.
test/data/validation/destinations/google_adwords_enhanced_conversions.json Added a new configuration object with rudderAccountId, listOfConversions, authStatus, and configData. Enhanced validation rules for existing properties.
src/configurations/destinations/http/ui-config.json Updated placeholder text in "Query Parameters" and "Headers" sections for clarity on expected input formats.

Possibly related PRs

  • feat: gaec migration #1783: The changes in this PR involve modifications to the Google AdWords Enhanced Conversions configuration, specifically updating the defaultConfig and schema to include configData, which is directly related to the changes made in the main PR regarding the configData property.

Suggested reviewers

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

🐇 In the land of code where changes bloom,
A schema shifts, making room!
New fields added, validation tight,
AdWords conversions now shine bright.
With every tweak, our paths align,
In JSON's dance, our code will shine! 🌟


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

@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: 0

🧹 Outside diff range and nitpick comments (2)
test/data/validation/destinations/google_adwords_enhanced_conversions.json (1)

226-236: Review handling of sensitive data in test fixtures.

The configData field contains customer IDs which could be sensitive information. Consider:

  1. Using mock/anonymized data in test fixtures
  2. Adding a comment indicating that these are test values

Apply this diff to improve the test data:

       "authStatus": "active",
-      "configData": "{\"customerId\": \"1234567890\", \"loginCustomerId\": \"\"}"
+      "configData": "{\"customerId\": \"SAMPLE_ID\", \"loginCustomerId\": \"\"}" // Test values only
src/configurations/destinations/google_adwords_enhanced_conversions/schema.json (1)

Line range hint 1-249: LGTM with suggestions for improvement.

The schema structure is well-defined with appropriate validation patterns for existing properties. The change to allow additional properties is backwards-compatible and aligns with the validation file changes.

Consider adding:

  1. A schema description field to document the purpose and usage
  2. Examples of valid configurations in the schema
  3. Documentation for the regular expression pattern (^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$ used throughout
 {
   "configSchema": {
     "$schema": "http://json-schema.org/draft-07/schema#",
+    "description": "Configuration schema for Google AdWords Enhanced Conversions integration",
+    "examples": [
+      {
+        "configData": "{\"customerId\": \"123\"}",
+        "requireHash": true
+      }
+    ],
     "type": "object",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6e42f7f and 11ad344.

📒 Files selected for processing (2)
  • src/configurations/destinations/google_adwords_enhanced_conversions/schema.json (1 hunks)
  • test/data/validation/destinations/google_adwords_enhanced_conversions.json (1 hunks)
🔇 Additional comments (2)
test/data/validation/destinations/google_adwords_enhanced_conversions.json (1)

223-238: Verify schema validation for the new configuration object.

The new test case validates the structure of Google AdWords enhanced conversions configuration. Let's ensure the schema properly validates all fields.

✅ Verification successful

Let me analyze the schema validation rules for the new configuration object by searching for the schema definition.


Schema validation for the new configuration object is correct

The test case is valid according to the schema definition:

  • configData is required and properly formatted as a JSON string containing customer IDs
  • listOfConversions matches the array schema with valid conversion strings under 100 characters
  • Additional properties like rudderAccountId and authStatus are allowed due to "additionalProperties": true
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify schema validation rules for new fields

# Test: Search for schema validation rules for new fields
rg -A 5 '"rudderAccountId"|"listOfConversions"|"authStatus"|"configData"' --type json

# Test: Search for any existing usage of these fields
ast-grep --pattern 'rudderAccountId|listOfConversions|authStatus|configData'

Length of output: 47195


Script:

#!/bin/bash
# Search for schema definition for Google AdWords Enhanced Conversions
cat src/configurations/destinations/google_adwords_enhanced_conversions/schema.json

Length of output: 8790

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

6-6: Verify the necessity of allowing additional properties.

Changing additionalProperties to true relaxes the schema validation to allow undefined properties. While this aligns with the new configuration fields mentioned in the validation file (rudderAccountId, authStatus), it's important to ensure this flexibility is intentionally required.

Consider:

  1. Explicitly defining all known properties in the schema if possible
  2. Adding documentation about which additional properties are expected
  3. Adding property patterns if the additional properties follow specific formats
✅ Verification successful

The previous search was too broad. Let's specifically look for the validation test file and documentation to understand what additional properties are expected in the configuration.


Setting additionalProperties to true is justified and necessary

The validation test file confirms that additional top-level properties are indeed required and actively used in the configuration:

  • rudderAccountId
  • listOfConversions
  • authStatus
  • configData

These properties are being validated in the test cases and are essential for the destination's functionality. The schema change to allow additional properties is correct and intentional to support these configuration fields.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if there are any new properties being used in validation tests
# that necessitate this schema change

echo "Checking validation tests for new properties..."
rg -l "google_adwords_enhanced_conversions" test/data/validation/destinations/
rg -A 10 "google_adwords_enhanced_conversions" test/data/validation/destinations/*.json

Length of output: 11807


Script:

#!/bin/bash
# Let's check for the validation test file specific to google_adwords_enhanced_conversions
fd "google_adwords_enhanced_conversions.json" test/data/validation/destinations/ --exec cat {}

# Also check for any documentation about this destination
fd -e md -e txt . --exec grep -l "google_adwords_enhanced_conversions" {}

Length of output: 5859

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (6e42f7f) to head (d3129ea).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##           develop     #1787   +/-   ##
=========================================
  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.

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 (1)
test/data/validation/destinations/google_adwords_enhanced_conversions.json (1)

227-234: Enhance validation for listOfConversions array.

The current test case doesn't validate:

  • Empty array scenario
  • Duplicate conversion types
  • Invalid conversion types

Consider adding validation test cases for these scenarios:

{
  "config": {
    "listOfConversions": []  // empty array
  },
  "result": false,
  "err": ["listOfConversions must not be empty"]
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 11ad344 and d3129ea.

📒 Files selected for processing (3)
  • src/configurations/destinations/google_adwords_enhanced_conversions/schema.json (1 hunks)
  • src/configurations/destinations/http/ui-config.json (2 hunks)
  • test/data/validation/destinations/google_adwords_enhanced_conversions.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/configurations/destinations/http/ui-config.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/configurations/destinations/google_adwords_enhanced_conversions/schema.json
🔇 Additional comments (1)
test/data/validation/destinations/google_adwords_enhanced_conversions.json (1)

236-236: ⚠️ Potential issue

Review handling of sensitive data in test cases.

The configData field contains what appears to be a customer ID. Consider using placeholder or mock values in test cases to avoid exposing potentially sensitive information.

@aashishmalik aashishmalik merged commit faa4fa6 into develop Nov 7, 2024
12 checks passed
@aashishmalik aashishmalik deleted the fix.gaec branch November 7, 2024 09:17
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