Skip to content

Fix RepositoryVersion.remove_content using wrong queryset for lazy co…#7853

Open
git-hyagi wants to merge 1 commit into
pulp:mainfrom
git-hyagi:fix-repo-version-remove-lazy-content
Open

Fix RepositoryVersion.remove_content using wrong queryset for lazy co…#7853
git-hyagi wants to merge 1 commit into
pulp:mainfrom
git-hyagi:fix-repo-version-remove-lazy-content

Conversation

@git-hyagi

Copy link
Copy Markdown
Contributor

…ntent

The remove_content method was incorrectly using the unfiltered content queryset instead of to_remove when deleting or marking RepositoryContent entries as removed. This caused all content to be removed from the repository version rather than only the specified lazy content.

Fixes: #7851

📜 Checklist

  • Commits are cleanly separated with meaningful messages (simple features and bug fixes should be squashed to one commit)
  • A changelog entry or entries has been added for any significant changes
  • Follows the Pulp policy on AI Usage
  • (For new features) - User documentation and test coverage has been added

See: Pull Request Walkthrough

…ntent

The remove_content method was incorrectly using the unfiltered `content`
queryset instead of `to_remove` when deleting or marking
RepositoryContent entries as removed. This caused all content to be
removed from the repository version rather than only the specified lazy
content.

Fixes: pulp#7851

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread CHANGES/7851.bugfix
@@ -0,0 +1 @@
Fixed `RepositoryVersion.remove_content` incorrectly removing all content instead of only the specified lazy content.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't really reflect the scenario the remove could fail in. It's when the remove is self-referential and the amount is greater than 65k, correct?

RepositoryContent.objects.filter(
repository=self.repository,
content_id__in=content,
content_id__in=to_remove,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens when to_remove is greater than 65k? Does this break?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remove_content() silently fails to update RepositoryContent when content queryset transitively depends on content_ids (>= 65,535 items)

2 participants