chore: Deduplicate shared sync/async evaluator target checking - #482
Merged
Conversation
Move the target-matching logic into a shared check_targets() free function in evaluator_common, and route both the sync and async evaluators to it. Also drop redundant comment-banner headers from several async test modules to match the sync test style. Behavior is unchanged. SDK-2871
joker23
approved these changes
Aug 7, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
Behavior-preserving cleanup extracted from the async SDK implementation branch (epic SDK-60). Touches only files already on
main; independent of the async-client / FDv2 work.Track Internally: SDK-2871
Changes
Evaluator dedup (core):
ldclient/impl/evaluator_common.py— add a sharedcheck_targets()free function holding the context/user target-matching logic.ldclient/impl/evaluator.py— remove the private_check_targetsmethod; route to the sharedcheck_targets().ldclient/impl/async_evaluator.py— same: remove the duplicated_check_targetsmethod and route to the shared function.The sync and async evaluators previously carried byte-identical copies of the target-matching logic. This collapses them into one implementation.
Async test cleanup:
ldclient/testing/impl/test_async_evaluator.py,test_async_big_segments.py,test_async_flag_tracker.py,test_async_hooks.py,integrations/test_async_redis.py— drop redundant comment-banner section headers so the async test modules match the sync test style. No test logic changes.Verification
uv run pyteston the evaluator and async component test files: all pass (async redis suite verified green against a local redis; it connects to a live server as in CI).uv run pycodestyle,uv run isort --check --atomic,uv run mypyclean on all changed files.No CHANGELOG or version changes.
Note
Overview
Target matching for user and context targets is consolidated into a shared
check_targets()inevaluator_common.py. BothEvaluatorandAsyncEvaluatornow call that function instead of maintaining identical private_check_targetsmethods.Async test modules lose decorative section-header comment banners (and one hook-test helper docstring is clarified); no test behavior changes.
Reviewed by Cursor Bugbot for commit e99e817. Bugbot is set up for automated code reviews on this repo. Configure here.