Skip to content

Conversation

@harsh-joshi99
Copy link
Contributor

@harsh-joshi99 harsh-joshi99 commented Jan 19, 2026

In HubSpot custom event actions, numeric string values in properties were being inferred as numbers. When the corresponding property in HubSpot was actually defined as a string, this resulted in schema mismatch errors.

This PR updates the inference logic to correctly handle numeric strings. If a value is inferred as a number but the property type in HubSpot is a string, we convert the value back to a string before sending it.

JIRA -> https://twilio-engineering.atlassian.net/browse/STRATCONN-6467

Testing

Testing Document

Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [If destination is already live] Tested for backward compatibility of destination. Note: New required fields are a breaking change.
  • [Segmenters] Tested in the staging environment
  • [Segmenters] [If applicable for this change] Tested for regression with Hadron.

Security Review

Please ensure sensitive data is properly protected in your integration.

  • Reviewed all field definitions for sensitive data (API keys, tokens, passwords, client secrets) and confirmed they use type: 'password'

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.03%. Comparing base (fbf248e) to head (f23b55f).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...mEvent/functions/hubspot-event-schema-functions.ts 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3523       +/-   ##
===========================================
+ Coverage   31.86%   80.03%   +48.17%     
===========================================
  Files          15     1249     +1234     
  Lines         747    23142    +22395     
  Branches      126     4607     +4481     
===========================================
+ Hits          238    18522    +18284     
- Misses        509     3759     +3250     
- Partials        0      861      +861     

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a schema mismatch issue in the HubSpot custom event action where numeric string values (e.g., "123") were being inferred as numbers during schema creation, but HubSpot had the corresponding properties defined as strings, causing validation errors.

Changes:

  • Adds logic to detect when a property is inferred as a number but HubSpot expects a string, and converts the value to a string before sending
  • Implements conversion for both cache hit scenarios (using cached schema) and cache miss scenarios (fetching from HubSpot)
  • Adds comprehensive test coverage for various numeric string scenarios including single properties, multiple properties, partial matches, and verification that actual numbers remain unconverted

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
types.ts Adds numericStrings array to SchemaDiff type to track properties requiring conversion
index.ts Adds call to convertNumericStrings for cache hits and passes payload to getSchemaFromHubspot for conversion
hubspot-event-schema-functions.ts Implements numeric-to-string conversion logic when fetching schema from HubSpot, distinguishing string mismatches from other type mismatches
cache-functions.ts Adds numericStrings tracking in compareSchemas and implements convertNumericStrings utility function
index.test.ts Adds comprehensive test suite covering cache hits, cache misses, multiple numeric strings, partial property matches, and validation that actual numbers aren't converted

@harsh-joshi99 harsh-joshi99 marked this pull request as ready for review January 19, 2026 08:29
@harsh-joshi99 harsh-joshi99 requested a review from a team as a code owner January 19, 2026 08:29
@joe-ayoub-segment
Copy link
Contributor

PR reviewed.
image

Copy link
Contributor

@joe-ayoub-segment joe-ayoub-segment left a comment

Choose a reason for hiding this comment

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

See comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants