Skip to content

feat: Evaluate flags that depend on other flags - #150

Open
linear-code[bot] wants to merge 9 commits into
mainfrom
linear/sdk-6-enable-flag-dependency-in-the-php-server-side-sdk-3e8e
Open

linear-code[bot] wants to merge 9 commits into
mainfrom
linear/sdk-6-enable-flag-dependency-in-the-php-server-side-sdk-3e8e

Conversation

@linear-code

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

Copy link
Copy Markdown

Local evaluation ignores segments that depend on other flags ($.flags.<feature>.enabled), unlike flagsmith-engine and the Flagsmith API.

Closes SDK-6. Tested by engine-test-data v3.12.1 and sdk-spec v0.7.0.

Changes

  • Conditions on other flags ($.flags.<feature>.enabled, .value and .variant) are now evaluated, including chains of dependencies; circular dependencies serve the default with reason ERROR; code=CIRCULAR_DEPENDENCY.
  • Environment flags apply segments that don't need an identity, instead of ignoring all segments.
  • Flag results report the variant they were evaluated to.
  • Flags without segment overrides report STATIC instead of DEFAULT.
  • CI runs engine-test-data v3.12.1 and sdk-spec v0.7.0.

🤖 Generated with Claude Code

Segment conditions can now read other flags via `$.flags.<name>`,
resolved lazily with a cycle guard, mirroring flagsmith-engine. Flag
results also carry a `variant` key. Bumps engine-test-data to v3.11.0.

Generated with [Linear](https://linear.app/flagsmith/agent-session/d9c8ddc7-fa40-4842-80da-7e01be1b4f77)

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:14
@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: 39a5fefb-f7cb-40d4-a50e-21b3e8f37e02

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

Skip the lazy flags when there are no segments, and break the
context/flags reference cycle so each evaluation is freed by reference
counting rather than left to the cycle collector.

Generated with [Linear](https://linear.app/flagsmith/agent-session/d9c8ddc7-fa40-4842-80da-7e01be1b4f77)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@emyller
emyller force-pushed the linear/sdk-6-enable-flag-dependency-in-the-php-server-side-sdk-3e8e branch from 1649a50 to 744057b Compare October 27, 2026 02:23
emyller and others added 4 commits November 2, 2026 17:22
Bumps engine-test-data to v3.12.1, which expects it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Environment flags can now follow the flags they depend on, as in the Flagsmith API.

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 2, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 38.35%

⚡ 15 improved benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ getEnvironmentFlags[large] 16.4 s 6.7 s ×2.4
⚡ getEnvironmentFlags[small] 566.6 ms 322 ms +75.99%
⚡ getIdentityFlagsNoTraits[small] 1,091.9 ms 685.3 ms +59.33%
⚡ getIdentityFlagsWithIdentityOverrides[small] 1,089.6 ms 685.2 ms +59.02%
⚡ getEnvironmentFlags[medium] 2.7 s 1.8 s +48.63%
⚡ getIdentitySegmentsWithTraits[small] 1,301.4 ms 922.8 ms +41.03%
⚡ getIdentityFlagsWithTraits[small] 1,326.4 ms 942.7 ms +40.71%
⚡ getIdentityFlagsNoTraits[large] 27 s 21.3 s +26.94%
⚡ getIdentityFlagsWithIdentityOverrides[large] 26.3 s 21 s +25.14%
⚡ getIdentityFlagsWithTraits[large] 29.3 s 24.6 s +19.18%
⚡ getIdentitySegmentsWithTraits[large] 27.4 s 23 s +18.76%
⚡ getIdentityFlagsNoTraits[medium] 4.3 s 3.6 s +18.25%
⚡ getIdentityFlagsWithIdentityOverrides[medium] 4.3 s 3.7 s +16.66%
⚡ getIdentitySegmentsWithTraits[medium] 4.1 s 3.5 s +16.24%
⚡ getIdentityFlagsWithTraits[medium] 4.4 s 3.9 s +12.29%

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-6-enable-flag-dependency-in-the-php-server-side-sdk-3e8e (85c2f83) with main (a0d835d)

Open in CodSpeed

emyller and others added 3 commits November 2, 2026 18:11
Conditions such as `$.identity.identifier` or `$.flags.<feature>.enabled` skip JSONPath evaluation. Other paths are still evaluated by softcreatr/jsonpath.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Environment flags no longer deep-clone the context and select its identity-free segments on every call.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The engine leaves the context it evaluates untouched. Identity override rules now map an empty list of sub-rules, which deep-cloning used to fill in.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

1 participant