fix(filter): throw UnknownFilterPropertyException again for a failed query name filter - #160
Merged
Merged
Conversation
…query name filter v1.14.2 read only the first word of a derived property or custom operation query name with a space or a hyphen, and threw UnknownFilterPropertyException for that word. Main reads the whole query name. When that filter then fails, main throws ParsingException. If a filter that reads such a query name fails, the parser now parses it again without these query names. Thus it throws the exception that v1.14.2 gave. A filter that succeeds does not change.
This was referenced Oct 1, 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.
Summary
This PR restores D5 from the v1.14.2 review report. It is not a breaking change.
A derived property or custom operation can have a query name with a space or a hyphen, for example
double ratingorfull-name. v1.14.2 read only the first word (double) as a property and threwUnknownFilterPropertyExceptionfor it. Main reads the whole query name. When the filter then fails, main throwsParsingExceptionor another exception, notUnknownFilterPropertyException.This PR keeps the main behavior for a filter that succeeds. If a filter reads such a query name and then fails, the parser parses the filter again without these query names. The second parse reads the input like v1.14.2. Thus it throws the exception that v1.14.2 gave:
UnknownFilterPropertyExceptionfor the first word, when the query name comes first.Title == && is adult == truestill throwsParsingException, andAge > "x" && is adult == truestill throwsFormatException.The second parse runs only for a failed filter that read such a query name. Other filters run one parse, like before.
D1 (#155) removes the indexer case of the report. This PR covers the remaining cases.
Results against v1.14.2
double ratingis a derived property, andrated overis a custom operation.double rating > 6UnknownFilterPropertyException('double')ParsingExceptiondouble ratingUnknownFilterPropertyException('double')ParsingExceptionrated overUnknownFilterPropertyException('rated')ParsingExceptionrated over > 3 && Title ==UnknownFilterPropertyException('rated')ParsingExceptionRating > "x" && rated over > 3FormatExceptionFormatExceptionrated over > 3UnknownFilterPropertyException('rated')The last row is not changed back. v1.14.2 rejected this input and main accepts it, so it is not a breaking change.
A differential probe ran 39 cases against v1.14.2 and this branch. The cases put the query name before and after a failed clause, inside groups, and with
AllowUnknownProperties. The probe compared the expression, the in-memory rows, and the Postgres SQL. The only remaining differences are inputs that v1.14.2 rejected and main accepts, and message text that #157 changed.Tests
QueryKit.UnitTests/QueryNameOverUnknownTests.cs: 9 failed filters with a query name throwUnknownFilterPropertyExceptionfor the first word. 4 guard tests make sure that an earlier failure keeps its exception and that a filter with a query name still succeeds. The 9 pins fail on main.QueryKit.IntegrationTests/Tests/QueryNameOverUnknownTests.cs: a failed filter with the custom operationis adultthrowsUnknownFilterPropertyException, and the same query name filters the rows when the filter is correct. It fails on main.dotnet test: unit 423 passed, integration 284 passed.Overlap with other PRs
CreateLeftExprParser. If fix(filter)!: resolve query names in the grammar again #154 merges after this PR, it needs a rebase.