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

Allow to track removed collections in collection-meta.yaml #173

Merged
merged 6 commits into from
Sep 23, 2024

Conversation

felixfontein
Copy link
Collaborator

This allows to create all changelog fragments related to deprecated and removed collections automatically.

@felixfontein
Copy link
Collaborator Author

The updated data can be seen here: ansible-community/ansible-build-data#459

Copy link
Collaborator

@gotmax23 gotmax23 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! I left some suggestions :).

Stores metadata on when and why a collection was removed.
"""

major_version: int
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be worth adding a comment that major_version cannot be TBD here (because it was already removed) like it is in the base class. That tripped me up for a minute. Or we could remove it entirely (and have another PendingRemovalInformation sub-model) like I suggested in another comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be no longer necessary due to 4759371.

src/antsibull_core/schemas/collection_meta.py Outdated Show resolved Hide resolved
@@ -292,6 +325,8 @@
"collections -> bad.foo8 -> removal: Value error, new_name must not be provided if reason is not 'renamed'",
"collections -> bad.foo9 -> removal: Value error, redirect_replacement_major_version must not be provided if reason is not 'renamed'",
"extra_stuff: Extra inputs are not permitted",
"removed_collections -> bad.foo1 -> removal -> major_version: Input should be a valid integer, unable to parse string as an integer",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could add a pre validator that specifically checks for TBD and gives a more helpful message in that case, but that might be overengineering.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be no longer necessary due to 4759371.

def _validate_removal_for_removed(
self, collection: str, removal: RemovedRemovalInformation, prefix: str
) -> None:
if removal.major_version != self.major_release:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should major_version not be part of RemovedRemovalInformation? Having removed_collections[NAME].removal.major_version and removed_collection[NAME].removed_version seems duplicative.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My idea was that one can simply move the metadata entry for the removed collection to the removed_collections list with minimal modifications (the removal_version entry needs to be added).

But since that modification is needed anyway, how about replacing major_version with a new version entry that replaces the removal_version one level up? I originally wanted to use an unmodified RemovalInformation here, that's why I added removal_version one level up, but now that there's a different class it might be easier to do it this way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My idea was that one can simply move the metadata entry for the removed collection to the removed_collections list with minimal modifications (the removal_version entry needs to be added).

Yeah, I figured that as well, but then I wondered if that was worth the potential confusion of having the same information twice.

But since that modification is needed anyway, how about replacing major_version with a new version entry that replaces the removal_version one level up? I originally wanted to use an unmodified RemovalInformation here, that's why I added removal_version one level up, but now that there's a different class it might be easier to do it this way.

That sounds reasonable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I implemented that in 4759371.

Copy link
Collaborator

@gotmax23 gotmax23 left a comment

Choose a reason for hiding this comment

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

Other than that, I think this is ready to go.

and self.major_version != "TBD"
and self.redirect_replacement_major_version
>= self.major_version # pyre-ignore[58]
and self.redirect_replacement_major_version >= self.version.major
):
raise ValueError(
"redirect_replacement_major_version must be smaller than major_version"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This text needs to be adjusted now that the major_version field is no longer there. Also, might be good to add a test case for this error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@felixfontein felixfontein merged commit 7a169a3 into ansible-community:main Sep 23, 2024
5 checks passed
@felixfontein felixfontein deleted the schema-removal branch September 23, 2024 08:50
@felixfontein
Copy link
Collaborator Author

@gotmax23 thanks for reviewing this!

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.

2 participants