fix(nimbus): prevent kinto preview sync from clobbering concurrent user state transitions#15619
Merged
Conversation
…ites Because * nimbus_synchronize_preview_experiments_in_kinto hydrated experiments in memory, made slow Kinto network calls, then called experiment.save() inside transaction.atomic, writing all fields back from the stale in-memory instance * Any concurrent write to a Preview experiment during the kinto push window — most visibly a user clicking Request Launch (PreviewToReviewForm committing status=DRAFT, status_next=LIVE, publish_status=REVIEW) — was silently overwritten by the task's full-object save; the HTMX response rendered as if the click succeeded but a hard refresh showed the experiment back in Preview * All three sections (push to preview, expire from preview, unpublish from preview) had the same lost-update shape, differing only in the width of the window This commit * Replaces experiment.save() with conditional QuerySet.update() in all three sections, gating each write on the status the task observed (status=PREVIEW for push and expire, status=DRAFT for the unpublish field-clear); if the row has moved on, the WHERE clause matches zero rows and the task takes no action * Each section now writes only the columns it owns rather than every field on the model * For push and expire, skips the changelog when the conditional UPDATE affects no rows; for unpublish, preserves the existing REMOVED_FROM_PREVIEW changelog whether or not the field-clear applied (the kinto record was already deleted) * Adds regression tests covering a concurrent Request Launch during the push window and a concurrent transition out of Preview during the expiry window Fixes #15618
yashikakhurana
approved these changes
May 13, 2026
Contributor
yashikakhurana
left a comment
There was a problem hiding this comment.
oh nice catch, thanks @jaredlockhart
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.
Because
This commit
Fixes #15618