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

Code Insights: use point-in-time search for drilldown#61953

Merged
camdencheek merged 6 commits into
mainfrom
cc/insights-point-in-time
Apr 23, 2024
Merged

Code Insights: use point-in-time search for drilldown#61953
camdencheek merged 6 commits into
mainfrom
cc/insights-point-in-time

Conversation

@camdencheek

@camdencheek camdencheek commented Apr 16, 2024

Copy link
Copy Markdown
Member

This implements a change in Code Insights drilldown behavior to show the set of results represented by that point rather than a diff search between the timestamps of the two points. This is built on top of the new rev:at.time() filter.

Closes https://github.com/sourcegraph/sourcegraph/issues/60739

Test plan

Copied all tests we already had for diffQuery. Manual end-to-end test which is shown in the attached video.

screenshot-2024-04-18_11-52-06.mp4

@cla-bot cla-bot Bot added the cla-signed label Apr 16, 2024
@camdencheek camdencheek force-pushed the cc/insights-point-in-time branch from e54cfeb to 2fb33d3 Compare April 17, 2024 17:57
Comment on lines +23 to +25
if len(defaults) == 0 {
return inputQuery, nil
}

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.

No need to do a parse/stringify round trip if there are no defaults to apply. This is actually meaningful because parsing a rev: query without adding the repo: parts is invalid, which causes errors.

}
}

func TestPointTimeQuery(t *testing.T) {

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.

Copied directly from TestPointDiffQuery

@camdencheek camdencheek marked this pull request as ready for review April 18, 2024 18:01
@camdencheek camdencheek requested a review from a team April 18, 2024 18:01
@sourcegraph-bot

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@peterguy peterguy 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.

tested locally; looks great

@camdencheek camdencheek merged commit f869f92 into main Apr 23, 2024
@camdencheek camdencheek deleted the cc/insights-point-in-time branch April 23, 2024 01:20

@vovakulikov vovakulikov 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.

@camdencheek my apologies that I couldn't check this PR earlier, left some comments after manual testing, maybe I checked it wrongly but worth double-checking with you I think.

return BasicQuery(query), nil
}

func PointInTimeQuery(diffInfo PointDiffQueryOpts) (BasicQuery, error) {

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.

I don't think it's a regression since this code works in the same way as the diffQuery resolver (maybe it happened before, but demo staging works fine, not sure), but it looks like now it's possible to break the query that already has a repo filter.

I checked this on demo staging and this works in the following way

  • If the insight's original query has a repo: filter with specific repositories we just add post-process filters to the original repo filters
  • if the insight's original query has a repo:.* filter when we add some post-process filters we just use these filters as repo: filter with no repo:.* in the result query

After this PR, I think the second case breaks; if you add repository post-filters to the insight with repo:* in the repo query, the result query will be repo:* repo:<post-process-repo-filter-value> which suddenly breaks the result for some reason.

To clarify when I'm talking about post-process filters I mean these filters form UI under the filter button in the insight card on the dashboard

Screenshot 2024-04-23 at 22 39 24

cc @camdencheek

@peterguy peterguy linked an issue Apr 24, 2024 that may be closed by this pull request
@peterguy peterguy linked an issue Apr 24, 2024 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code Insights: change the behavior of drilldown Codeinsights: selecting datapoints inconsistent insights: spike on commit/diff timeouts

4 participants