insights: just-in-time capture group pattern insights incorrectly handle multiple repositories, returning incorrect partial results
Created by: Joelkw
If you create a just-in-time capture group insight like the following:
The results returned are incorrect and undercount the true results.
What happens is:
- In reverse-listed order in the UI form (so starting at the end of the list first), we return results for capture groups for just the last-matching repository. This means in the above example:
- the sourcegraph/about repo has 193 matches for
code\sinsights
– as shown in the tooltip for 193, but it misses 482 results from sourcegraph/sourcegraph - Because there are no results for
code\sinside
in /handbook, it correctly reports the 1 result from /sourcegraph – it skips the "last repo" because it has no results and uses the "first repo with results" (in this case, the only other repo.
- the sourcegraph/about repo has 193 matches for
What should happen is:
- We correctly sum the results across all repos, for each capture group. So in this case
code\sinsights
should have 675 matches (for `ghts).