Skip to content

test(operators): add gherkin test coverage for custom operator error returns from flagd#1874 #21

@aepfli

Description

@aepfli

Background

flagd#1874 documents that custom operators must return null (not false) on error to trigger the default variant fallback in JSONLogic. The flagd-evaluator already implements the correct behavior for all operators, but error-path behavior is not covered by the shared gherkin test suite.

Missing Test Coverage

sem_ver — invalid version string

Rule: {"sem_ver": [{"var": "version"}, "=", "not-a-version"]}
Expected: returns null → default variant fallback.

sem_ver — unknown operator

Rule: {"sem_ver": [{"var": "version"}, "!=", "1.0.0"]} with an unknown comparator.
Expected: returns null → default variant fallback.

fractional — no bucket matched

When weights are misconfigured and no bucket is matched.
Expected: returns null → default variant fallback (not empty string or exception).

fractional — invalid input

Empty bucket list, missing bucket key, etc.
Expected: returns null → default variant fallback.

What Needs to Be Done

  1. Add flag definitions to the testbed for error-path scenarios
  2. Add @operator-errors gherkin scenarios covering each error path
  3. Add those scenarios to the evaluator's tests/gherkin_tests.rs

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions