Add Scope plumbing and custom operator extension point - #4047
Merged
Conversation
Thread evaluation scope through the rules engine and delegate unknown operators to an empty CustomOperators dispatcher, without changing behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
Only detekt's UnusedParameter fails the build. The Kotlin compiler doesn't warn about unused parameters on non-private functions, and the project doesn't set allWarningsAsErrors, so the compiler-level suppressions were silencing nothing. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4047 +/- ##
==========================================
+ Coverage 83.11% 83.14% +0.02%
==========================================
Files 437 439 +2
Lines 17930 17937 +7
Branches 2688 2688
==========================================
+ Hits 14903 14913 +10
+ Misses 2145 2143 -2
+ Partials 882 881 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Aug 21, 2026
ajpallares
marked this pull request as ready for review
August 21, 2026 06:36
ajpallares
added a commit
that referenced
this pull request
Aug 21, 2026
#4047 landed on main as a squashed commit, so its Scope plumbing existed twice. All three conflicts were the rc.rootVar additions layered on identical #4047 content, so this branch's side was kept: the dispatch case, the shared resolveVar with its operatorName parameter, and the iteration docs naming rc.rootVar. Co-authored-by: Cursor <cursoragent@cursor.com>
ajpallares
added a commit
that referenced
this pull request
Aug 24, 2026
main gained the Scope plumbing (#4047) and rc.rootVar (#4049), which moved the lookup this branch changes into a resolveVar shared by var and rc.rootVar. The merge is therefore semantic, not just textual: - AccessorOperators: keep main's opVar/resolveVar split and re-apply the throw at the one point where the miss is decided, so rc.rootVar inherits it. The KDoc keeps both sides' paragraphs. - rc_root_var.json: adopt the version from the iOS branch, where two fixtures that pinned a missing root key as null now pin the error. Still byte-identical to iOS. - AccessorOperatorsTest: main's Scope-wrapped call with this branch's expectation that the fractional path throws rather than warns. - PredicateFixtureLoaderTest: recomputed from disk as 413. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Checklist
purchases-iosand hybridsMotivation
Port of RevenueCat/purchases-ios#7433, the first of the rules-engine custom operator PRs. Custom
rc.*operators need somewhere to live, andrc.rootVarneeds the predicate's root data to survive iteration, which today is lost as soon assome/map/reducerebind the scope to the current item.Description
Scope(current data plus the never-replaced root) through the evaluator instead of a bareValue, and delegate unknown operators to an emptyCustomOperatorsdispatcher.varstill sees only the current item inside iteration, no fixtures were added or changed, and the pinned fixture count stays at 382.Notes
The
@Suppress("UnusedParameter")on the empty dispatcher is temporary —argsandvarsbecome used as soon as the firstrc.*operator lands.Note
Medium Risk
Touches the rules-engine evaluator and every operator signature, so a scope mix-up could change predicate results. Intended to be behavior-preserving for existing var/iteration semantics.
Overview
Prepares the rules engine for RevenueCat
rc.*operators by replacing a bare dataValuewith aScopethat keeps both current data and the original root.Iteration (
some/all/none/map/filter/reduce) now rebinds onlycurrentviascoped(), sovarstill sees the item (or reduce’s{current, accumulator}) while custom ops can later read top-level data. Unknown operators fall through to an emptyCustomOperatorsdispatcher (stillUnsupportedOperator).firstArgEvaluatedmoves ontoOperators.No new operator behavior; tests wrap existing calls in
Scope.Reviewed by Cursor Bugbot for commit fa1fa3c. Bugbot is set up for automated code reviews on this repo. Configure here.