warehouse icon indicating copy to clipboard operation
warehouse copied to clipboard

Add published field to Release

Open DarkaMaul opened this issue 1 year ago • 4 comments

This PR introduces the following changes :

  • a new boolean published field to the Release model
  • ~a migration to update every existing releases and set their published value to be the creation time~

Part of https://github.com/pypi/warehouse/issues/17230

Some notes:

~I dislike how I changed the default Release creation call to force the publish time to be set to a timestamp, but I did not find a better solution. This created a new quirk: every time someone wants to create a new Release, they must make sure the published field is set.~

~The problem boils down to not setting a value for publish at the release creation, which would either semantically mean the time is not set (the solution I chose) or use a default value (e.g., the current timestamp). When choosing the latter case, we would need a placeholder value on the Python side (e.g., published=False) and to convert this placeholder to an explicit null value ( using forcing-null-on-a-column-with-a-default )~

The new implementation uses a boolean field.

DarkaMaul avatar Dec 09 '24 14:12 DarkaMaul

Should this follow the same pattern we have for yanking, where there are yanking events with timestamps, and we have a yanked field on the model that is a boolean instead?

di avatar Dec 09 '24 15:12 di

Should this follow the same pattern we have for yanking, where there are yanking events with timestamps, and we have a yanked field on the model that is a boolean instead?

I like the idea as it would also not modify how new Releases are created.

DarkaMaul avatar Dec 09 '24 16:12 DarkaMaul

As this PR is now based on top of https://github.com/pypi/warehouse/pull/17472, I've converted it as a Draft until the other one is merged.

DarkaMaul avatar Jan 22 '25 09:01 DarkaMaul

I'm holding off on merging this until we think through https://github.com/pypi/warehouse/issues/17230#issuecomment-2643839592 a little bit more (specifically, the last bit about project/release/file lifecycles needs a bit more thought here I think)

di avatar Feb 07 '25 19:02 di