Skip to content

Count a RECORD path claim before the row is filtered out - #8181

Merged
danielhanchen merged 2 commits into
unslothai:mainfrom
Imagineer99:fix/verifier-shared-path-ownership
Aug 8, 2026
Merged

danielhanchen merged 2 commits into
unslothai:mainfrom
Imagineer99:fix/verifier-shared-path-ownership

Conversation

@Imagineer99

@Imagineer99 Imagineer99 commented Aug 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Count a RECORD path claim before the row is filtered out of the scan, in both the CLI verifier and the sidecar scanner, and add a two-owner regression test.

Why

The unsloth_zoo: tests/conftest.py is 8107 bytes, expected 11429 failure had two halves. This PR carries the second one.

_shared_non_runtime dropped a row with continue, and that continue sat above owners[key] += 1. So a filtered row never registered its claim on the path. When two distributions shipped the same top-level tests/conftest.py and only one of the rows was filtered, the survivor looked singly owned, and owners[key] == 1 let its recorded size be compared against a file the other distribution had written. The size on disk was never a statement about the retained RECORD in the first place.

#8179 fixed the reachable half by exempting the shared roots for every distribution rather than third parties only, which is what unblocks the reported installs. Filtering is now root-based and identical for every claimant, so two distributions claiming one path are always both filtered or both retained, and the tally can no longer go stale.

Scope

This changes no behavior on current main. Verified: the added test passes with and without the reordering. It is an invariant, not a fix. The ordering was load-bearing once and would be again the moment the exemption is narrowed by distribution, by path, or by anything else, so it is worth stating in code rather than leaving as a property that happens to hold.

Also corrects the _shared_non_runtime docstring, which claimed the row "stays out of the ownership tally" as though that were intended.

Changes

  • unsloth_cli/_studio_deps.py: resolve the target and count the claim before the _shared_non_runtime filter.
  • studio/backend/utils/transformers_version.py: the same reordering in _sidecar_scan_impl.
  • test_two_distributions_claiming_one_shared_path: two distributions claim tests/conftest.py, the second lands last and shorter, and neither the size drift nor the deletion is damage.

Dropped from the original version of this PR

Keeping scripts/ checked for Unsloth-owned distributions, since unsloth_zoo 2026.5.2 through 2026.8.5 shipped four files under a top-level scripts/:

scripts/enforce_kwargs_spacing.py  scripts/lint_workflow_triggers.py
scripts/scan_packages.py           scripts/verify_comment_only_diff.py

Retaining those rows leaves the einx failure shape live for our own wheel: the ownership tally only gates the size comparison, while the missing-file branch reports regardless of how many distributions claim the path. Nothing under unsloth/, unsloth_cli/ or studio/ imports a top-level scripts at runtime, and unsloth's own wheel never shipped one, so there is nothing there to guarantee.

The rest of the original diff is in #8179.

How to test

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

330 passed. Full unsloth_cli/tests: 943 passed, 4 skipped.

@danielhanchen
danielhanchen force-pushed the fix/verifier-shared-path-ownership branch from d09cfb1 to 3021266 Compare August 8, 2026 13:39
@danielhanchen danielhanchen changed the title Fix Studio verifier handling of shared non-runtime paths Count a RECORD path claim before the row is filtered out Aug 8, 2026
@danielhanchen

Copy link
Copy Markdown
Member

Narrowed this onto current main and force-pushed to the branch (previous head was d09cfb1, still reachable from the PR's commit history if you want it back).

#8179 landed the overlapping half about five minutes after you opened this, which is what put the branch in conflict. What is left here is the part that was only in your version: counting the ownership claim before the row is filtered, plus the two-owner regression test, which is a better shape than the single-distribution one I wrote.

Two things I dropped.

Keeping scripts/ checked for Unsloth-owned distributions would regress the merged fix. unsloth_zoo 2026.5.2 through 2026.8.5 shipped four files under a top-level scripts/, and the ownership tally only gates the size comparison while the missing-file branch reports regardless of the claim count, so unsloth_zoo: scripts/scan_packages.py is missing would still wedge an update. Nothing under unsloth/, unsloth_cli/ or studio/ imports a top-level scripts at runtime, and our own wheel never shipped one.

The caio attribution does not hold up, so I left it out of the body. caio does ship a top-level tests/conftest.py, but no published release is 8107 bytes (0.11.1 is 3515, 0.11.2 is 4628, 0.12.1 and 0.12.2 are both 7859), and it publishes no Windows wheels at all, while the reported environment is Windows. The mechanism you described is right and it is the actual root cause of the original misfire; the specific package is still unidentified.

Worth being explicit that this is now behavior-neutral on main: the added test passes with and without the reordering. It is an invariant rather than a fix. Good catch on the ordering either way, it was the real reason the check misfired.

@danielhanchen
danielhanchen marked this pull request as ready for review August 8, 2026 13:42
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 15c10464e2

ℹ️ 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 5f5f1e3 into unslothai:main Aug 8, 2026
6 of 61 checks passed
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.

2 participants