Merged
Conversation
There is a bug during the publishing process where a shallow reference to the draft `Version.metadata` dict is erroneously used for the newly created published `Version`. This means that when we insert new fields into the published metadata during the publishing process, we are also unknowingly adding them into the draft `Version` object that lives in memory. Then, during the `_publish_dandiset` service function, we call `.save()` on the draft version, which writes those new fields to the DB.
Member
|
🚀 PR was released in |
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.
There is a bug during the publishing process where a shallow reference to the draft
Version.metadatadict is erroneously used for the newly created publishedVersion. Because of this, when we insert new fields into the published metadata during the publishing process, we are also unknowingly adding them into the in-memory draftVersionobject. Then, during the_publish_dandisetservice function, we call.save()on the draftVersionobject, which writes those new fields to the draft version in the DB.I discovered this while testing out #2606, because I was seeing a bug where the release notes would get added to the draft version too (this is visible in the video in that PR's description; after the dandiset is published, notice that the "DRAFT" version in the UI has an icon next to it indicating release notes). This seems to have gone unnoticed due to the
publishedByanddatePublishedfields not being displayed anywhere in the UI, but became obvious with the addition of thereleaseNotesfield.I've confirmed that, out of the 984 draft versions on dandiarchive.org that have been published at least once, 389 of them have the
publishedByanddatePublishedfields in their metadata.