Skip to content

Conversation

@mvandenburgh
Copy link
Member

@mvandenburgh mvandenburgh commented Nov 10, 2025

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. 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 draft Version object. Then, during the _publish_dandiset service function, we call .save() on the draft Version object, 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 publishedBy and datePublished fields not being displayed anywhere in the UI, but became obvious with the addition of the releaseNotes field.

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 publishedBy and datePublished fields in their metadata.

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.
@mvandenburgh mvandenburgh added patch Increment the patch version when merged release Create a release when this pr is merged labels Nov 10, 2025
Copy link
Member

@jjnesbitt jjnesbitt left a comment

Choose a reason for hiding this comment

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

Good catch!

@mvandenburgh mvandenburgh merged commit c825384 into master Nov 12, 2025
7 checks passed
@mvandenburgh mvandenburgh deleted the fix-publish-bug branch November 12, 2025 02:34
@dandibot
Copy link
Member

🚀 PR was released in v0.18.1 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Increment the patch version when merged release Create a release when this pr is merged released This issue/pull request has been released.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants