Skip to content

Studio: exempt shared top-level trees from the integrity check for our own wheels too - #8179

Merged
danielhanchen merged 1 commit into
mainfrom
fix-shared-top-level-verify
Aug 8, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-shared-top-level-verify

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Apply the shared-top-level-tree exemption in Studio's post-update integrity check to Unsloth's own distributions as well. Without it, unsloth studio update fails on every attempt with a finding no reinstall can clear.

Motivation

#8092 added _SHARED_NON_RUNTIME_ROOTS so a row under a squatted top-level namespace (test/, tests/, docs/, scripts/, ...) no longer counts as damage. Ownership of those paths is unreliable: whichever wheel installs last wins, and any of them uninstalling takes the others' files with it.

It exempted third parties only. The reasoning was that a missing __init__.py does not make a directory unimportable and that the repo imports scripts.* itself, so our own top-level trees should stay guaranteed. That does not hold in practice. Nothing under unsloth/, unsloth_cli/ or studio/ imports a top-level scripts or tests at runtime, and unsloth ships neither. unsloth_zoo did: every release from 2026.5.2 to 2026.8.5 packaged the repo's tests/ and scripts/ trees into site-packages, straight into the same shared namespace.

So the carve-out singled out the one distribution of ours that was actually exposed to the collision:

Update finished, but some installed files are damaged:
  unsloth_zoo: tests/conftest.py is 8107 bytes, expected 11429

11429 is exactly tests/conftest.py in the 2026.8.5 wheel, so the recorded size is ours and the file on disk is not. This was reported on 2026.8.8, which already carries #8092, on an install that was otherwise up to date. The einx and package-lock.json findings were gone and only this one remained, on every retry. The printed remedy cannot help, because pip sees intact metadata and nothing is really damaged.

Ownership being unreliable is a property of the path, not of the distribution claiming it. unsloth-zoo#1016 stops shipping the two trees, but anyone who already has unsloth_zoo 2026.5.2 through 2026.8.5 installed keeps the polluted site-packages, so the check has to tolerate it.

Changes

  • unsloth_cli/_studio_deps.py: drop the _OUR_DISTRIBUTIONS carve-out from _shared_non_runtime, which no longer needs the distribution name.
  • studio/backend/utils/transformers_version.py: same carve-out removed from the sidecar scan, keeping the two implementations in sync.
  • Tests for the reported shrinkage, for the deletion shape, and for our runtime trees still being checked.

The exemption stays scoped to the shared roots. unsloth_zoo/tests/helper.py is inside a package we own and is still reported when it goes missing, as is every other runtime path.

How to test

python -m pytest unsloth_cli/tests/test_studio_update_verify.py studio/backend/tests/test_transformers_version.py tests/python/test_windows_studio_update_launcher.py unsloth_cli/tests/test_studio_update_local_repo.py -q

413 passed. Full unsloth_cli/tests: 942 passed, 4 skipped. Reverting only the two source files while keeping the new tests fails all three of the added cases and passes both "still checked" guards.

Related

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 7cace50de9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit c2c16b7 into main Aug 8, 2026
60 of 65 checks passed
@danielhanchen
danielhanchen deleted the fix-shared-top-level-verify branch August 8, 2026 13:21
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