Skip to content

Conversation

@vaibhav-jain-exp
Copy link
Contributor

@vaibhav-jain-exp vaibhav-jain-exp commented Jan 29, 2026

Summary

Fixes the following issues:

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

@macroscopeapp
Copy link

macroscopeapp bot commented Jan 29, 2026

Prevent TypeError and undefined literals by using util.safeStringTrim in assignment.Assignment.canonicalize and exposure.Exposure.canonicalize to sanitize user_id, device_id, key, and variant.key

Introduce util.safeStringTrim and update canonicalization in assignment and exposure to trim and coerce non-string identifiers, returning empty strings for null/undefined.

📍Where to Start

Start with util.safeStringTrim in string.ts, then review its use in assignment.Assignment.canonicalize in assignment.ts and exposure.Exposure.canonicalize in exposure.ts.

Changes since #71 opened

  • Added test coverage for Assignment.canonicalize, Exposure.canonicalize, and safeStringTrim utility function [03072dd]

Macroscope summarized 1b553b9.

@vaibhav-jain-exp vaibhav-jain-exp changed the title Fix TypeError in canonicalize() when user_id/device_id are non-strings fix: typeError in canonicalize() when user_id/device_id are non-strings Jan 29, 2026
@kyeh-amp
Copy link
Collaborator

Looks good, but could you add a unit test to check the original issue?

@vaibhav-jain-exp vaibhav-jain-exp merged commit 01b9e7f into main Feb 2, 2026
11 of 12 checks passed
@vaibhav-jain-exp vaibhav-jain-exp deleted the fix-number-trim branch February 2, 2026 20:57
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.

2 participants