Open batch change changesets are not updated if the repo is archived while they're open
Created by: LawnGnome
Original source: https://sourcegraph.slack.com/archives/C02BJ8T258D/p1635458039067400
Steps to reproduce
- Create a batch change that publishes a changeset to repo
X
(the report is on GitHub, but I'd assume this is going to be true for all code hosts). - Archive
X
on the code host, making it read only. All PRs are locked at this point. - Observe that Batch Changes still thinks the PR is open, and the PR cannot be closed within the batch change.
Planned solution
Add a new terminal state that behaves like closed
but is displayed differently to avoid confusion. (Name TBC, since we already have a concept of "archiving" that's different in Batch Changes.)
We need to be able to migrate both into and out of that state as repositories are archived and unarchived.
For now, we'll only do this on changeset sync or reconciler error, but an obvious future enhancement would be to also update changeset state when repo-updater
becomes aware of a repo being archived or unarchived. (Indeed, Batch Changes could also update the repo once if it becomes aware before repo-updater
.) The main technical challenge here is that it crosses the open source/enterprise boundary, and would probably need some new plumbing. (Maybe a notification queue via Redis on repo-updater
events?)
Reconciler errors to handle
We want to detect useful errors in both the push
and update
operations. We'll probably have to do this the old fashioned way with string comparisons in most cases.
Code host | On push | On update |
---|---|---|
GitHub |
|
|
GitLab |
|
403 Forbidden (no other useful message to disambiguate) |
Bitbucket Server | No concept of archiving a repo, or making it completely read only | |
Bitbucket Cloud |