Skip to content

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

Open
linear-code[bot] wants to merge 2 commits into
mainfrom
linear/sdk-4-enable-flag-dependency-in-the-java-server-side-sdk-0bd0
Open

linear-code[bot] wants to merge 2 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

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

  • Segment conditions can read another flag's enabled, value or variant, including chains of dependencies.
  • Flags caught in a dependency cycle serve their environment default, with reason ERROR; code=CIRCULAR_DEPENDENCY.
  • Flag values sent by the client in the context are ignored, so a client can't satisfy its own dependencies.
  • When two matching segments override a feature with the same priority, the first segment in the context wins, as in flagsmith-engine.
  • Flag results include the multivariate variant the identity was bucketed into.
  • engine-test-data bumped to v3.11.0, the first release with flag dependency cases. All 219 cases pass.

Out of scope: engine-test-data v3.12.x also expects the STATIC reason (flagsmith-engine#347), which is a separate change. On v3.12.1, the only failures are 118 cases whose reason differs.

Contributes to SDK-4

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
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5f68adbd-0aad-44e5-aa41-3e3e19c64b51

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.

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.

2 participants