insights: update series query data
Created by: CristinaBirkel
Closes: #25979 (closed) Stacked on top of: https://github.com/sourcegraph/sourcegraph/pull/26744
Description
The idea with this PR is to:
- Support the rest of the series update
- Manage the re-use of existing series, and marking orphaned series as deleted. (Background process to clean them up can be a separate issue.) This re-use will work for both creation and updates.
Related issues for future work:
- https://github.com/sourcegraph/sourcegraph/issues/26903
- https://github.com/sourcegraph/sourcegraph/issues/26905
Testing Steps
There are several cases to consider here, based on whether the user is updating a BE or FE series. (For now, we consider a series lacking any repositories
to be backend, and otherwise is frontend.) A change to this field could change a BE series to a FE series or vice versa.
All of this can be checked via the API and in the database to verify it is doing what's expected.
- FE series -> FE series: This is the easiest one to handle. The series just gets updated in place.
- BE series -> BE series, BE -> FE, FE -> BE: All 3 of these should have the same behavior.
- Detach the series from the insight
- Find or create a series to attach
- If the detached series was not being used by any other insight, mark it as deleted
I have poked around at the various cases and it seems to be working as expected, but I wouldn't be surprised if I missed something. Let me know if you see anything unusual!