[ENG-10829] Embargoed Registration — End Embargo Early Button Missing | Fix wrong moderation_state after terminate_embargo() - #11841
Open
mkovalua wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
Purpose
There are a bunch of registrations on prod that has this particular problem: is_public=True, is_embargoed=False but the moderation state is still in pending_embargo_termination. Examples are 726kt, fgbp4, hmwdp, 6vhm4 mt7h8, hceu7, 45fbh, ktgu7, f69mh, and etc. They seem to fit a certain criteria:
The registration was previously embargoed
Embargo expires and the nightly run script embargo_registrations.py terminates their embargo by calling terminate_embargo()
It is suspected that somewhere within terminate_embargo() things go wrong. Here is a possible explanation:
osf.io/osf/models/registrations.py at develop · CenterForOpenScience/osf.io Here we do self.embargo_termination_approval.accept(), which eventually would lead to self.target_registration.update_moderation_state(initiated_by=user, comment=comment) atosf.io/osf/models/sanctions.py at develop · CenterForOpenScience/osf.io , this should set the moderation_state of the registration to accepted.
However, further down the line at osf.io/osf/models/registrations.py at develop · CenterForOpenScience/osf.io , we call set_privacy on the registration, which would lead to a full save on the registration model that still has the stale moderation state of pending_embargo_termination because the registration referenced here may be a different object (in memory) than the registration referenced within _save_transtion in sanctions.py, resulting in it clobbering the state back to pending_embargo_termination, even though two registration objects refer to the same row in the db.
(
https://openscience.atlassian.net/browse/ENG-10829?focusedCommentId=122430
)
Changes
Fix wrong moderation_state after terminate_embargo()
(
I have done SPIKE ticket research for End Embargo Early Button Missing | Fix wrong moderation_state after terminate_embargo()
https://openscience.atlassian.net/browse/ENG-10828?focusedCommentId=122422
maybe something from the research is possible to apply for code changings too
)
Side Effects
QE Notes
CE Notes
Documentation