flagsmith-sql-flag-engine 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flagsmith-sql-flag-engine
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: SQL translator for Flagsmith segment predicates.
5
5
  Author: Flagsmith
6
6
  Author-email: Flagsmith <engineering@flagsmith.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flagsmith-sql-flag-engine"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "SQL translator for Flagsmith segment predicates."
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Flagsmith", email = "engineering@flagsmith.com" }]
@@ -435,19 +435,13 @@ def translate_condition(cond: SegmentCondition, ctx: TranslateContext) -> str |
435
435
  identity: dict[str, object] = ctx.evaluation_context.get("identity") or {} # type: ignore[assignment]
436
436
  kind = classification.kind
437
437
  if not prop:
438
- # Implicit `$.identity.key` engine returns False when no
439
- # identity, or when the identity lacks `key`. The engine
440
- # never synthesises one from env+identifier.
441
- if not identity.get("key"):
442
- return "FALSE"
438
+ # In traditional engine implementations, this branch implies
439
+ # an identity-less context, which makes no sense for the SQL engine.
440
+ # Assume identity key.
443
441
  value_expr = ctx.dialect.cast_string(ctx.identity_key_expr)
444
442
  elif kind == "key":
445
- if not identity.get("key"):
446
- return "FALSE"
447
443
  value_expr = ctx.dialect.cast_string(ctx.jsonpath_expr("$.identity.key"))
448
444
  elif kind == "identifier":
449
- if not identity.get("identifier"):
450
- return "FALSE"
451
445
  value_expr = ctx.dialect.cast_string(ctx.jsonpath_expr("$.identity.identifier"))
452
446
  elif kind == "identity_object":
453
447
  # PERCENTAGE_SPLIT on `$.identity` — the whole dict. Engine