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

code monitors: respect default pattern type#63333

Merged
stefanhengl merged 5 commits into
mainfrom
sh/kw/cm
Jun 26, 2024
Merged

code monitors: respect default pattern type#63333
stefanhengl merged 5 commits into
mainfrom
sh/kw/cm

Conversation

@stefanhengl

@stefanhengl stefanhengl commented Jun 19, 2024

Copy link
Copy Markdown
Member

This is part of the Keyword Search GA project (see background below).

The core change is that we use the default pattern type consistently for the query input field and preview. Before, we hardcoded literal as the default and used standard for previews.

This is does not affect existing code monitors.

Other fixes:

  • show suggestions that were previously hidden
  • highlight keyword queries correctly

image

Background:

  • "keyword" will soon be the new default pattern type
  • the default pattern type can be overridden in the user/global settings
  • query fields in all of our products should respect the default

Test Plan:

  • The unit test is currently "skipped" with the following comment
// TODO: these tests trigger an error with CodeMirror, complaining about being
// loaded twice, see https://github.com/uiwjs/react-codemirror/issues/506
  • Manual testing:
    • I created several code monitors with and without pattern type and checked in the DB that the correct pattern type was appended.
    • I configured a new default pattern type in my user settings and verified that the setting changes the default pattern type for code monitors.

Co-authored-by: Felix Kling felix@felix-kling.de

@cla-bot cla-bot Bot added the cla-signed label Jun 19, 2024
@github-actions github-actions Bot added team/product-platform team/search-platform Issues owned by the search platform team labels Jun 19, 2024
@stefanhengl stefanhengl marked this pull request as ready for review June 19, 2024 09:29
@jtibshirani

Copy link
Copy Markdown
Contributor

I also tested the flow where you run a search, then click Actions -> Create monitor. We always carry over the patterntype explicitly, even when it's the default. This seems okay to me, but wanted to highlight it.

Screenshot 2024-06-19 at 9 07 30 AM

Comment thread client/web/src/enterprise/code-monitoring/components/FormTriggerArea.tsx Outdated
Comment thread client/branded/src/search-ui/input/codemirror/parsedQuery.ts
Comment thread client/web/src/enterprise/code-monitoring/components/FormTriggerArea.tsx Outdated
Comment thread client/web/src/enterprise/code-monitoring/components/FormTriggerArea.tsx Outdated
<ValidQueryChecklistItem
checked={hasValidPatternTypeFilter}
hint="Code monitors support literal and regex search. Searches are literal by default."
hint={`Code monitors support keyword, standard, literal and regex search. The default is ${defaultPatternType}`}

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.

Weird edge case: the user could set their defaultPatternType to structural. Then, hasValidPatternTypeFilter doesn't catch this. This probably never happens and not sure if it's worth fixing :)

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.

@stefanhengl

Copy link
Copy Markdown
Member Author

Rebased due to merge conflict

@stefanhengl stefanhengl merged commit bc49218 into main Jun 26, 2024
@stefanhengl stefanhengl deleted the sh/kw/cm branch June 26, 2024 09:59
@sqs

sqs commented Jun 28, 2024

Copy link
Copy Markdown
Member

I believe I found an issue that is not caused by but is exposed by this PR: https://linear.app/sourcegraph/issue/SRCH-646/repo-and-other-filters-are-not-tokenized-in-query-input-for

@stefanhengl

Copy link
Copy Markdown
Member Author

I believe I found an issue that is not caused by but is exposed by this PR: https://linear.app/sourcegraph/issue/SRCH-646/repo-and-other-filters-are-not-tokenized-in-query-input-for

Thanks for reporting. Before this PR we didn't use the keyword chips for highlighting, so the issue was hidden. @fkling any idea what is happening?

@fkling

fkling commented Jun 28, 2024

Copy link
Copy Markdown
Contributor

I think we need to change the order in which these "chips" and the syntax highlighting is applied (i.e. change the order of the extensions).

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.

5 participants