Skip to content

fix: skip corrupt or malformed wheels instead of aborting - #141

Draft
aiolibsbot wants to merge 2 commits into
bdraco:mainfrom
aiolibsbot:koan/skip-corrupt-wheels
Draft

aiolibsbot wants to merge 2 commits into
bdraco:mainfrom
aiolibsbot:koan/skip-corrupt-wheels

Conversation

@aiolibsbot

@aiolibsbot aiolibsbot commented May 17, 2026

Copy link
Copy Markdown

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_index walked the wheelhouse and let zipfile.BadZipFile / packaging.utils.InvalidWheelFilename propagate. 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_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 — no orchestration changes needed.
  • Bad wheels are not linked into the index and not cached, so they're re-checked on the next run once replaced or removed.
  • packaging (a transitive dep via dist-meta) is now declared explicitly since we import from it directly.

Testing

  • New unit tests: extract_metadata_from_wheel_file returns None for both a corrupt zip with a valid wheel name and a file with an invalid wheel name.
  • New integration test: make_index continues past a corrupt wheel, the good wheels are indexed, and no spurious project page / metadata file is produced for the bad one.
  • Full suite: 17 passed, coverage 97%.

🤖 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)

  • Branch is not pushed to remote

Generated by Kōan post-mission quality pipeline

aiolibsbot and others added 2 commits May 17, 2026 18:06
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>
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.

1 participant