Skip to content

Rust resolver doesn't implement eqRule with null value (is-null check) #337

@nicklasl

Description

@nicklasl

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions