Skip to content

error: global flags not at the start of the expression at position 1 #196

Open

Description

@khvn26

Sentry Issue: FLAGSMITH-API-3Z3

error: global flags not at the start of the expression at position 1
(22 additional frame(s) were not displayed)
...
  File "environments/identities/views.py", line 231, in post
    instance = serializer.save()
  File "environments/sdk/serializers.py", line 154, in save
    all_feature_states = identity.get_all_feature_states(
  File "environments/identities/models.py", line 73, in get_all_feature_states
    segments = self.get_segments(traits=traits, overrides_only=True)
  File "environments/identities/models.py", line 172, in get_segments
    if evaluate_identity_in_segment(

Activity

  1. self-assigned this
    on Nov 28, 2023
  2. khvn26 commented on Nov 28, 2023

    @khvn26
    MemberAuthor

    Minimal repro case:

    from flag_engine.identities.models import IdentityModel, TraitModel
    from flag_engine.segments.evaluator import evaluate_identity_in_segment
    from flag_engine.segments.models import (
        SegmentConditionModel,
        SegmentModel,
        SegmentRuleModel,
    )
    
    identity = IdentityModel(
        identifier="foo",
        environment_api_key="foo",
        identity_traits=[TraitModel(trait_key="foo", trait_value="bar")],
    )
    segment = SegmentModel(
        id=1,
        name="foo_segment",
        rules=[
            SegmentRuleModel(
                type="ALL",
                conditions=[
                    SegmentConditionModel(operator="REGEX", value="^(?i)$", property_="foo")
                ],
            )
        ],
    )
    evaluate_identity_in_segment(identity, segment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions