Skip to content

Fix O(N) global scan in artifact-version delete#4686

Open
joaquinhuigomez wants to merge 1 commit intozenml-io:developfrom
joaquinhuigomez:fix/artifact-version-delete-perf
Open

Fix O(N) global scan in artifact-version delete#4686
joaquinhuigomez wants to merge 1 commit intozenml-io:developfrom
joaquinhuigomez:fix/artifact-version-delete-perf

Conversation

@joaquinhuigomez
Copy link
Copy Markdown

Summary

  • Replaces the global depaginate(list_artifact_versions, only_unused=True) membership check in _delete_artifact_version with a targeted query that filters by the specific artifact version ID (id=artifact_version.id, only_unused=True, size=1)
  • This avoids re-listing every unused artifact version on each delete call, which caused O(N) paginated API requests per deletion (see Performance bug: artifact-version delete does global only_unused depagination per delete #4684 for profiling data showing ~41s per delete reduced to ~0.6s)

Test plan

  • Verify Client.delete_artifact_version() still raises ValueError for in-use artifact versions
  • Verify unused artifact versions are deleted successfully
  • Confirm paginated GET calls are reduced from O(N) to 1 per deletion

Fixes #4684

Replace depaginate(list_artifact_versions, only_unused=True) with a
targeted query filtering by the specific artifact version ID, avoiding
a full scan of all unused versions on every delete call.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@bcdurak
Copy link
Copy Markdown
Contributor

bcdurak commented Apr 7, 2026

@joaquinhuigomez thank you for the PR! Can you please sign the CLA? We will take a look as soon as possible.

@schustmi schustmi added the no-release-notes Release notes will NOT be attached and used publicly for this PR. label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release-notes Release notes will NOT be attached and used publicly for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants