Repository navigation
feat: add value based audience to facebook custom audience destination - #4322
Conversation
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughThis change introduces support for a new user schema field, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant processRecordInputsV2
participant preparePayload
participant util_getUpdatedDataElement
User->>processRecordInputsV2: Provide groupedRecordInputs (with config)
processRecordInputsV2->>preparePayload: Pass events and config (with isValueBasedAudience)
preparePayload->>preparePayload: Validate LOOKALIKE_VALUE usage
preparePayload->>util_getUpdatedDataElement: Transform user data (including LOOKALIKE_VALUE)
util_getUpdatedDataElement-->>preparePayload: Return processed data
preparePayload-->>processRecordInputsV2: Return payload
Suggested reviewers
Suggestions for improvement:
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📥 CommitsReviewing files that changed from the base of the PR and between e7f814b88cf71c71bd723ac7b52403343a208575 and 5436b1f. ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms (8)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
Documentation and Community
|
|
Allure Test reports for this run are available at:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4322 +/- ##
========================================
Coverage 91.14% 91.14%
========================================
Files 638 638
Lines 33475 33484 +9
Branches 7903 7907 +4
========================================
+ Hits 30510 30519 +9
+ Misses 2726 2696 -30
- Partials 239 269 +30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/v0/destinations/fb_custom_audience/util.js (1)
149-152: Appropriate value handling for lookalike audiences.Good implementation for processing LOOKALIKE_VALUE by ensuring it's a finite number and defaulting to 0 if not. This prevents invalid values from being sent to Facebook's API.
Consider adding a warning log when defaulting to 0 for non-finite values to help with debugging:
if (eachProperty === 'LOOKALIKE_VALUE') { const finalValue = Number.isFinite(tmpUpdatedProperty) ? tmpUpdatedProperty : 0; + if (!Number.isFinite(tmpUpdatedProperty)) { + console.warn(`Non-finite value provided for LOOKALIKE_VALUE, defaulting to 0`); + } dataElement.push(finalValue); } else if (isHashRequired && eachProperty !== 'MADID' && eachProperty !== 'EXTERN_ID') {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📥 Commits
Reviewing files that changed from the base of the PR and between 302c12d and 3de623b38c4fafa58bdff36eb58ef4256485ddb7.
⛔ Files ignored due to path filters (2)
test/integrations/destinations/fb_custom_audience/router/data.tsis excluded by!**/test/**test/integrations/destinations/fb_custom_audience/router/rETL.tsis excluded by!**/test/**
📒 Files selected for processing (3)
src/v0/destinations/fb_custom_audience/config.js(1 hunks)src/v0/destinations/fb_custom_audience/recordTransform.js(5 hunks)src/v0/destinations/fb_custom_audience/util.js(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/v0/destinations/fb_custom_audience/config.jssrc/v0/destinations/fb_custom_audience/util.jssrc/v0/destinations/fb_custom_audience/recordTransform.js
🧬 Code Graph Analysis (1)
src/v0/destinations/fb_custom_audience/util.js (1)
src/v0/util/index.js (5)
require(19-19)require(20-26)require(28-28)require(32-32)require(34-34)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- 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: 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)
🔇 Additional comments (7)
src/v0/destinations/fb_custom_audience/config.js (1)
23-23: Addition of LOOKALIKE_VALUE looks good.The new
'LOOKALIKE_VALUE'field is appropriately added to the schema fields array, enabling support for Facebook value-based custom audiences. This simple change enables the system to recognize and validate this field type.src/v0/destinations/fb_custom_audience/util.js (2)
5-9: Clean up of imports is good.Restructuring the imports to source directly from
@rudderstack/integrations-libimproves code maintainability and follows better practices by standardizing imports across the codebase.
132-134: Proper handling for LOOKALIKE_VALUE.The function correctly handles the LOOKALIKE_VALUE field by returning the raw user information without string conversion, which is appropriate for numeric values expected in value-based audiences.
src/v0/destinations/fb_custom_audience/recordTransform.js (4)
121-130: Config destructuring updated appropriately.The addition of
isValueBasedAudienceto the destructured config object allows the function to access this flag for validation purposes. This is a clean way to pass the new configuration parameter.
151-155: Good validation to prevent misconfiguration.This validation correctly prevents users from using the LOOKALIKE_VALUE field in non-value-based audiences, which helps maintain data integrity and prevents API errors.
174-182: Appropriate validation for value-based audiences.This check ensures that value-based audiences include the required LOOKALIKE_VALUE field for the add operation, which is a good safeguard against invalid configurations.
261-262: Config parameter properly propagated.The
isValueBasedAudienceflag is correctly extracted from the connection config and passed to thepreparePayloadfunction, ensuring the validation logic works as expected.Also applies to: 283-283
|
Allure Test reports for this run are available at:
|
|
Allure Test reports for this run are available at:
|
|
Allure Test reports for this run are available at:
|
|
Allure Test reports for this run are available at:
|
|
Allure Test reports for this run are available at:
|
4ecc6bc to
613a07a
Compare
|
Allure Test reports for this run are available at:
|
|
Allure Test reports for this run are available at:
|
5edcd6d to
bd64f63
Compare
|
Allure Test reports for this run are available at:
|
bd64f63 to
e7f814b
Compare
|
Allure Test reports for this run are available at:
|
e7f814b to
5436b1f
Compare
|
Allure Test reports for this run are available at:
|
|



What are the changes introduced in this PR?
onboarding facebook value based custom audience
What is the related Linear task?
Resolves INT-3490
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 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.