Tolerate any BSON numeric representation when deserializing concepts#2302
Merged
Conversation
ConceptSerializer read a numeric concept with a representation-specific reader (for example ReadInt32 for an int concept), which threw when the stored BSON type differed - notably when integral values flow through JSON-based pipelines (Chronicle projections materializing event content via ExpandoObject) and are persisted as Double. Read according to the actual stored BSON type and convert to the concept's underlying type so a concept deserializes regardless of how its value was stored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
NuGet packages for this PR, e.g. Cratis.Arc: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed
ConceptAs<T>values now deserialize from MongoDB regardless of the stored BSON numeric type. Numeric concepts (for example anint-backed concept) read with a representation-specific reader previously threwReadInt32 can only be called when CurrentBsonType is Int32, not when CurrentBsonType is Doublewhen the stored value had a different numeric representation — which happens when integral values flow through JSON-based pipelines (such as Chronicle projections that materialize event content viaExpandoObject) and are persisted asDouble. The value is now read according to its actual stored BSON type and converted to the concept's underlying type.