Skip to content

insights: migrate langstats insights

Administrator requested to merge insights/api/lang-stats-migration into main

Created by: CristinaBirkel

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

Description

This PR migrates langstats insights into the db along with the search insights. A few things to call out:

  • I added an other_threshold column to insight_view. I know we talked about also adding a type column, but I'd prefer to add that along with the next issue, https://github.com/sourcegraph/sourcegraph/issues/26675, because that's where it will be used. Just to make sure it fits the need once I dig in there.
  • I think some of this could probably be refactored to make better use of existing code, but since it's all going to get ripped out soon I didn't think it was worth refactoring.
  • I think there's a bug where frontend search insights are not storing the right permissions. I will double check this tomorrow and open an issue if so. (It looked like the backend insights were getting the permissions in a different way than I did it here, so I need a little more time to look into it.)

Testing Steps

I ran this with a few different langStats insights I created through the UI, (with different permissions to test that piece,) and verified that they looked as I expected in the database. I also ran an insightViews query via the API and saw that they showed up there. There's no way for the frontend to tell yet that these are different, but that will be next!

Merge request reports

Loading