You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: Evaluate flags that depend on other flags - #44
serde_json_path keeps parsed paths private, while jsonpath-rust exposes them,
so conditions can tell which flag a path reads.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Segment conditions can read another flag's `enabled`, `value` or `variant`
through `$.flags.<feature>`, as in flagsmith-engine. Flags in a dependency
cycle get `ERROR; code=CIRCULAR_DEPENDENCY`.
Also, as engine-test-data v3.12.1 expects:
- Flag results report the selected multivariate variant.
- Untargeted flags report `STATIC`, and targeted ones left at their default `DEFAULT`.
- Segments evaluate in context order, which also breaks override priority ties.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Environment flags can't resolve segments that need an identity, so
`remove_identity_from_context` keeps only those reading the environment or
other flags, as Flagsmith does for `/api/v1/flags`.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
This repository does not receive automatic reviews because it has fewer than 10 stars.
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: 0b8b3f3c-ea83-4d1b-9663-d765307c39df
Recent review info
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: 4a2e73d4-ecea-4e94-aba6-fccee4627cb1
Commits
Reviewing files that changed from the base of the PR and between f083e82 and 0552139.
Files selected for processing: 11
.gitmodules
Cargo.toml
src/engine.rs
src/engine_eval/context.rs
src/engine_eval/mappers.rs
src/engine_eval/mod.rs
src/engine_eval/result.rs
src/engine_eval/segment_evaluator.rs
tests/engine_eval_test.rs
tests/engine_tests/engine-test-data
tests/mappers_test.rs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Walkthrough
The evaluation context now preserves segment insertion order and supports removing identity data while filtering segments by their rule conditions. Segment conditions can resolve referenced flags lazily, with cycle tracking and cached results. The engine selects segment overrides by priority, assigns fallback reasons to untargeted or targeted features, and uses resolved dependency flags in evaluation results. Flag results now include an optional selected variant key. The test data submodule reference and evaluation test deserialisation were also updated.
Resolve cyclic-evaluation performance and incorrect targeting results before merging, populate selected variant keys, and declare the public API changes as breaking.
- [ ] 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.
Add an end-to-end assertion for retained flag paths.
The new cases only assert that remove_identity_from_context(&context) retains the segment. They do not evaluate $.flags.banner.enabled or assert a selected banner override. A regression in flag-path resolution or override selection can therefore pass these tests.
Additional comments: 1
src/engine_eval/segment_evaluator.rs-262-272: 1
262-272: Minor · Potential issue · Poor tradeoff
Unverified finding
We couldn't verify this from the code. It is shown for review, not as a verified issue.
get_segment_override evaluates even weaker overrides after finding a winner, so a self-referencing condition in a weaker segment can mark the feature cyclic although an independent, higher-priority override already wins.
A can receive a circular-dependency error, and the other flag cannot target on A, despite the independently determined winning value.
This can occur when: Feature A has a matching priority-1 override and a later priority-2 segment whose condition reads $.flags.A.enabled; another flag reads A during evaluation.
Review info
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: 4a2e73d4-ecea-4e94-aba6-fccee4627cb1
Commits
Reviewing files that changed from the base of the PR and between f083e82 and 0552139.
Files selected for processing: 11
.gitmodules
Cargo.toml
src/engine.rs
src/engine_eval/context.rs
src/engine_eval/mappers.rs
src/engine_eval/mod.rs
src/engine_eval/result.rs
src/engine_eval/segment_evaluator.rs
tests/engine_eval_test.rs
tests/engine_tests/engine-test-data
tests/mappers_test.rs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Read JSONPaths made of member names only, such as `$.identity.identifier`
or `$.flags.<feature>.enabled`, straight from the context, without
serialising it or evaluating JSONPath. Other paths are still evaluated
by jsonpath-rust.
Reuse the segment matches memoised while resolving flag dependencies when
evaluating segments, so segments read through a dependency are evaluated
once. Memoise only once a condition has read a flag.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Rust engine ignores segments that target flags by other flags, so the Rust SDK and edge-proxy-rs serve different flags than Flagsmith.
Closes SDK-11. Tested by engine-test-data v3.12.1.
Changes
🤖 Generated with Claude Code
Closes #40