Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

fix(search_jobs): fail validation for repo searches#64300

Merged
stefanhengl merged 2 commits into
mainfrom
stefan-splf-91-bug-fix-repohasfiledeploy-passes-search-job-validation-but
Aug 6, 2024
Merged

fix(search_jobs): fail validation for repo searches#64300
stefanhengl merged 2 commits into
mainfrom
stefan-splf-91-bug-fix-repohasfiledeploy-passes-search-job-validation-but

Conversation

@stefanhengl

@stefanhengl stefanhengl commented Aug 6, 2024

Copy link
Copy Markdown
Member

This closes a pretty big gap in the query validation for Search Jobs. We don't support repo search yet and searcher returned errors during execution, complaining about missing patterns. With this PR we fail during validation so users cannot even create these kinds of jobs. See new test cases.

Test plan

Updated unit tests

@cla-bot cla-bot Bot added the cla-signed label Aug 6, 2024
@stefanhengl stefanhengl requested a review from a team August 6, 2024 12:43
@github-actions github-actions Bot added team/product-platform team/search-platform Issues owned by the search platform team labels Aug 6, 2024
// /internal/search/search.go. We duplicate the check here to make sure we fail
// early and not during execution.
func validateSearcherParams(b query.Basic, inputs *search.Inputs, resultTypes result.Types) error {
r := toTextPatternInfo(b, resultTypes, inputs.Features, inputs.DefaultLimit())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we performed this validation as part of toTextPatternInfo to avoid having to duplicate this logic? It seems nice for searcher too to report errors early?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. This makes the change a bit more invasive though, but it should work.

@jtibshirani jtibshirani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Checking I understand: this should have no difference on searcher or structural search behavior, right? Because we just shuffled the validation to another place, but even before it was happening for every query sent to searcher.

@stefanhengl

Copy link
Copy Markdown
Member Author

Looks good! Checking I understand: this should have no difference on searcher or structural search behavior, right? Because we just shuffled the validation to another place, but even before it was happening for every query sent to searcher.

Yes!

@stefanhengl stefanhengl merged commit ee93777 into main Aug 6, 2024
@stefanhengl stefanhengl deleted the stefan-splf-91-bug-fix-repohasfiledeploy-passes-search-job-validation-but branch August 6, 2024 15:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/product-platform team/search-platform Issues owned by the search platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants