Skip to content

Conversation

@khvn26
Copy link
Member

@khvn26 khvn26 commented Sep 16, 2025

Contributes to #179.

In this PR, we:

  • Add EvaluationResult getEvaluationResult(EvaluationContext context) and remove all of the old engine APIs.
  • Add support for JSONPath-enabled context values.
  • Add EngineMappers class for engine-API data interop.
  • Breaking change: EnvironmentModel class, used by IOfflineHandler, is no longer part of com.flagsmith.flagengine package. Methods carrying the engine business logic and sub-models/fields not relevant to the SDK are removed.
  • Breaking change: drop Java 8 support.

@khvn26 khvn26 requested a review from Copilot September 16, 2025 20:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for context values and adds a new getEvaluationResult API while removing legacy engine APIs. The changes involve a breaking refactor from Java 8 to Java 11 and introduces JSONPath-enabled context value evaluation.

Key changes:

  • Introduces EvaluationResult getEvaluationResult(EvaluationContext context) API replacing old model-based APIs
  • Adds JSONPath support for context value evaluation and removes model-based segment evaluation
  • Drops Java 8 support in favor of Java 11 minimum requirement

Reviewed Changes

Copilot reviewed 58 out of 58 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pom.xml Updates Java version from 8 to 11, adds JsonPath dependency and code generation plugin
src/main/java/com/flagsmith/flagengine/Engine.java Replaces model-based feature evaluation with context-based evaluation using new API
src/main/java/com/flagsmith/flagengine/segments/SegmentEvaluator.java Refactors from model-based to context-based segment evaluation with JSONPath support
src/main/java/com/flagsmith/mappers/EngineMappers.java New mapper utility for converting JSON documents to engine contexts
src/main/java/com/flagsmith/interfaces/IOfflineHandler.java Breaking change: replaces EnvironmentModel with EvaluationContext
src/test/java/com/flagsmith/flagengine/unit/segments/SegmentModelTest.java Updates test to use new context-based evaluation instead of model-based

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@emyller emyller left a comment

Choose a reason for hiding this comment

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

Non blocking comments, since engine tests pass. These comments may or may not require attention.

P.S. Reviewing this on the iPad was frustratingly difficult, as is reading this Java codebase sometimes. I’m sorry for the somewhat poor review compared to my standards.

Copy link

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

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

Looks good to me overall. I share Evandro's confusion surrounding boolean management - some clarification could help, also to have other implementations ISO.
I added a comment on the modulo evaluator

@khvn26 khvn26 force-pushed the feat/context-values branch from ec51cfd to 7d1c948 Compare October 22, 2025 16:43
@khvn26 khvn26 requested review from Zaimwa9 and emyller October 22, 2025 16:46
Zaimwa9
Zaimwa9 previously approved these changes Oct 23, 2025
Copy link

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

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

Loooks goooood. Approving but have minor comments / NIT so feel free to discard

@khvn26 khvn26 requested a review from Zaimwa9 October 23, 2025 17:04
Zaimwa9
Zaimwa9 previously approved these changes Oct 23, 2025
Copy link

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

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

Awesome 🥳

Copy link
Contributor

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

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

Approving based on @emyller's review, and my subsequent follow up on the comments that he had left. I have not done a comprehensive review of the code, only the parts relevant to those conversations.

@khvn26 khvn26 merged commit d892342 into main Oct 24, 2025
6 checks passed
@khvn26 khvn26 deleted the feat/context-values branch October 24, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants