Skip to content

feat(af): add endpoint path to responses - #4631

Merged
koladilip merged 2 commits into
developfrom
feat/af-destination-updates
Sep 15, 2025
Merged

koladilip merged 2 commits into
developfrom
feat/af-destination-updates

Conversation

@koladilip

@koladilip koladilip commented Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Updated AF destination configuration and transform logic to improve data processing capabilities.

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

This PR includes updates to the AF (AppsFlyer) destination integration:

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

  • Enhanced AF destination configuration for better data handling
  • Improved transform logic for more accurate data processing
  • Updated test data and validation to ensure reliability

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

  • Updated test utilities in testUtils.ts for better integration testing support

Any technical or performance related pointers to consider with the change?

  • All changes maintain backward compatibility
  • Enhanced test coverage for better reliability

@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 16:33
@koladilip
koladilip requested review from a team, chandumlg and utsabc September 11, 2025 16:33
@coderabbitai

coderabbitai Bot commented Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Adds explicit endpoint path handling and includes endpointPath in responses for improved observability.
    • Supports v2 endpoint paths when using v2 authentication, ensuring requests route to the correct versioned API.
  • Refactor
    • Standardizes endpoint construction to reduce inconsistencies and simplify future maintenance.

Walkthrough

Refactors AF endpoint construction to derive path from a shared BASE_ENDPOINT_PATH/ENDPOINT_PATH constants, exports the new path constants, and propagates endpointPath in transform responses while keeping existing endpoint-selection and payload logic unchanged.

Changes

Cohort / File(s) Summary
AF config constants refactor
src/v0/destinations/af/config.js
Introduced BASE_ENDPOINT_PATH = '/inappevent/', added ENDPOINT_PATH and ENDPOINT_PATH_V2, rebuilt ENDPOINT/ENDPOINT_V2 from these, and exported the new path constants. No functional changes to mapping or Event logic.
AF transform integration
src/v0/destinations/af/transform.js
Imported ENDPOINT_PATH and ENDPOINT_PATH_V2, selected finalEndPointPath based on authVersion (parallel to finalEndPoint), and set response.endpointPath = finalEndPointPath in responseBuilderSimple. Endpoint selection and payload mapping unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant Transform as AF Transform
  participant Config as AF Config

  Caller->>Transform: request build response
  Transform->>Config: read ENDPOINT_PATH / ENDPOINT_PATH_V2
  Note right of Config: BASE_ENDPOINT_PATH = "/inappevent/" #ffe6cc
  Transform->>Transform: determine authVersion (v1/v2)
  alt authVersion == 'v2'
    Transform->>Transform: finalEndPoint = ENDPOINT_V2
    Transform->>Transform: finalEndPointPath = ENDPOINT_PATH_V2
  else
    Transform->>Transform: finalEndPoint = ENDPOINT
    Transform->>Transform: finalEndPointPath = ENDPOINT_PATH
  end
  Transform->>Transform: determineEndpoint(..., finalEndPoint, ...)
  Transform->>Caller: response (endpoint, endpointPath, payload)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • sivashanmukh
  • utsabc
  • chandumlg

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(af): add endpoint path to responses" is concise, follows conventional commit style, and accurately summarizes the primary change — exporting and populating endpoint path values for the AppsFlyer destination (see changes in src/v0/destinations/af/config.js and src/v0/destinations/af/transform.js). It is specific enough for a reviewer scanning history and contains no extraneous noise.
Description Check ✅ Passed The PR description largely follows the repository template: it includes a brief changelog, a link to Linear task INT-4102, objectives, notes on backward compatibility, and mentions updated test utilities and test coverage improvements, which align with the raw file summaries. The description could be clarified by explicitly listing dependent changes (none were reported) and by answering the "Any documentation changes needed" question, but it provides sufficient detail for reviewers to understand intent and scope.
✨ 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/af-destination-updates

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.

@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.79%. Comparing base (2fd8412) to head (ed5cd21).
⚠️ Report is 16 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4631   +/-   ##
========================================
  Coverage    91.78%   91.79%           
========================================
  Files          642      642           
  Lines        33941    33963   +22     
  Branches      8042     8043    +1     
========================================
+ Hits         31153    31175   +22     
  Misses        2536     2536           
  Partials       252      252           

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

@koladilip koladilip changed the title feat(af): update destination config and transform logic feat(af): add endpoint path to responses Sep 12, 2025
- Update AF destination configuration
- Enhance transform logic for better data processing
- Update test data and validation for AF destination
- Improve test utilities for integration testing
@koladilip
koladilip force-pushed the feat/af-destination-updates branch from 0c03538 to 1fd6bbc Compare September 15, 2025 04:34
@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
Comment thread src/v0/destinations/af/config.js Resolved
@koladilip
koladilip enabled auto-merge September 15, 2025 04:56
- Update AF destination configuration
- Enhance transform logic for better data processing
- Update test data and validation for AF destination
- Improve test utilities for integration testing
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@sonarqubecloud

Copy link
Copy Markdown

@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/af/transform.js (3)

22-25: Normalize config path to avoid double slashes in endpointPath.

Given config.js builds ENDPOINT_PATH as /v1/${BASE_ENDPOINT_PATH} and ENDPOINT_PATH_V2 as /v2/${BASE_ENDPOINT_PATH}, if BASE_ENDPOINT_PATH starts with /, endpointPath will be /v1//... or /v2//.... This can break strict assertions or downstream parsing.

Prefer fixing in config.js:

-const ENDPOINT_PATH = `/v1/${BASE_ENDPOINT_PATH}`;
-const ENDPOINT_PATH_V2 = `/v2/${BASE_ENDPOINT_PATH}`;
+const ENDPOINT_PATH = `/v1${BASE_ENDPOINT_PATH.startsWith('/') ? '' : '/'}${BASE_ENDPOINT_PATH}`;
+const ENDPOINT_PATH_V2 = `/v2${BASE_ENDPOINT_PATH.startsWith('/') ? '' : '/'}${BASE_ENDPOINT_PATH}`;

As a belt-and-suspenders alternative, you can also normalize at the assignment site (see comment on Line 105).


49-55: Normalize authVersion once and reuse; simplifies logic and avoids case-sensitivity pitfalls.

Today we compare raw authVersion strings in multiple places. Normalize once to reduce mistakes (e.g., 'V2') and make the code easier to read.

-  let finalEndPoint = ENDPOINT;
-  let finalEndPointPath = ENDPOINT_PATH;
-
-  if (authVersion === 'v2') {
-    finalEndPoint = ENDPOINT_V2;
-    finalEndPointPath = ENDPOINT_PATH_V2;
-  }
+  const authVer = (authVersion || 'v1').toLowerCase();
+  const finalEndPoint = authVer === 'v2' ? ENDPOINT_V2 : ENDPOINT;
+  const finalEndPointPath = authVer === 'v2' ? ENDPOINT_PATH_V2 : ENDPOINT_PATH;
-  const finalAuthentication =
-    isDefinedAndNotNull(authVersion) && authVersion === 'v2' ? s2sKey : devKey;
+  const finalAuthentication = authVer === 'v2' ? s2sKey : devKey;

Optional: if unsupported versions are possible, add a guard earlier to throw on anything other than 'v1' or 'v2'.

Also applies to: 100-102


105-105: Set endpointPath and normalize it; verify downstream consumers expect this new field.

Good addition. To avoid surprises from accidental //, normalize the path. Also, please confirm router/test utilities and any analytics that read endpointPath are updated.

-  response.endpointPath = finalEndPointPath;
+  response.endpointPath = finalEndPointPath.replace(/\/{2,}/g, '/');

If consumers expect the versioned, app-agnostic path (as introduced), this is fine. If they expect the exact request pathname (including app id), consider documenting the contract in code comments or tests.

📜 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 1fd6bbc and ed5cd21.

⛔ Files ignored due to path filters (1)
  • test/integrations/destinations/af/processor/validation.ts is excluded by !**/test/**
📒 Files selected for processing (2)
  • src/v0/destinations/af/config.js (2 hunks)
  • src/v0/destinations/af/transform.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/v0/destinations/af/config.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/af/transform.js
🧬 Code graph analysis (1)
src/v0/destinations/af/transform.js (1)
src/v0/destinations/af/config.js (4)
  • ENDPOINT (62-62)
  • ENDPOINT_PATH (60-60)
  • ENDPOINT_V2 (63-63)
  • ENDPOINT_PATH_V2 (61-61)
⏰ 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 (javascript-typescript)
  • GitHub Check: Analyze (go)

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