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 package_versions.version_order database field after package version deletion #562

Merged
merged 3 commits into from
Oct 18, 2022

Conversation

kuepe-sl
Copy link
Contributor

fixes #560 by regenerating the package_versions table after deleting the package

Note: This does NOT fix the issue where uploading multiple packages at once will result in inconsistent version_order values.
The inconsistency is shown in the mentioned issue as well, but I'm not sure if it has any negative implications.

@codecov-commenter
Copy link

codecov-commenter commented Oct 12, 2022

Codecov Report

Base: 82.53% // Head: 81.74% // Decreases project coverage by -0.79% ⚠️

Coverage data is based on head (697b35d) compared to base (ede8731).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #562      +/-   ##
==========================================
- Coverage   82.53%   81.74%   -0.80%     
==========================================
  Files          78       78              
  Lines        6048     6049       +1     
==========================================
- Hits         4992     4945      -47     
- Misses       1056     1104      +48     
Impacted Files Coverage Δ
quetz/main.py 86.87% <100.00%> (+0.01%) ⬆️
quetz/pkgstores.py 42.45% <0.00%> (-11.60%) ⬇️
quetz/dao.py 89.94% <0.00%> (+0.98%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@wolfv wolfv added the bug Something isn't working label Oct 12, 2022
@wolfv
Copy link
Member

wolfv commented Oct 12, 2022

Can you add a test?
Also, I think it would be nice to add an argument to the cleanup function that takes a package name, so that only that specific package is cleaned up. Would you be able to do that?

@kuepe-sl
Copy link
Contributor Author

I'll see what I can do.

This allows for recalculating data for only a single package instead of
the whole channel.
@kuepe-sl
Copy link
Contributor Author

I added the package name parameter, as well as a test.

I made sure that the test fails with the old behaviour:

quetz/tests/api/test_main_packages.py::test_package_current_version[test-package-/api/channels/{channel_name}/packages/{package_name}] FAILED
[...]
        if isinstance(package_data, list):
            assert len(package_data) == 1
            package_data = package_data[0]
>       assert package_data['current_version'] == v1n.version
E       AssertionError: assert None == '0.1'
E        +  where '0.1' = <quetz.db_models.PackageVersion object at 0x7f6ee82428c0>.version

/home/user/quetz/quetz/tests/api/test_main_packages.py:705: AssertionError

@kuepe-sl
Copy link
Contributor Author

@wolfv Is this good now?

@wolfv wolfv merged commit a8e3988 into mamba-org:main Oct 18, 2022
@kuepe-sl kuepe-sl deleted the fix-package-deletion branch October 18, 2022 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting the most recent package revision sets the "current_version" and "latest_change" fields to null
3 participants