Skip to content

Pin the win_arm64 scikit-learn to one version so the security audit cannot go red on its own - #11112

Merged
danielhanchen merged 3 commits into
mainfrom
fix-arm64-sklearn-pin
Sep 16, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
fix-arm64-sklearn-pin

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

tests/security/test_scan_packages.py::test_digest_pinned_packages_are_pinned_on_every_supported_python is failing on main right now. I confirmed it against origin/main in a detached worktree, so it is independent of any open PR.

extras.txt:7: scikit-learn>=1.8.0; sys_platform == "win32" and platform_machine == "ARM64"

Why this matters beyond a red test

The guard is not a style rule. scripts/scan_packages_baseline.json records findings keyed by a hash of the scanned file's contents, and scikit-learn carries 13 such entries. A floating version means the next upstream release changes those contents, all 13 stop matching, and the security audit turns red on whichever unrelated pull request happens to run after the publish. The test's own failure message says precisely this:

these packages carry digest-pinned baseline entries but are not pinned to one version in what the security audit scans, so it goes red whenever upstream publishes

So this is a latent trap as much as a current failure: it is red today, and it would have become red again at an arbitrary future moment.

The fix

Pin the ARM64 branch to ==1.8.0.

I checked PyPI rather than trusting the comment: the releases carrying win_arm64 wheels are 1.8.0, 1.9.0 and 1.9.1. 1.8.0 is the lowest, which satisfies the reason the ARM64 branch exists at all (the neighbouring comment notes 1.7.1 would source-build there) while staying as close as wheel availability allows to the ==1.7.1 pin on the other branch.

The comment now records why both lines must be exact pins, so the next person editing them does not reintroduce a range.

Verification

  • tests/security/: 700 passed, 6 skipped. The same suite fails on main today.
  • scikit-learn appears in only one requirements file; the other reference is a Colab freeze snapshot (scripts/data/colab_pip_freeze.gpu.txt), which is captured output rather than a spec and is untouched.

No behaviour change for any platform other than Windows ARM64, where the resolved version moves from "whatever is newest at install time" to a fixed 1.8.0.

…annot go red on its own

The ARM64 branch of this requirement landed as `scikit-learn>=1.8.0`, which
tests/security/test_scan_packages.py rejects and which is currently failing on
main.

The guard is not style. scripts/scan_packages_baseline.json records findings
keyed by a hash of the scanned file's contents, and scikit-learn carries 13 such
entries. A floating version means the next upstream release changes those
contents, every one of the 13 stops matching, and the security audit turns red on
whichever unrelated pull request happens to run after the publish. The test says
exactly that in its own failure message.

1.8.0 is the lowest release that ships win_arm64 wheels, confirmed against PyPI,
so it satisfies the reason the ARM64 branch exists while staying as close to the
1.7.1 pin on the other branch as wheel availability allows.

tests/security passes 700 with 6 skipped after the change; the same suite fails
on main today.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T16:06:28.885920Z 55f4c80 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6fd764f6fb

ℹ️ 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".

# branch as close to 1.7.1 as the wheel availability allows.
scikit-learn==1.7.1; sys_platform != "win32" or platform_machine != "ARM64"
scikit-learn>=1.8.0; sys_platform == "win32" and platform_machine == "ARM64"
scikit-learn==1.8.0; sys_platform == "win32" and platform_machine == "ARM64"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reconcile the ARM64 floor regression test with this exact pin

This exact pin deterministically breaks tests/studio/install/test_diffusers_pin.py::test_the_win_arm64_floor_is_the_first_release_that_has_a_wheel, whose scikit-learn case requires the literal scikit-learn>=1.8.0 to preserve the earliest-wheel floor. Running that test against this commit produces 1 failed, 3 passed, so the broader suite remains red even though the security test is repaired; the floor guard and the new exact-pin invariant need to be reconciled in the same change.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and the right thing to flag: the two invariants genuinely could not both hold as written. Fixed in 6e5d0e4ce, which landed after this review.

The floor test asserted the >= spelling literally, but what it is for is that the resolver is not pushed above the first release carrying a win_arm64 wheel. An exact pin at that same version is that floor with the ceiling closed as well, so it now accepts either operator.

Not interchangeable in the other direction, which is why the pin is the side that stays. scan_packages_baseline.json keys its reviewed-benign findings by a hash of the scanned file contents, so a floating spec makes all 13 of this package's baseline entries stop matching the day upstream publishes, and reds the security audit on an unrelated PR. That is what is failing on main today.

