Skip to content

CM-72724: Enable ZIP64 and spool the scan archive to disk - #547

Open
omer-roth wants to merge 4 commits into
mainfrom
CM-72724-cli-scan-crashes-on-repos-with-65-535-files-instead-of-falling-back-to-batched-upload
Open

omer-roth wants to merge 4 commits into
mainfrom
CM-72724-cli-scan-crashes-on-repos-with-65-535-files-instead-of-falling-back-to-batched-upload

Conversation

@omer-roth

Copy link
Copy Markdown
Collaborator

Symptoms

Scans of repositories with more than 65,535 files crashed instead of falling back to the batched upload.

Root cause

Zip archive building sets allowZip64=False, so zipfile raised LargeZipFile - which the caller did not catch, because the only guard there was the archive's byte size.

Fix

  1. Enable ZIP64 on 64-bit interpreters, route to the batched upload when a single archive provably cannot hold the documents, and log which upload mode was selected and why.

  2. Take the archive off the heap: it is now built into a SpooledTemporaryFile that stays in memory below 64 MB and spills into <config dir>/tmp beyond it, and the archive built to check that everything fits is reused for the upload instead of being thrown away and rebuilt.

Scans of repositories with more than 65,535 files crashed instead of
falling back to the batched upload. The archive was built with
allowZip64=False, so zipfile raised LargeZipFile - which the caller did
not catch, because the only guard there was the archive's byte size.

Enable ZIP64 on 64-bit interpreters, route to the batched upload when a
single archive provably cannot hold the documents, and log which upload
mode was selected and why.

Also take the archive off the heap: it is now built into a
SpooledTemporaryFile that stays in memory below 64 MB and spills into
~/.cycode/tmp beyond it, and the archive built to check that everything
fits is reused for the upload instead of being thrown away and rebuilt.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…35-files-instead-of-falling-back-to-batched-upload
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.

3 participants