Skip to content

Rust resolver validates targeting key type even for 100% rollout flags #339

@nicklasl

Description

@nicklasl

Summary

The Java resolver skips targeting key validation when a flag has a 100% rollout, since bucketing is irrelevant in that case. The Rust resolver validates the targeting key type regardless of rollout percentage. This means a misconfigured context that passes an object as targeting_key will still resolve successfully in Java but fail with TARGETING_KEY_ERROR in Rust, even when the rollout percentage makes the key irrelevant.

Affected test cases

1. full_rollout_invalid_key_type

  • Setup: A flag with 100% rollout. The context provides targeting_key: {} (an object instead of a string).
  • Java: MATCH — the targeting key is not used for bucketing since it's a full rollout, so its type doesn't matter.
  • Rust: TARGETING_KEY_ERROR — the key type is validated before resolution proceeds.

Expected behavior

When a flag is configured for 100% rollout, the targeting key is not used for bucketing and its type should not be validated. This makes the resolver more resilient to context misconfigurations that don't actually affect the outcome.

Validation

Remove the "rust" override key from the full_rollout_invalid_key_type test case's 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

This test case is tracked in the spec test tests.json files with a "rust" override key that documents the divergent behavior. See the test name 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