fix(operators)!: pass usesAll through the operator factories - #146
Merged
Merged
Conversation
pdevito3
force-pushed
the
fm/qk-breaking-factory-uses-all
branch
from
October 1, 2026 21:48
e266881 to
90a8b5f
Compare
The public ComparisonOperator factories (EqualsOperator, ContainsOperator, InOperator, and the other 21) took a usesAll argument but did not pass it to the operator. An operator from a factory always used Any on a collection. Pass usesAll to the operator, so that usesAll: true builds an All expression, like the % prefix in a filter. BREAKING CHANGE: a ComparisonOperator from a public factory with usesAll: true now has UsesAll true and builds an All expression on a collection. Before, it built an Any expression. Code that passed usesAll: true and expected Any must pass usesAll: false.
pdevito3
force-pushed
the
fm/qk-breaking-factory-uses-all
branch
from
October 2, 2026 20:03
90a8b5f to
15d4a1c
Compare
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.
For later consideration in a major version. Do not merge now. #134 restored the v1.14.2 factories to keep v1.x compatible (restore commit
0761e53). This PR re-appliesc948532. The captain decides on this PR separately.Summary
The 24 public
ComparisonOperatorfactories passusesAllto the operator:The same change applies to the other 23 factories (
NotEqualsOperatorthroughDoesNotHaveOperator). The change is inQueryKit/Operators/ComparisonOperator.csonly.v1.14.2 behavior (and main)
Each factory takes a
usesAllargument but does not use it. The operator always hasUsesAllfalse. On a collection, the operator builds anAnyexpression, also withusesAll: true.New behavior
The operator has the
UsesAllvalue of the argument. WithusesAll: true, the operator builds anAllexpression on a collection. This is the same expression as the%prefix in a filter string (for example,%==).Example
Ingredients.Name == "waffle"(Any). A recipe with one "waffle" ingredient and one other ingredient matches.Ingredients.Name %== "waffle"(All). Only a recipe where every ingredient is "waffle" matches.Justification
A public argument that the method ignores is a defect. A caller who passes
usesAll: trueasks forAlland getsAnywith no warning.Migration
If you call a factory with
usesAll: trueand needAny, passusesAll: false(or omit the argument). Calls that omitusesAlldo not change. Filter strings do not change. The parser usesGetByOperatorString, which already passesusesAll. The library calls the factories only with the defaultusesAll: false.README
No change. The README does not document these factories.
Tests
These tests come back from main before #134:
FilterParsingRegressionTests.comparison_operator_factory_ignores_uses_allbecomescomparison_operator_factory_keeps_uses_all(theory, 24 factories).UsesAllis true.FilterParsingRegressionTests.comparison_operator_factory_with_uses_all_builds_any_expressionbecomescomparison_operator_factory_with_uses_all_builds_all_expression. The expected expression is the one for%==.FilterParsingRegressionTests.comparison_operator_factory_with_uses_all_matches_any_itembecomescomparison_operator_factory_with_uses_all_matches_every_item(Postgres). Only the recipe where every ingredient matches comes back.dotnet test: 470 unit tests and 297 Postgres integration tests (Testcontainers) pass, 0 failures.Rebase on main
This branch is rebased on current main (#169). The rebase had no conflicts. The breaking change did not change.