feat(openfeature): add semantic version operators for feature flag evaluation - #12182
Conversation
|
🎯 Code Coverage (details) 🔗 Commit SHA: 0d82561 | Docs | Datadog PR Page | Give us feedback! |
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9aba09100
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Shard totals above 2^31 are accepted but narrowed during hashing, silently selecting different variations than Go. The new SemVer preprocessing also dereferences null nested list elements, so one malformed flag can reject an otherwise valid remote-config update.
📊 Validated against 9 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit a9aba09 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
Port the SemVer condition operators (SEMVER_EQ, SEMVER_NEQ, SEMVER_LT, SEMVER_LTE, SEMVER_GT, SEMVER_GTE) from dd-trace-go PR #5128 to the Java SDK. This includes: - ParsedSemver: a Rust-compatible SemVer parser and comparator that owns its own parsing logic for cross-SDK consistency. Core components use unsigned 64-bit semantics; numeric prerelease identifiers support arbitrary length; build metadata is validated but ignored for precedence. - ConditionOperator: 6 new enum values for the SEMVER_* operators. - ConditionConfiguration: transient semverComparand field to cache the parsed comparand during config validation. - ServerConfiguration: transient invalidFlags map so the evaluator can return PARSE_ERROR for flags with invalid semver comparands. - DDEvaluator: evaluateSemverCondition method and switch cases for all 6 operators; invalid-flag check returning PARSE_ERROR. - UniversalFlagConfigParser: validateAndCacheSemverComparands during parsing, with InvalidSemverComparandException for non-string or unparseable values. - Update ffe-system-test-data submodule to main (ea8b5cc) which includes the semver comparison and validation fixtures from PRs #20 and #22. - Unit tests: ParsedSemverTest (30 tests ported from Go semver_test.go), DDEvaluatorTest semver condition tests (28 parameterized + 2 edge cases), and canonical fixture tests (22 cases from the two system test PRs).
11f89ba to
9a96436
Compare
0ebaa3e to
675c451
Compare
- DDEvaluator: return DEFAULT for invalid (non-semver) flags instead of FLAG_NOT_FOUND, add POSIX character class normalization for regex matching, use DEFAULT reason for date-gated allocations with no rules - DDEvaluatorTest: add FlagMapAdapter with per-flag error isolation matching production parser, wire up INVALID_FLAGS_HOLDER - UniversalFlagConfigParser: add validateFlag for missing split shards, track invalid flags with INVALID_FLAG error type alongside semver - OpenFeatureProviderSmokeTest: null-safe buildLoggedAllocations for malformed allocation shapes
c7840bf to
f09ae33
Compare
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
|
/merge |
|
View all feedbacks in Devflow UI.
PR already in the queue with status in_progress |
What Does This Do
Ports SemVer condition operators (
SEMVER_EQ,SEMVER_NEQ,SEMVER_LT,SEMVER_LTE,SEMVER_GT,SEMVER_GTE) from dd-trace-go#5128 to the Java SDK.ParsedSemver— Rust-compatible SemVer parser and comparator (unsigned 64-bit core components, arbitrary-length numeric prerelease identifiers, build metadata validated but ignored for precedence).ConditionOperator— 6 new enum values.ConditionConfiguration— transientsemverComparandfield cached during config validation.ServerConfiguration— transientinvalidFlagsmap so the evaluator returnsPARSE_ERRORfor flags with invalid semver comparands.DDEvaluator—evaluateSemverConditionmethod and switch cases for all 6 operators; invalid-flag check returningPARSE_ERROR.UniversalFlagConfigParser— validates and caches semver comparands during parsing; invalid comparands cause the flag to be dropped and tracked.ffe-system-test-datasubmodule — updated to version that included the semver tests (aaa97e4) which includes ffe-system-test-data#20 and ffe-system-test-data#22.Motivation
Cross-SDK feature flag parity. The Go SDK added SemVer operators in dd-trace-go#5128; this ports the same functionality to Java so FFE targeting rules using
SEMVER_*operators evaluate identically across SDKs.Additional Notes
ParsedSemverTest(30 tests ported from Gosemver_test.go),DDEvaluatorTestsemver condition tests (28 parameterized + 2 edge cases).testEvaluateCanonicalFixtureparameterized test and theOpenFeatureProviderSmokeTest.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueJira ticket: FFL-2920