Sorry, something went wrong.
⚠️ No Changeset foundLatest commit: 1d12eef Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset. This PR includes no changesetsWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Click here to learn what changesets are, and how to add one. Click here if you're a maintainer who wants to add a changeset to this PR |
Sorry, something went wrong.
There was a problem hiding this comment.
This pull request adds support for local evaluation of numeric transforms on BSON Int32Value and Decimal128Value types. While the changes successfully introduce these types to the local evaluation pipeline, the review highlights critical issues with type promotion. Specifically, if the operand is an Int32Value, it is not correctly treated as an integer type, causing incorrect promotion to Decimal128Value. Additionally, the code should ensure proper Decimal128Value promotion if either operand is a Decimal128Value. Finally, replacing unsafe non-null assertions with optional chaining in asNumber is recommended to prevent potential runtime crashes.
Sorry, something went wrong.
|
/gemini review |
Sorry, something went wrong.
There was a problem hiding this comment.
This pull request introduces support for local evaluation of numeric transform and increment operations on BSON types, specifically Int32Value and Decimal128Value. It updates the transform operations to handle mixed-type math, type promotion, and representation using reserved map keys, and includes comprehensive unit tests to verify these behaviors. There are no review comments, so I have no feedback to provide.
Sorry, something went wrong.
Fixes local evaluation of numeric transforms (increment, min, max) when mixing BSON (Int32Value / Decimal128Value) and standard JS numbers.
Bug: BSON operands failed constructor checks ("transform requires a NumberValue"), and BSON base values were unrecognized by isNumber() (returning the operand directly).
Fix: Unpacked BSON values in asNumber(), updated isNumber() to support BSON maps, and implemented precision promotion.
Before:
After:
Note: While the SDK doesn't support BSON types as arguments to increment(), the local evaluation layer still supports it, for the sake of robustness.