Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version date calculation in corner cases #149

Merged
merged 2 commits into from
Oct 19, 2024
Merged

Fix version date calculation in corner cases #149

merged 2 commits into from
Oct 19, 2024

Conversation

srittau
Copy link
Contributor

@srittau srittau commented Oct 19, 2024

Previously, if the latest published stub version was higher
than the upstream version (which could happen with our old
versioning scheme), we always used the current date as
last component. This failed when uploading the same package
twice in a day – but also in our stub_uploader tests, which
simulate a new upload.

* Rename `date` argument to `today`.
* Cache `last_date` and add an explaining comment.
Previously, if the latest published stub version was higher
than the upstream version (which could happen with our old
versioning scheme), we always used the current date as
last component. This failed when uploading the same package
twice in a day – but also in our stub_uploader tests, which
simulate a new upload.
@srittau
Copy link
Contributor Author

srittau commented Oct 19, 2024

Best reviewed commit by commit.


# Make sure that the last published release is not unreasonable large.
assert int(date.strftime("%Y%m%d")) + 14 > max_published.release[-1]
assert int(today.strftime("%Y%m%d")) + 14 > last_date
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does 14 come from here? Is it just arbitrary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It's very unlikely we publish more than 14 versions in a day.

Copy link
Contributor

Choose a reason for hiding this comment

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

While 13 versions are just a little unlikely, I guess :)

Copy link
Contributor

Choose a reason for hiding this comment

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

While 13 versions are just a little unlikely, I guess :)

a little unlikely, but very unlucky

@srittau srittau merged commit ad65efe into main Oct 19, 2024
6 checks passed
@srittau srittau deleted the versions branch October 19, 2024 14:30
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