test_diffusers_pin.py plus tests/security/: 147 passed. Setting the pin to 1.9.0 still fails the floor check, so the loosened test has not stopped biting.

danielhanchen and others added 2 commits September 16, 2026 12:43
The scikit-learn ARM64 branch has to be pinned exactly, because
scan_packages_baseline.json keys its reviewed-benign findings by a hash of
the scanned file's contents: a floating spec makes all 13 of this package's
baseline entries stop matching the moment upstream publishes, and the
security audit goes red on an unrelated PR. That is what is failing on main
today.

test_the_win_arm64_floor_is_the_first_release_that_has_a_wheel asserted the
>= spelling literally, so the two invariants could not both hold. It now
accepts == at the same version, which is the same floor with the ceiling
closed as well, and still rejects any floor above the first release carrying
a win_arm64 wheel.
@danielhanchen

Copy link
Copy Markdown
Member Author

Correct, and already addressed by 6e5d0e4, which landed after the commit you reviewed. Confirming it rather than asserting it, since the two guards now have to hold at once:

  • tests/studio/install/test_diffusers_pin.py on the head: 11 passed.
  • tests/security/test_scan_packages.py on the head: 136 passed. On origin/main at 1e6908d the same file is 1 failed, 135 passed, so the red is real and current, not an artefact of this branch.

The relaxed floor guard is still doing its job, checked by mutation rather than by reading it:

extras.txt floor guard security guard
==1.9.0 1 failed -
>=1.9.0 1 failed -
>=1.8.0 11 passed 1 failed
==1.8.0 11 passed 136 passed

So the two are complementary and only the intended spelling satisfies both: the floor guard still rejects a version above the first release carrying a win_arm64 wheel, with either operator, and the security guard rejects the floating form. Accepting == alongside >= widened the floor test by exactly the one case that closes the ceiling at the same version.

I also checked the version claim against PyPI rather than the comment: the releases publishing win_arm64 wheels are 1.8.0, 1.9.0 and 1.9.1, plus the 1.8.0rc1 and 1.9.0rc1 pre-releases. 1.8.0 is the lowest final release, so the pin is the closest available to the ==1.7.1 on the other branch. The baseline count in the description also holds: scikit-learn has 13 entries in scripts/scan_packages_baseline.json.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 55f4c80c39

ℹ️ 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 added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 16, 2026
@danielhanchen
danielhanchen merged commit 907f198 into main Sep 16, 2026
7 of 59 checks passed
@danielhanchen
danielhanchen deleted the fix-arm64-sklearn-pin branch September 16, 2026 13:41
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 16, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 907f19830c

ℹ️ 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".

shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…annot go red on its own (unslothai#11112)

* Pin the win_arm64 scikit-learn to one version so the security audit cannot go red on its own

The ARM64 branch of this requirement landed as `scikit-learn>=1.8.0`, which
tests/security/test_scan_packages.py rejects and which is currently failing on
main.

The guard is not style. scripts/scan_packages_baseline.json records findings
keyed by a hash of the scanned file's contents, and scikit-learn carries 13 such
entries. A floating version means the next upstream release changes those
contents, every one of the 13 stops matching, and the security audit turns red on
whichever unrelated pull request happens to run after the publish. The test says
exactly that in its own failure message.

1.8.0 is the lowest release that ships win_arm64 wheels, confirmed against PyPI,
so it satisfies the reason the ARM64 branch exists while staying as close to the
1.7.1 pin on the other branch as wheel availability allows.

tests/security passes 700 with 6 skipped after the change; the same suite fails
on main today.

* Let the ARM64 wheel floor be satisfied by an exact pin

The scikit-learn ARM64 branch has to be pinned exactly, because
scan_packages_baseline.json keys its reviewed-benign findings by a hash of
the scanned file's contents: a floating spec makes all 13 of this package's
baseline entries stop matching the moment upstream publishes, and the
security audit goes red on an unrelated PR. That is what is failing on main
today.

test_the_win_arm64_floor_is_the_first_release_that_has_a_wheel asserted the
>= spelling literally, so the two invariants could not both hold. It now
accepts == at the same version, which is the same floor with the ceiling
closed as well, and still rejects any floor above the first release carrying
a win_arm64 wheel.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: danielhanchen <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.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