Skip to content

fix(twitter_ads): classify non-string identifier failures as validation errors - #5752

Merged
shekhar-rudder merged 4 commits into
developfrom
harness/INT-7478-fix-twitter-ads-classify-non-st-128bbfdb
Nov 2, 2026
Merged

shekhar-rudder merged 4 commits into
developfrom
harness/INT-7478-fix-twitter-ads-classify-non-st-128bbfdb

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Reject non-string email, phone, ip_address and user_agent values with field-specific validation errors, and safely handle malformed event-name configuration. Add processor regression fixtures.

What is the related Linear task?

Resolves INT-7478

Please explain the objectives of your changes below

Prevent malformed customer identifiers from surfacing as retryable transformer 500s. Preserve valid string request shapes and hashes.

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

Every non-string identifier (number, boolean, array, object) that previously crashed trim() with a 500 now aborts with a 400 InstrumentationError naming the field; values are not coerced, so nothing is hashed from "true" or "0". twclid handling is unchanged (it never crashed). Whitespace-only phone values fall through to the existing missing-identifier guard. Invalid event-name mappings reach ConfigurationError.

Any new dependencies introduced with this change?

None.

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

None; the existing integrations-lib predicate is reused.

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

Monitor Twitter Ads abort counts after rollout and notify the affected account owner: malformed events will shift from retryable 500s to non-retryable 400s.

Validation

  • npm run lint — passed.

  • npm run build:ci and npx tsc --noEmit -p tsconfig.test.json — passed.

  • npm test -- --testPathPattern=twitter_ads --no-coverage --runInBand and npm run test:ts -- component --destination=twitter_ads --runInBand — passed.

  • Full-corpus secret-path regeneration and npm run check:secret-paths — passed; no artifact diff.

  • Local mini verification: built the transformer from develop and from this branch and sent the same track events to /v0/destinations/twitter_ads and /routerTransform:

    Input develop this PR
    numeric properties.phone 500 transformation — phone?.trim is not a function 400 instrumentation — properties.phone must be a string, received number
    numeric properties.email 500 transformation 400 instrumentation
    array properties.phone 500 transformation 400 instrumentation — names properties.phone
    numeric rudderEventName in config 500 transformation 400 configuration (no matching eventId)
    whitespace-only phone / string phone 400 / 200 unchanged
  • Simplify pass: reused the existing isDefinedAndNotNull/getType helpers; removed a redundant post-trim blankness check.

⚠️ Known Issues

npm run build cannot complete here because its copy step requires the unavailable system executable cpio; npm run build:ci passed.


Developer checklist

  • My code follows the style guidelines of this project
  • No breaking changes are being introduced. Intended change: malformed events now abort rather than retry.
  • All related docs linked with the PR?
  • All changes manually tested?
  • Any documentation changes needed with this change? No.
  • 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.

@rudder-devbox

rudder-devbox Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

👋 I'm rudder-devbox. I opened this PR from task INT-7478.

Mention @devbox or @rudder-devbox and I'll act on it — on a top-level PR comment,
in a review summary, or on an inline comment on the diff. Without a mention I won't see it.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 34e22f81-1809-4739-8438-4d71c836eaf0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.42%. Comparing base (0f4947b) to head (102f007).
⚠️ Report is 5 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5752   +/-   ##
========================================
  Coverage    92.42%   92.42%           
========================================
  Files          741      741           
  Lines        41048    41059   +11     
  Branches      9635     9643    +8     
========================================
+ Hits         37938    37949   +11     
  Misses        2848     2848           
  Partials       262      262           

☔ View full report in Codecov by Harness.
📢 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.

shekhar-rudder and others added 2 commits November 2, 2026 12:52
Reuse integrations-lib isPrimitive instead of a local type list, read all
identifiers together, compute the lowercased event name once, and drop the
unreachable bigint from the validation message.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…error

Numeric and boolean email/phone/ip_address/user_agent values crashed on
trim() with a 500; abort them with an InstrumentationError instead of
coercing them into hashes of "true"/"0". twclid keeps its original
handling since it never crashed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@shekhar-rudder
shekhar-rudder marked this pull request as ready for review November 2, 2026 09:26
Copilot AI balanced review requested due to automatic review settings November 2, 2026 09:26
@shekhar-rudder
shekhar-rudder requested review from a team as code owners November 2, 2026 09:26
shekhar-rudder
shekhar-rudder previously approved these changes Nov 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the Twitter Ads identifier-validation changes.

No open issues 🎉

What changed in this PR

This PR updates the Twitter Ads transformer so malformed identifiers produce non-retryable validation errors rather than transformer failures, while preserving valid string handling and hashes.

Changes:

  • Add field-specific validation for non-string email, phone, IP address, and user agent values.
  • Skip non-string event mapping names so unmatched events reach the existing configuration error.
  • Add processor regression fixtures for malformed identifiers, whitespace-only phones, and invalid mapping names.
File Description
test/​integrations/​destinations/​twitter_ads/​processor/​data.ts Adds regression cases for identifier validation and malformed event mappings.
test/​integrations/​destinations/​twitter_ads/​common.ts Provides shared destination and authentication fixtures.
src/​v0/​destinations/​twitter_ads/​transform.js Validates identifier types before trimming and guards event mapping name types.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 2, 2026 09:35
@rudder-devbox

rudder-devbox Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Both ARM64 image jobs failed in test/integrations/component.test.ts: PagerDuty, Adjust, and Signl4 fixtures each reported Exceeded timeout of 5000 ms for a test. The shared HTTP component runner relied on Jest’s 5-second default during the coverage run.

I set a bounded 30-second timeout for those component cases. The affected fixtures and Twitter Ads component tests pass locally; TypeScript and Prettier checks pass. The fix is pushed and CI will run on the new commit.

102f007

@rudder-devbox

rudder-devbox Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the Twitter Ads identifier-validation changes.

No open issues 🎉

Review effort: Balanced

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@shekhar-rudder
shekhar-rudder merged commit 9a7506a into develop Nov 2, 2026
53 checks passed
@shekhar-rudder
shekhar-rudder deleted the harness/INT-7478-fix-twitter-ads-classify-non-st-128bbfdb branch November 2, 2026 10:13
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