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(Flag Dependency): Evaluate flags that depend on other flags - #74
Local evaluation ignores segments that target flags by other flags, and environment flags ignore every segment, so the SDK serves different flags than Flagsmith.
Local evaluation now serves flags that depend on other flags, and environment
flags apply segments that need no identity, as Flagsmith does.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The flag engine dependency updates to version 0.7.0. Local evaluation stores and uses an identity-free evaluation context, and the integration test now expects a matching segment override. The SDK spec adds a constructor for a client with local evaluation enabled. Its workflow updates the spec reference and adds the core or local-evaluation tags.
The change enables segment overrides for environment flags. Adding a nonmatching-segment test would strengthen coverage; workflow pinning remains a pre-existing follow-up. Neither finding establishes a merge blocker.
- [ ] 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.
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.
The reason will be displayed to describe this comment to others. Learn more.
Follow-up Comments
Pin the reusable workflow to a commit SHA.
14-14: Minor · Security & Privacy · Quick win
Pin the reusable workflow to a commit SHA.
uses: references the tag v0.7.0, which the upstream repository can move. A later run could then execute different workflow code. The job holds only contents: read and passes no secrets, which limits the impact. Pin uses: and spec-ref to the commit SHA that v0.7.0 resolves to, and keep both values in sync.
Add a negative-case test for the segment condition on the environment name.
The only segment-override test uses an environment named "Test Environment", which matches the segment condition. An implementation that applies the override without evaluating the condition still passes this test. A test with a non-matching environment name detects that regression. It asserts that the base feature value is returned.
Suggested test
+#[rstest]+fn test_get_environment_flags__local_evaluation_with_segment_not_matching_environment__returns_base_value(+ mock_server: MockServer,+ environment_json_with_context_value_override: serde_json::Value,+) {+ // Given+ let mut environment_json = environment_json_with_context_value_override;+ environment_json["name"] = serde_json::json!("Other Environment");+ let api_mock = mock_server.mock(|when, then| {+ when.method(GET)+ .path("/api/v1/environment-document/")+ .header("X-Environment-Key", ENVIRONMENT_KEY);+ then.status(200).json_body(environment_json);+ });+ let url = mock_server.url("/api/v1/");+ let flagsmith_options = FlagsmithOptions {+ api_url: url,+ enable_local_evaluation: true,+ ..Default::default()+ };+ let flagsmith = Flagsmith::new(ENVIRONMENT_KEY.to_string(), flagsmith_options);++ // When+ let flags = flagsmith.get_environment_flags().unwrap();+ let flag_value = flags+ .get_feature_value_as_string(fixtures::FEATURE_1_NAME)+ .unwrap();++ // Then+ assert_eq!(flag_value, fixtures::FEATURE_1_STR_VALUE);+ api_mock.assert();+}
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: d4caa908-2a2e-4baf-a988-5b816185a1ed
Commits
Reviewing files that changed from the base of the PR and between 6649750 and fb3be60.
Files ignored due to path filters: 2
Cargo.lock is excluded by !**/*.lock
benchmarks/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 8
.github/workflows/sdk-spec.yml
Cargo.toml
benchmarks/Cargo.toml
sdk-spec/Cargo.toml
sdk-spec/steps.rs
src/flagsmith/mod.rs
tests/fixtures/mod.rs
tests/integration_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.
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.
Local evaluation ignores segments that target flags by other flags, and environment flags ignore every segment, so the SDK serves different flags than Flagsmith.
Closes SDK-8. Depends on Flagsmith/flagsmith-rust-flag-engine#44; merge once it's released. Tested by sdk-spec v0.7.0.
Changes
🤖 Generated with Claude Code
Closes #60