Skip to content

Track and fix code health issues in a few clicks

Created by: malomarrec

Vision

Enable users to seamlessly use all our features to solve a concrete code health problem.

Pitch for this feature

https://user-images.githubusercontent.com/25070988/155287384-7a2fd497-6005-4733-9d47-54db5adc7663.mp4

Success criteria

  • awareness: when the feature flat is removed, we should see a significant increase in batch changes visitors (>50 per month )
  • usage: number of batch changes applied from insights

We can start by measuring this qualitatively (talking to users), and implement metrics before removing the feature flag.

Added telemetry:

  • count of clicks on "fix with batch change" button
  • count of batch changes applied from the "fix with batch change" button

Delivery plan

Step 1: Improve navigation from Insights to Batch Changes

Minimum viable change: users can quickly open up Batch Changes from Code Insights that are build from a search query, and view a minimal default template.

  • add a fix with batch change button, to a hardcoded list of insights templates. That button points to /batch-changes/create?template=minimal&query=<search-query>). https://github.com/sourcegraph/sourcegraph/issues/33253
  • add 3 batch change templates matching Insights in this dashboard: pin docker image, add codeowner, add readme.
  • When a user clicks on that button it opens up the batch change create page (/batch-changes/create), and prompts the user for a batch change name. That page is context-aware and has a "create batch change for '[Title of insight]'" title so that users have context.
  • After the user adds a name, load the <template-id> template, inserting <search-query>.
  • The user lands on Create batch change for '[Title of insight]'" so that they have the context
  • add batch change templates matching the cherry-picked insights
  • feature-flag this

See figma

For users that do not have running batch changes server-side enabled, land on the templates dashboard.

image

Step 1b: add metrics

  • @malomarrec write pings RFC
  • implement pings

Step 2: Suggest a useful template

Instead of suggesting the default batch changes template, come up with a heuristic to suggest a useful template from our examples list. Either pre-fill with the best template match, or show users options of potentially relevant templates they can pick