Skip to content

feat(Flag Dependency): Evaluate flags that depend on other flags in local evaluation - #67

Merged
emyller merged 8 commits into
mainfrom
linear/sdk-9-enable-flag-dependency-in-the-elixir-server-side-sdk-e957
Nov 4, 2026
Merged

emyller merged 8 commits into
mainfrom
linear/sdk-9-enable-flag-dependency-in-the-elixir-server-side-sdk-e957

Conversation

@linear-code

@linear-code linear-code Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Local evaluation ignores conditions on other flags, so a flag that depends on another flag is served as if it didn't.

Contributes to SDK-9. Tested by engine-test-data v3.12.1.

Changes

  • Identity flags apply overrides of segments that depend on other flags ($.flags.<feature>.enabled), including chains of dependencies. Segments caught in a cycle don't match.
  • Segment conditions on $.identity.* and $.environment.* now work.
  • Identity evaluation is faster for repeated calls: each environment is prepared once per process and reused.
  • engine-test-data goes to v3.12.1, superseding deps: update dependency test/support/engine-test-data to v3.13.2 #66.

🤖 Generated with Claude Code

Closes #57

…ocal evaluation

Port flagsmith-engine's context evaluator, including flag dependency, and
run identity flags through it. Bump engine-test-data to v3.12.1 and run
all of its test cases.

Generated with [Linear](https://linear.app/flagsmith/agent-session/51c26f09-5fe3-44a8-8e3d-be2cf9ac50ff)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@linear-code
linear-code Bot requested a review from a team as a code owner October 21, 2026 17:22
@linear-code
linear-code Bot requested review from khvn26 and removed request for a team October 21, 2026 17:22
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 07be1d59-a63b-4316-a755-95bf62b7e457

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Split the evaluator into a prepare step for the environment, with segment
conditions compiled, and a per identity evaluation step. The prepared
environment is kept per process for the environment last evaluated, and
segments are evaluated without flags when only segments are asked for.

Generated with [Linear](https://linear.app/flagsmith/agent-session/51c26f09-5fe3-44a8-8e3d-be2cf9ac50ff)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@emyller
emyller force-pushed the linear/sdk-9-enable-flag-dependency-in-the-elixir-server-side-sdk-e957 branch from f06f112 to c58b7b3 Compare October 27, 2026 02:23
emyller and others added 3 commits November 3, 2026 18:10
…r flags

Environment flags apply the overrides of segments that need no identity,
i.e. conditions only on `$.environment` and `$.flags`, as the Flagsmith API
does. `hide_disabled_flags` now hides flags by their evaluated state.

Identity evaluation is faster: flags not overridden are evaluated once per
environment, variant splits are sorted once per environment, and identity
overrides no longer go through a segment of their own.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@codspeed

codspeed Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by ×2.3

⚡ 6 improved benchmarks
✅ 6 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ get_identity_flags_with_traits[large] 53.6 ms 4.7 ms ×11
⚡ get_identity_flags_with_traits[medium] 2,520.1 µs 923.2 µs ×2.7
⚡ get_identity_flags_with_traits[small] 466.5 µs 208.6 µs ×2.2
⚡ get_identity_flags_no_traits[large] 3.7 ms 2.7 ms +33.87%
⚡ get_identity_flags_no_traits[medium] 729.3 µs 584.4 µs +24.8%
⚡ get_identity_flags_with_identity_overrides[medium] 729.2 µs 587.7 µs +24.08%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing linear/sdk-9-enable-flag-dependency-in-the-elixir-server-side-sdk-e957 (ca8c807) with main (edb95fb)

Open in CodSpeed

@emyller

emyller commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Action not completed

Review skipped.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Zaimwa9
Zaimwa9 previously requested changes Nov 4, 2026

@Zaimwa9 Zaimwa9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minors but still requesting a change to have the key schema on par with other SDKs.

Ready to approve right after

Comment thread lib/engine/mappers.ex Resolved
Comment thread lib/engine/mappers.ex Resolved
Empty strings were cast to nil when parsing environment documents and
API responses, so flags served nil instead of "" and IS_SET conditions
on flag values diverged from other SDKs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comment thread lib/engine/evaluator.ex Resolved
Comment thread lib/flagsmith_engine.ex Resolved
emyller and others added 2 commits November 4, 2026 17:49
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Results now carry build-time contracts matching the SDK evaluation result
schema, instead of string-keyed maps that typespecs cannot describe.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@emyller
emyller dismissed Zaimwa9’s stale review November 4, 2026 21:11

Concerns addressed while on opposite timezone. Thanks!

@emyller
emyller merged commit 260c966 into main Nov 4, 2026
5 checks passed
@emyller
emyller deleted the linear/sdk-9-enable-flag-dependency-in-the-elixir-server-side-sdk-e957 branch November 4, 2026 21:12
emyller pushed a commit that referenced this pull request Nov 4, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.4.0](v2.3.1...v2.4.0)
(2026-11-04)


### Features

* **CI:** Set up CodSpeed
([#68](#68))
([edb95fb](edb95fb))
* **Flag Dependency:** Evaluate flags that depend on other flags in
local evaluation
([#67](#67))
([260c966](260c966))


### Bug Fixes

* Send identity trait values as plain JSON values
([#60](#60))
([f259ff8](f259ff8))


### CI

* Label Renovate's SDK spec bump PRs
([#62](#62))
([77b5e9a](77b5e9a))
* Run the Flagsmith SDK behavioural spec
([#61](#61))
([45b5617](45b5617))
* setup Renovate for engine-test-data tracking
([#56](#56))
([60090c0](60090c0))


### Other

* Remove amannn/action-semantic-pull-request workflow
([#53](#53))
([19414f3](19414f3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support $.flags context values in segment conditions

3 participants