Skip to content

Code monitors: add transition step to switch over to repo-aware monitors

Warren Gifford requested to merge cc/code-monitor-transition into main

Created by: camdencheek

This PR adds a transitional chunk of code that is required for migrating code monitors from timestamp-based to commit-hash-based.

Basically, if a user enables repo-aware monitors, that monitor doesn't have any "previously searched commits" set. This means that we will detect all the commits in every repository searched as new commits and search them from the beginning. This will mean that a user would get a spurious email when they switch to repo-aware monitors (not great).

This breaks up that issue by adding temporary chunk of code that says "if this code monitor has never been run as a repo-aware monitor before, snapshot the current state and use that for all future runs."

This code will be deleted after a version cycle.

Stacked on #35013

Test plan

I manually tested that upgrading from a timestamp-based monitor to a repo-aware monitor does not trigger a new notification, and that the monitor starts at the correct place.

Merge request reports

Loading