fix: skip corrupt or malformed wheels instead of aborting - #141
Draft
aiolibsbot wants to merge 2 commits into
Draft
aiolibsbot wants to merge 2 commits into
aiolibsbot wants to merge 2 commits into
Conversation
A single bad wheel in the origin directory (truncated download, partial upload, non-PEP-427 filename) previously raised BadZipFile or InvalidWheelFilename and aborted the entire index build, leaving every other wheel unindexed. For a wheelhouse with thousands of files this is a poor failure mode — one bad file shouldn't punish the rest. extract_metadata_from_wheel_file now catches BadZipFile and InvalidWheelFilename, logs a warning, and returns None. The existing None-path in WheelFile.from_wheel and _make_index_at_temp_dir already skips files cleanly, so no other plumbing changes are needed. Bad wheels are not linked into the index and not cached, so they're re-checked on the next run once they've been replaced or removed. packaging is already a transitive dependency via dist-meta; declare it explicitly since we now import from it directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One bad wheel in the origin directory (truncated download, partial upload, non-PEP-427 filename) no longer aborts the entire index build — it's logged and skipped, and every other wheel still gets indexed.
Why
make_indexwalked the wheelhouse and letzipfile.BadZipFile/packaging.utils.InvalidWheelFilenamepropagate. In a directory with thousands of wheels, a single partial upload meant zero wheels indexed and the live symlink unchanged. That's a poor failure mode for batch indexing.How
extract_metadata_from_wheel_filenow catchesBadZipFileandInvalidWheelFilename, logs a warning, and returnsNone.None-path inWheelFile.from_wheeland_make_index_at_temp_diralready skips files cleanly — no orchestration changes needed.packaging(a transitive dep viadist-meta) is now declared explicitly since we import from it directly.Testing
extract_metadata_from_wheel_filereturnsNonefor both a corrupt zip with a valid wheel name and a file with an invalid wheel name.make_indexcontinues past a corrupt wheel, the good wheels are indexed, and no spurious project page / metadata file is produced for the bad one.🤖 Generated with Claude Code
Quality Report
Changes: 4 files changed, 54 insertions(+), 6 deletions(-)
Code scan: clean
Tests: failed (command not found)
Branch hygiene: 1 issue(s)
Generated by Kōan post-mission quality pipeline