Skip to content

feat(Flag Dependency): Evaluate flags that depend on other flags - #240

Merged
emyller merged 6 commits into
mainfrom
linear/sdk-4-enable-flag-dependency-in-the-java-server-side-sdk-0bd0
Oct 29, 2026
Merged

emyller merged 6 commits into
mainfrom
linear/sdk-4-enable-flag-dependency-in-the-java-server-side-sdk-0bd0

Conversation

@linear-code

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

Copy link
Copy Markdown
Contributor

With local evaluation, the Java SDK can now serve a segment override that depends on another flag, the same way flagsmith-engine does for the Edge API. Until now, a condition such as $.flags.<feature>.enabled never matched in the Java SDK, so those overrides were silently skipped.

Changes

  • Flag dependency is now supported.
  • engine-test-data bumped to v3.11.0, the first release with flag dependency cases. All 219 cases pass.

Contributes to SDK-4

Closes #224

Review effort: 3/5

Port flagsmith-engine's flag dependency support: segment conditions on
`$.flags.<feature>.enabled`, `.value` and `.variant` read the evaluated
result of another flag, resolved lazily and transitively. Flags caught in
a dependency cycle are served with reason `ERROR; code=CIRCULAR_DEPENDENCY`,
and client-supplied `$.flags` are ignored.

Flag results now carry the selected multivariate `variant`, and engine-test-data
is bumped to v3.11.0, the first release with flag dependency cases.

Generated with [Linear](https://linear.app/flagsmith/agent-session/5657b1da-28c2-4081-a075-cae660cc325b)

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:35
@linear-code
linear-code Bot requested review from emyller and removed request for a team October 21, 2026 17:35

Copy link
Copy Markdown
Contributor

Why are there no unit tests in this PR?

…the context

Generated with [Linear](https://linear.app/flagsmith/agent-session/5657b1da-28c2-4081-a075-cae660cc325b)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@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: ee2ce0e7-1e77-4792-9270-78fe5dc58b6d

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

Comment @coderabbitai help to get the list of available commands.

…lag-dependency-in-the-java-server-side-sdk-0bd0

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

codspeed Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 18.62%

⚡ 10 improved benchmarks
❌ 1 (👁 1) regressed benchmark
✅ 4 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ getIdentityFlagsWithTraits[small] 2.5 ms 1.7 ms +44.22%
⚡ getIdentitySegmentsWithTraits[small] 2.5 ms 1.7 ms +42.54%
⚡ getIdentityFlagsWithIdentityOverrides[small] 2.2 ms 1.6 ms +36.52%
⚡ getIdentityFlagsNoTraits[small] 2.1 ms 1.6 ms +34.12%
⚡ getIdentityFlagsWithTraits[medium] 43.3 ms 34.3 ms +26.17%
⚡ getIdentityFlagsWithIdentityOverrides[medium] 42.2 ms 33.7 ms +25.24%
⚡ getIdentitySegmentsWithTraits[medium] 43.3 ms 34.7 ms +24.96%
⚡ getIdentityFlagsNoTraits[medium] 41.7 ms 33.6 ms +24.04%
⚡ getIdentitySegmentsWithTraits[large] 2.5 s 2.3 s +11.25%
⚡ getIdentityFlagsWithIdentityOverrides[large] 2.6 s 2.3 s +10.52%
👁 getEnvironmentFlags[small] 9.6 µs 16.7 µs -42.3%

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-4-enable-flag-dependency-in-the-java-server-side-sdk-0bd0 (c19fa07) with main (3e778a5)

Open in CodSpeed

@emyller

emyller commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Why are there no unit tests in this PR?

I think we rely on engine test data containing flag dependency test cases, and the new sdk-spec which is added with new flag dependency test cases.

@emyller
emyller merged commit 7f7f7ee into main Oct 29, 2026
17 checks passed
@emyller
emyller deleted the linear/sdk-4-enable-flag-dependency-in-the-java-server-side-sdk-0bd0 branch October 29, 2026 20:38
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