Prevent Query Rule Creation with Invalid Numeric Match Criteria#122823
Prevent Query Rule Creation with Invalid Numeric Match Criteria#122823mridula-s109 merged 36 commits intoelastic:mainfrom
Conversation
…h invalid match criteria
kderusso
left a comment
There was a problem hiding this comment.
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.
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.
LGTM, thanks for the iterations!
Mikep86
left a comment
There was a problem hiding this comment.
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 <mike.pellegrini@elastic.co>
# 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 <mike.pellegrini@elastic.co> * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Kathleen DeRusso <kathleen.derusso@elastic.co> Co-authored-by: Mike Pellegrini <mike.pellegrini@elastic.co>
💚 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 <mike.pellegrini@elastic.co> * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Kathleen DeRusso <kathleen.derusso@elastic.co> Co-authored-by: Mike Pellegrini <mike.pellegrini@elastic.co> (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 <mike.pellegrini@elastic.co> * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Kathleen DeRusso <kathleen.derusso@elastic.co> Co-authored-by: Mike Pellegrini <mike.pellegrini@elastic.co>
… 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 <mike.pellegrini@elastic.co> * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Kathleen DeRusso <kathleen.derusso@elastic.co> Co-authored-by: Mike Pellegrini <mike.pellegrini@elastic.co> (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 <infra-root+elasticsearchmachine@elastic.co>
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.