Skip to content

feat(sdk): Add flag dependencies to the evaluation context - #8396

Merged
khvn26 merged 1 commit into
mainfrom
feat/dependent-flags-evaluation-context
Aug 31, 2026
Merged

feat(sdk): Add flag dependencies to the evaluation context#8396
khvn26 merged 1 commit into
mainfrom
feat/dependent-flags-evaluation-context

Conversation

@khvn26

@khvn26 khvn26 commented Aug 27, 2026

Copy link
Copy Markdown
Member

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #8394.

Closes #8418.

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 27, 2026 3:57pm
flagsmith-frontend-preview Ignored Ignored Preview Aug 27, 2026 3:57pm
flagsmith-frontend-staging Ignored Ignored Preview Aug 27, 2026 3:57pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The EvaluationContext JSON schema adds a read-only flags object. Each feature name maps to a FlagResult reference. The engine populates this object during evaluation. Segment conditions can access enabled, value, and variant through $.flags.<feature name>.

Estimated code review effort: 2 (Simple) | ~5 minutes

Merge Risk: 🔵 Low · up to 87b91

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the feature New feature or request label Aug 27, 2026
@khvn26
khvn26 force-pushed the feat/dependent-flags-evaluation-context branch from 3411d79 to 37c4926 Compare August 27, 2026 15:54
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Aug 27, 2026
@khvn26
khvn26 force-pushed the feat/dependent-flags-evaluation-context branch from 37c4926 to 6b6685d Compare August 27, 2026 15:55
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Aug 27, 2026
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.
@khvn26
khvn26 force-pushed the feat/dependent-flags-evaluation-context branch from 6b6685d to 87b91cb Compare August 27, 2026 15:57
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Aug 27, 2026
khvn26 added a commit to Flagsmith/engine-test-data that referenced this pull request Aug 27, 2026
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).
@khvn26
khvn26 marked this pull request as ready for review August 31, 2026 11:57
@khvn26
khvn26 requested a review from a team as a code owner August 31, 2026 11:58
@khvn26
khvn26 requested review from talissoncosta and removed request for a team August 31, 2026 11:58
@github-actions github-actions Bot removed the feature New feature or request label Aug 31, 2026
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-8396 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-8396 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-8396 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8396 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8396 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-8396 Finished ✅ Results

@github-actions github-actions Bot added the feature New feature or request label Aug 31, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between cb66498 and 87b91cb.

📒 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.

Comment thread sdk/evaluation-context.json
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19968 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  37.1 seconds
commit  87b91cb
info  🔄 Run: #19968 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #19968 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  32.7 seconds
commit  87b91cb
info  🔄 Run: #19968 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19968 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.5 seconds
commit  87b91cb
info  🔄 Run: #19968 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19968 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.7 seconds
commit  87b91cb
info  🔄 Run: #19968 (attempt 1)

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@khvn26
khvn26 merged commit 58eb348 into main Aug 31, 2026
39 checks passed
@khvn26
khvn26 deleted the feat/dependent-flags-evaluation-context branch August 31, 2026 12:41
khvn26 added a commit to Flagsmith/engine-test-data that referenced this pull request Aug 31, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add flag dependencies to the evaluation context

2 participants