Fix more deletion bugs with review request drafts.

Review Request #13863 — Created May 16, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

We had two additional deletion bugs lurking with review request drafts.
Deleting ("discarding") the draft was failing to delete the associated
ChangeDescription and DiffSet objects, causing these to be left
orphaned. This was once again exposing the API bug where attempting to
serialize a link to an orphaned object was crashing when it tried to get
the parent object (in this case the draft that was the parent of a
DiffSet that had no associated history object).

Bullet-proofing the API serialization will happen separately in a later
version, since that's likely to be invasive and risky, and we're close
to release for RB7. This change handles the deletion issues.

The one thing which is potentially still undeleted is the screenshots
relation, but we no longer provide any way for users to create
Screenshot objects, so that should be virtually impossible to hit.

  • Ran unit tests.
  • Created drafts with various types of data attached and verified that
    after I discarded those drafts, all related data was properly deleted.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

orig
1
2

Commits

First Last Summary ID Author
Fix more deletion bugs with review request drafts.
We had two additional deletion bugs lurking with review request drafts. Deleting ("discarding") the draft was failing to delete the associated ChangeDescription and DiffSet objects, causing these to be left orphaned. This was once again exposing the API bug where attempting to serialize a link to an orphaned object was crashing when it tried to get the parent object (in this case the draft that was the parent of a DiffSet that had no associated history object). Bullet-proofing the API serialization will happen separately in a later version, since that's likely to be invasive and risky, and we're close to release for RB7. This change handles the deletion issues. The one thing which is potentially still undeleted is the screenshots relation, but we no longer provide any way for users to create Screenshot objects, so that should be virtually impossible to hit. Testing Done: - Ran unit tests. - Created drafts with various types of data attached and verified that after I discarded those drafts, all related data was properly deleted.
b90424e202660956e416df0f04410cbf32a62ded David Trowbridge
reviewboard/reviews/signal_handlers.py
reviewboard/reviews/models/review_request_draft.py
reviewboard/reviews/tests/test_signal_handlers.py
Loading...