feat(sdk): Add flag dependencies to the evaluation context - #8396
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
📝 WalkthroughWalkthroughThe Estimated code review effort: 2 (Simple) | ~5 minutes Merge Risk: 🔵 Low · up to The new dependency context may not correctly evaluate flags whose names contain characters such as dots, hyphens, or slashes, which could cause dependent conditions to resolve incorrectly for those flags. The PR is mergeable with explicit owner awareness and follow-up to constrain names or support quoted key access. 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. Comment |
3411d79 to
37c4926
Compare
37c4926 to
6b6685d
Compare
Adds the schema surface needed to evaluate flags that depend on other flags, as an equivalent to LaunchDarkly's flag prerequisites. `EvaluationContext.flags` is a map of already-evaluated flag results keyed by feature name, so that segment conditions can reference `$.flags.<name>.enabled`, `.value` and `.variant`. Entries reference `FlagResult` in evaluation-result.json directly, so the context and the result cannot drift, and it is `readOnly` as the engine populates it. No behaviour change; this lands the schema so the engines can generate their context types from it.
6b6685d to
87b91cb
Compare
REVERT BEFORE MERGE. `EvaluationContext.flags` only exists on the schema branch of Flagsmith/flagsmith#8396, so validating the new test cases against `refs/heads/main` silently proves nothing: the key is simply unknown to the schema, and `EvaluationContext` doesn't set `additionalProperties` to false, so anything at all passes. Points `schema.json` at the context schema on that branch, and the new test cases at `schema.json` on this one, so that validation is meaningful while both are in review. With this, `check-jsonschema` rejects e.g. a non-boolean `$.context.flags.<name>.enabled`, which it accepted before. Once #8396 is merged, both refs should go back to `main` (and the test cases to a tag, in line with the rest of the corpus).
Docker builds report
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4f97c116-a055-4df0-aed0-e806b674ab1f
📒 Files selected for processing (1)
sdk/evaluation-context.json
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19968 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
🗂️ Previous results✅ private-cloud · depot-ubuntu-latest-16 — run #19968 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #19968 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #19968 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
|
Visual Regression19 screenshots compared. See report for details. |
Reverts the temporary pointers added while the schema was in review. Flagsmith/flagsmith#8396 is merged, so `EvaluationContext.flags` is on `main` and the test cases no longer need to reference an in-flight branch to validate. `schema.json` goes back to the context schema on `refs/heads/main`, and the flag dependency cases to the `refs/tags/v2.0.0` schema every other case in the corpus uses.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to #8394.
Closes #8418.