Skip to content

_label_satisfies_expression silently returns False for unknown operators #718

Description

@raballew

Description

_label_satisfies_expression silently returns False when given an unrecognized operator string (including empty string ''). This masks bugs in callers -- an invalid operator produces the same result as a legitimate non-match, with no indication that something is wrong.

Steps to reproduce

from jumpstarter.client.selectors import _label_satisfies_expression

result = _label_satisfies_expression({"key": "value"}, "key", "", ["value"])
# Returns False silently -- no error raised

Expected behavior

Should raise ValueError for unrecognized operator strings, so callers are alerted to the invalid input rather than silently getting a False match result.

Actual behavior

Returns False without any error. The function only recognizes "in", "notin", "exists", "!exists", and "!=", and falls through to return False for anything else.

Location

python/packages/jumpstarter/jumpstarter/client/selectors.py, _label_satisfies_expression -- the final return False should be raise ValueError(f"unknown label selector operator: {operator!r}").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions