-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Prevent Query Rule Creation with Invalid Numeric Match Criteria #122823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…h invalid match criteria
kderusso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice start @mridula-s109 ! I've left some feedback, please let me know if you have questions.
...search/qa/rest/src/yamlRestTest/resources/rest-api-spec/api/entsearch.put_query_ruleset.json
Outdated
Show resolved
Hide resolved
...rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/55_numeric_validation.yml
Outdated
Show resolved
Hide resolved
...rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/55_numeric_validation.yml
Outdated
Show resolved
Hide resolved
...earch/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java
Outdated
Show resolved
Hide resolved
...earch/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java
Outdated
Show resolved
Hide resolved
...earch/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java
Outdated
Show resolved
Hide resolved
...earch/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java
Outdated
Show resolved
Hide resolved
...earch/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java
Show resolved
Hide resolved
...earch/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java
Outdated
Show resolved
Hide resolved
...lugin/ent-search/src/test/java/org/elasticsearch/xpack/application/rules/QueryRuleTests.java
Outdated
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice progress here @mridula-s109 , thanks for iterating!
I've left a couple of very minor comments.
The next thing that you'll want to do is:
- Please update the title of this PR, to remove the Jira. It's OK to refer to the ticket number in the description (no links) but we don't want this being part of the official changelog as Jira is internal 🙂
- Please remove this from draft state and apply the following labels:
- v9.0.0
- v8.18.0
- auto-backport
- :SearchOrg/Relevance
>bug
This will automatically create a backport to the appropriate branch when it is merged, so the bug fix goes into 9.0. It will also create a Changelog entry for this bug fix. Finally, it will ping the Search organization that the PR is available.
While CI failed, it looks like it failed on an unrelated change. CI will be re-run any time anything is added - so creating the changelog will run again. You may need to update from main via the button on the PR to resolve. We can't merge this PR until CI is green.
Thanks for your work on this!
.../rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/10_query_ruleset_put.yml
Outdated
Show resolved
Hide resolved
.../rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/10_query_ruleset_put.yml
Outdated
Show resolved
Hide resolved
.../rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/10_query_ruleset_put.yml
Outdated
Show resolved
Hide resolved
.../rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/10_query_ruleset_put.yml
Outdated
Show resolved
Hide resolved
...n/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearchFeatures.java
Outdated
Show resolved
Hide resolved
...earch/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java
Outdated
Show resolved
Hide resolved
...lugin/ent-search/src/test/java/org/elasticsearch/xpack/application/rules/QueryRuleTests.java
Outdated
Show resolved
Hide resolved
|
Pinging @elastic/search-eng (Team:SearchOrg) |
|
Pinging @elastic/search-relevance (Team:Search - Relevance) |
kderusso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the iterations!
Mikep86
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for removing the logger! I have a suggestion about how to simplify the test code :)
...earch/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java
Outdated
Show resolved
Hide resolved
…/application/EnterpriseSearchModuleTestUtils.java Co-authored-by: Mike Pellegrini <[email protected]>
# Conflicts: # x-pack/plugin/ent-search/src/test/java/org/elasticsearch/xpack/application/rules/QueryRuleTests.java
💔 Backport failed
You can use sqren/backport to manually backport by running |
...lugin/ent-search/src/test/java/org/elasticsearch/xpack/application/rules/QueryRuleTests.java
Show resolved
Hide resolved
...lugin/ent-search/src/test/java/org/elasticsearch/xpack/application/rules/QueryRuleTests.java
Show resolved
Hide resolved
...lugin/ent-search/src/test/java/org/elasticsearch/xpack/application/rules/QueryRuleTests.java
Show resolved
Hide resolved
…tic#122823) * SEARCH-802 - bug fixed - Query rules allows for creation of rules with invalid match criteria * [CI] Auto commit changes from spotless * Worked on the comments given in the PR * [CI] Auto commit changes from spotless * Fixed Integration tests * [CI] Auto commit changes from spotless * Made changes from the PR * Update docs/changelog/122823.yaml * [CI] Auto commit changes from spotless * Fixed the duplicate code issue in queryRuleTests * Refactored code to clean it up based on PR comments * [CI] Auto commit changes from spotless * Logger statements were removed * Cleaned up the QueryRule tests * [CI] Auto commit changes from spotless * Update x-pack/plugin/ent-search/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java Co-authored-by: Mike Pellegrini <[email protected]> * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]> Co-authored-by: Kathleen DeRusso <[email protected]> Co-authored-by: Mike Pellegrini <[email protected]>
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
…tic#122823) * SEARCH-802 - bug fixed - Query rules allows for creation of rules with invalid match criteria * [CI] Auto commit changes from spotless * Worked on the comments given in the PR * [CI] Auto commit changes from spotless * Fixed Integration tests * [CI] Auto commit changes from spotless * Made changes from the PR * Update docs/changelog/122823.yaml * [CI] Auto commit changes from spotless * Fixed the duplicate code issue in queryRuleTests * Refactored code to clean it up based on PR comments * [CI] Auto commit changes from spotless * Logger statements were removed * Cleaned up the QueryRule tests * [CI] Auto commit changes from spotless * Update x-pack/plugin/ent-search/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java Co-authored-by: Mike Pellegrini <[email protected]> * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]> Co-authored-by: Kathleen DeRusso <[email protected]> Co-authored-by: Mike Pellegrini <[email protected]> (cherry picked from commit f6538e8) # Conflicts: # x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearchFeatures.java
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
…tic#122823) * SEARCH-802 - bug fixed - Query rules allows for creation of rules with invalid match criteria * [CI] Auto commit changes from spotless * Worked on the comments given in the PR * [CI] Auto commit changes from spotless * Fixed Integration tests * [CI] Auto commit changes from spotless * Made changes from the PR * Update docs/changelog/122823.yaml * [CI] Auto commit changes from spotless * Fixed the duplicate code issue in queryRuleTests * Refactored code to clean it up based on PR comments * [CI] Auto commit changes from spotless * Logger statements were removed * Cleaned up the QueryRule tests * [CI] Auto commit changes from spotless * Update x-pack/plugin/ent-search/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java Co-authored-by: Mike Pellegrini <[email protected]> * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]> Co-authored-by: Kathleen DeRusso <[email protected]> Co-authored-by: Mike Pellegrini <[email protected]>
… Criteria (#122823) | Removed logger and also fixed the nitpick comments (#124650) (#124758) * Prevent Query Rule Creation with Invalid Numeric Match Criteria (#122823) * SEARCH-802 - bug fixed - Query rules allows for creation of rules with invalid match criteria * [CI] Auto commit changes from spotless * Worked on the comments given in the PR * [CI] Auto commit changes from spotless * Fixed Integration tests * [CI] Auto commit changes from spotless * Made changes from the PR * Update docs/changelog/122823.yaml * [CI] Auto commit changes from spotless * Fixed the duplicate code issue in queryRuleTests * Refactored code to clean it up based on PR comments * [CI] Auto commit changes from spotless * Logger statements were removed * Cleaned up the QueryRule tests * [CI] Auto commit changes from spotless * Update x-pack/plugin/ent-search/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java Co-authored-by: Mike Pellegrini <[email protected]> * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]> Co-authored-by: Kathleen DeRusso <[email protected]> Co-authored-by: Mike Pellegrini <[email protected]> (cherry picked from commit f6538e8) # Conflicts: # x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearchFeatures.java * Removed logger and also fixed the nitpick comments (#124650) (cherry picked from commit 44a3ac4) * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]>
This PR introduces validation logic for query rules that require numeric comparisons to prevent storing rules that will never match. Previously, invalid numeric criteria could be silently ignored at query time, leading to unexpected behavior.