Skip to content

Compare a full pass to a skipping one without the click both record as unmet - #11578

Merged
danielhanchen merged 4 commits into
mainfrom
fix/full-deps-idempotency-reads-known-unmet
Sep 22, 2026
Merged

danielhanchen merged 4 commits into
mainfrom
fix/full-deps-idempotency-reads-known-unmet

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Unsloth Update CI (Unsloth Updating Tests on Linux and macOS) has failed on every run that finished since #11405. The last success was at 12:04Z today. Two tests fail on one difference:

test_full_deps_forces_every_step_and_still_changes_nothing
test_the_install_is_left_working
  At index 25 diff: ['click', '8.5.0'] != ['click', '8.3.0']

The per-run update logs in the failing run's studio-update-log artifact (run 35761917436) show why:

Pass Order of the steps that touch click click after
install.sh data designer deps, then diffusers pin, then diffusers main 8.5.0
run1-settle (studio update) data designer deps; diffusers pin superseded; diffusers main (satisfied, skipped) 8.3.0
fault-full-deps (UNSLOTH_STUDIO_FULL_DEPS=1) data designer deps, then diffusers pin, then diffusers main 8.5.0

No click satisfies both requirements. Every sqlfluff 3.x caps click<=8.3.0, and data-designer-deps.txt requires sqlfluff<4. huggingface-hub 1.32 needs click>=8.4.2. The installer already records this as known_unmet. Before #11405 the only diffusers step after data designer was the release pin, and reinstalling an already-satisfied version pin re-resolves nothing, so every pass ended on the data-designer answer. #11405 added Diffusers main as a direct reference, which does get resolved, and that resolve pulls hub's closure and moves click. Which way click lands now depends on whether that step ran. It is not a skip that failed to do its work.

Change

_assert_same_distributions replaces the two exact list comparisons:

  • A distribution is set aside only if both manifests list it in known_unmet, and only if each record is fresh. As in the installer, a record counts only when its known_unmet_index matches the digest of the installed set it is read against. snapshot() computes that digest in the venv with the installer's own installed_dependency_index; it matches _installed_index_digest() on a real venv.
  • It must still be installed on both sides. Names are compared with multiplicity, so an extra or missing metadata record (a pip backup, a duplicate dist-info) fails even for an exempted name.
  • Every other name and version must match.
  • <...> entries (an audit that could not run) name nothing, so they exempt nothing.

Checked against synthetic snapshots:

Case Result
click flips, both manifests record it (this CI failure) pass
click flips, the after manifest does not record it fail
click flips, but either record's known_unmet_index is stale fail
a second click record appears next to the first fail
click flips and hub moves as well fail
only audit-failed <...> entries fail

Not changed, and worth deciding

The installer itself is untouched. The step order is deliberate: the diffusers steps "must run after every other requirements file so nothing re-resolves Diffusers back to a release". The effect for users is that a --local update or full pass leaves click on either side of the conflict, depending on which steps ran. Neither side meets both requirements; ending on one fixed side would need a constraint on one of the steps.

Verification

This test only runs against a real install (UNSLOTH_IDEMPOTENCY_E2E=1), so the end-to-end check is this PR's own Unsloth Update CI run, which triggers on this file.

…s unmet

Unsloth Update CI has failed on Linux and macOS since #11405 (last success
12:04Z): test_full_deps_forces_every_step_and_still_changes_nothing and
test_the_install_is_left_working see click 8.5.0 against 8.3.0 and nothing
else. sqlfluff<4 caps click at 8.3.0 and huggingface-hub 1.23+ needs 8.4.2,
so click lands wherever the last step that resolved it put it. #11405 added
Diffusers main as a direct reference after the data-designer deps; installing
it re-resolves hub's closure. install.sh and a full-deps pass run it (8.5.0);
the settle run re-ran data-designer deps and skipped it (8.3.0). The update
logs in the run's studio-update-log artifact show exactly that.

A distribution both manifests record as known_unmet is now set aside. It
must still be installed on both sides, and every other name and version must
match.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex 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

chatgpt-codex-connector Bot commented Sep 22, 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-22T19:39:56.026143Z 9faa90c 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: 1bd6a91756

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

main from a direct reference after the data-designer deps, re-resolving hub's closure, and a
pass that skips that step leaves the data-designer answer. Nothing else is set aside.
"""
torn = _known_unmet_names(before) & _known_unmet_names(after)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate known-unmet evidence against its installed-set digest

When a dependency changes after its manifest was written—for example, because a late resolver step introduces the ordering regression this test is intended to detect—the stale manifest can still name that dependency in known_unmet; intersecting names here then filters out its changed version and lets both assertions pass. Production deliberately trusts this field only when known_unmet_index matches the current installed-set digest, so this helper should apply the same freshness check, or derive the exception from a current audit, before ignoring a distribution.

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.

Agreed. snapshot() now computes the installed-set digest in the venv with the installer's own installed_dependency_index, hashed as _installed_index_digest does (checked equal to _installed_index_digest on a real venv), and a record whose known_unmet_index does not match it names nothing. A stale record on either side now fails the comparison. Fixed in ca95428.

The installer reads the record only when known_unmet_index matches the
current installed-set digest, and so should the test: a stale record could
otherwise set aside a distribution a later step moved. snapshot() now computes
that digest in the venv with the installer's own installed_dependency_index,
hashed as _installed_index_digest hashes it; a record whose index does not
match names nothing.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: ca95428f23

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

Comment on lines +993 to +997
assert {_dist_name(n) for n, _ in before["distributions"]} == {
_dist_name(n) for n, _ in after["distributions"]
}, f"{message}: a distribution was installed or removed"
assert [d for d in after["distributions"] if _dist_name(d[0]) not in torn] == [
d for d in before["distributions"] if _dist_name(d[0]) not in torn

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve multiplicity for exempted distributions

When a full pass introduces an extra metadata record for a known-unmet package, this comparison still passes: the set comparison collapses both records to one normalized name, and the next comparison filters every row with that name. This is reachable with pip backup/duplicate metadata—installed_dependency_index() intentionally ignores ~...dist-info backups, so the manifest digest can remain fresh while DIST_LIST contains the extra record—and verify-install does not generally reject duplicates for non-core packages such as click. Compare the per-name record counts/identities before exempting only the version difference, otherwise the end-to-end test no longer detects this install corruption.

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.

Agreed. The names are now compared as per-name counts, so a second click record fails before any version is set aside. Fixed in 9faa90c.

A set of names collapses a second metadata record for an exempted
distribution (a pip backup the installer's index skips, a duplicate
dist-info), and the version filter then hides it. Compare per-name counts
instead, so an extra or missing record fails even for a known_unmet name.
@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: 9faa90cd15

ℹ️ 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 20f3f50 into main Sep 22, 2026
35 of 37 checks passed
@danielhanchen
danielhanchen deleted the fix/full-deps-idempotency-reads-known-unmet branch September 22, 2026 20:06
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…s unmet (unslothai#11578)

* Compare a full pass to a skipping one without the click both record as unmet

Unsloth Update CI has failed on Linux and macOS since unslothai#11405 (last success
12:04Z): test_full_deps_forces_every_step_and_still_changes_nothing and
test_the_install_is_left_working see click 8.5.0 against 8.3.0 and nothing
else. sqlfluff<4 caps click at 8.3.0 and huggingface-hub 1.23+ needs 8.4.2,
so click lands wherever the last step that resolved it put it. unslothai#11405 added
Diffusers main as a direct reference after the data-designer deps; installing
it re-resolves hub's closure. install.sh and a full-deps pass run it (8.5.0);
the settle run re-ran data-designer deps and skipped it (8.3.0). The update
logs in the run's studio-update-log artifact show exactly that.

A distribution both manifests record as known_unmet is now set aside. It
must still be installed on both sides, and every other name and version must
match.

* Trust known_unmet only against the installed set it was written for

The installer reads the record only when known_unmet_index matches the
current installed-set digest, and so should the test: a stale record could
otherwise set aside a distribution a later step moved. snapshot() now computes
that digest in the venv with the installer's own installed_dependency_index,
hashed as _installed_index_digest hashes it; a record whose index does not
match names nothing.

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

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

* Count records per name before setting a known_unmet version aside

A set of names collapses a second metadata record for an exempted
distribution (a pip backup the installer's index skips, a duplicate
dist-info), and the version filter then hides it. Compare per-name counts
instead, so an extra or missing record fails even for a known_unmet name.

---------

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