Add a signal for when a diffset has been uploaded to a review request.
Review Request #13444 — Created Dec. 5, 2023 and submitted — Latest diff uploaded
This change adds a signal for when a diffset has been uploaded to a review
request. Ideally we would emit this signal in one central place for all
diffsets, but our codebase creates diffsets in a few different ways, with each
having different points at which the full state of the diffset is initialized
and ready. The three types of diffset creation are:
- Creating traditional diffsets that are tied to a single commit
- Creating commit series diffsets that support multiple commits
- Creating diffsets from existing commitsIt's tricky because after a diffset is created, some attributes and related
state such as the review request draft or file diffs are not guaranteed to
be ready. And each of these three types of diffset creation have different
points at which the related objects and state are all fully initialized.
We don't want to emit the signal before all of these are ready because
listeners might try to access some state that may not exist yet. So, we take
special care to emit the signal during each type of diffset creation.
- Ran unit tests.
- Tested with an upcoming assign reviewers by regex extension, which
listens to the signal. - Tested uploading diffs that get created in the three types of ways
mentioned in the description, saw that the signal was emitted each time.
These are the different ways that I uploaded diffs: - Using
rbt post
, also with a given revision, revision range, and
--diff-filename
. - Dragging and dropping a diff into the new review request page.
- Using the "Update diff" button on a review request page.
- Choosing an existing commit on the new review request page.