Repository navigation
Conversation
The `And` and `Or` arms of `build_filter_from_object` built their filter list from the whole parent object, which flattened the lists of every key into one. A `where` with both `and` and `or` put all branches into both filters, and `_change_block` next to `or` failed with `InvalidFilterError`. Build the list from the key's own value and drop the now unused `build_list_filter_from_object`. Fixes graphprotocol#6809
This branch has not been deployed
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.
In
build_filter_from_object, theAndandOrarms passed the whole parent object tobuild_list_filter_from_object, and that function flattened the lists of every key into one. Sowhere: { and: [A1, A2], or: [B1, B2] }builtAnd([And([A1, A2, B1, B2]), Or([A1, A2, B1, B2])]), and rows that match only oneorbranch were dropped.{ _change_block: { number_gte: 10 }, or: [...] }passes the structure check, but then failed withInvalidFilterErrorbecause the value of_change_blockis not a list.Changes:
AndandOrlists from the key's ownvaluewithbuild_list_filter_from_value.build_list_filter_from_object, which has no other callers.build_queryunit tests:build_query_builds_and_and_or_from_their_own_listsandbuild_query_allows_change_block_next_to_or.Testing:
cargo test -p graph-graphql --lib -- store::query::tests: both new tests fail on master (wrong filter, and a panic on theInvalidFilterError) and pass with the fix. 26 passed.cargo test -p test-store --test graphqlagainst Postgres 17: 80 passed.just format,just lint(no warnings) andcargo check --release -p graph-graphqlare clean.Fixes #6809