spotify / spotify/confidence-resolver
Rust resolver doesn't implement eqRule with null value (is-null check)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16
- Forks
- 14
- Avg merge
- 2d 7m
- Merged PRs (30d)
- 40
Description
Summary
The Java resolver supports using eqRule with a null/empty value as an "is null" check — it matches when the context attribute is null or missing entirely. The Rust resolver does not implement this semantic, so null equality never matches, and NOT(null equality) always matches. This means the Rust resolver cannot express "is null" or "is not null" targeting conditions.
Affected test cases
1. is_null_explicit
- Context:
{ "null-attribute": null } - Java:
MATCH— the attribute is null and the eqRule checks for null, so it matches. - Rust:
NO_SEGMENT_MATCH— null equality is not implemented.
2. is_null_implicit
- Context: The attribute is missing entirely (not present in the evaluation context).
- Java:
MATCH— a missing attribute is treated as null, and the eqRule-null check matches. - Rust:
NO_SEGMENT_MATCH— null equality is not implemented.
3. is_not_null_missing
- Rule:
NOT(eqRule null)with the field missing from context. - Java:
NO_SEGMENT_MATCH— the inner eqRule matches (field is null/missing), so NOT inverts it to non-match. - Rust:
MATCH— the inner eqRule never matches (null equality not implemented), so NOT inverts it to match.
Expected behavior
eqRule with a null value should function as an "is null" check. This is needed for targeting rules that want to segment users based on whether an attribute is present or absent in the evaluation context.
Validation
For each fixed test case, remove the "rust" override key from its expectedResult in tests.json. The test should then pass using the "general" expectation, confirming the Rust resolver now matches Java's behavior. Run make -C confidence-resolver test to verify.
Spec test reference
These test cases are tracked in the spec test tests.json files with "rust" override keys that document the divergent behavior. See the test names listed above.
Related
These divergences were discovered while adding conformance tests from the Java resolver (PR #335).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the listed is_null_explicit, is_null_implicit, and is_not_null_missing cases in the tests.json files, then run make -C confidence-resolver test to reproduce the Rust divergence. Implement the missing null-equality behavior in the Rust resolver and remove each rust override key so the tests pass against the general expectation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100