Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
khvn26 opened this issue Nov 28, 2023 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@khvn26
Copy link
Member

khvn26 commented Nov 28, 2023

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(
@khvn26 khvn26 self-assigned this Nov 28, 2023
@khvn26 khvn26 added the bug Something isn't working label Nov 28, 2023
@khvn26
Copy link
Member Author

khvn26 commented Nov 28, 2023

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
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant