Skip to content

[ENG-10829] Embargoed Registration — End Embargo Early Button Missing | Fix wrong moderation_state after terminate_embargo() - #11841

Merged
adlius merged 1 commit into
CenterForOpenScience:feature/pbs-26-15from
mkovalua:fix/ENG-10829
Aug 4, 2026
Merged

[ENG-10829] Embargoed Registration — End Embargo Early Button Missing | Fix wrong moderation_state after terminate_embargo()#11841
adlius merged 1 commit into
CenterForOpenScience:feature/pbs-26-15from
mkovalua:fix/ENG-10829

Conversation

@mkovalua

Copy link
Copy Markdown
Contributor

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

@sh-andriy sh-andriy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@brianjgeiger
brianjgeiger requested a review from adlius August 4, 2026 14:13
@adlius
adlius merged commit f119479 into CenterForOpenScience:feature/pbs-26-15 Aug 4, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants