feat: support semantic version conditions - #365
Merged
Conversation
greghuels
force-pushed
the
greg.huels/FFL-2921/semver-node
branch
from
August 13, 2026 11:24
49f2b5f to
797e813
Compare
greghuels
marked this pull request as ready for review
August 13, 2026 11:26
greghuels
force-pushed
the
greg.huels/FFL-2921/semver-node
branch
from
August 13, 2026 11:29
797e813 to
b5d8726
Compare
dd-oleksii
approved these changes
Aug 13, 2026
| allocation.splits.every((split) => Array.isArray(split.shards)) && | ||
| (allocation.rules === undefined || | ||
| (Array.isArray(allocation.rules) && allocation.rules.every((rule) => isValidRule(rule)))) | ||
| Array.isArray(allocation.rules) && allocation.rules.some((rule) => hasInvalidSemverComparand(rule)) |
Member
There was a problem hiding this comment.
minor: shall this be moved to isValidRule?
| } | ||
|
|
||
| const value = version.slice(start, end) | ||
| if (value.length > MAX_UINT64.length || (value.length === MAX_UINT64.length && value > MAX_UINT64)) { |
Member
There was a problem hiding this comment.
minor: why do we artificially limit the max value?
Collaborator
Author
There was a problem hiding this comment.
For parity with implementation in other dd-trace libraries. It shouldn't matter too much either way, since this won't be a real-world use case.
| * Core identifiers are limited to uint64; numeric prerelease identifiers may | ||
| * be arbitrarily large. | ||
| */ | ||
| export function parseSemver(version: unknown): ParsedSemver | null { |
Member
There was a problem hiding this comment.
nitpick: the current implementation seems to be verbose and likely slow'ish
I have a feeling that a regex could be faster and shorter. Another option is to split on . and - and validate components afterwards
Collaborator
Author
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.

Summary
@datadog/flagging-core.SEMVER_EQ,SEMVER_NEQ,SEMVER_LT,SEMVER_LTE,SEMVER_GT, andSEMVER_GTE.DatadogNodeServerProvider.ffe-system-test-datatoaaa97e4, which has the SEMVER system tests.Why uint64-safe string comparison
The evaluator keeps SemVer core components as decimal strings instead of converting them to JavaScript
Numbervalues.uint64-bounded core components, including values aboveNumber.MAX_SAFE_INTEGER, so narrowing JavaScript toNumber.MAX_SAFE_INTEGERwould create cross-SDK differences.Numberparsing on every evaluation and is faster than converting the component strings to numbers at comparison time. It also avoids precision loss for large valid versions.