Skip to content

Scoped download tests: seed the Hub cache the offline path now pins - #16530

Merged
danielhanchen merged 1 commit into
mainfrom
dh/scoped-download-offline-cache
Nov 3, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
dh/scoped-download-offline-cache

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Since #16422 (1a951a93d6), (Python 3.13, rest) fails on unrelated PRs. On staging CI it hit #16423, #16182 and #16523 in the last hour, and it reproduces on current main:

studio/backend/tests/test_scoped_download_worker.py::test_offline_scoped_download_fails_when_the_files_are_not_on_disk
studio/backend/tests/test_scoped_download_worker.py::test_offline_scoped_download_passes_when_every_file_is_present
studio/backend/tests/test_scoped_download_worker.py::test_a_dangling_symlink_does_not_count_as_present
hub/workers/hf_download.py:476: in _pinned_snapshot_download
E   OSError: Cannot resolve an immutable revision for black-forest-labs/FLUX.1-dev; retry when metadata is available

#16422 made every download pin an immutable commit. When metadata is unreachable, _pinned_snapshot_download takes the commit from the Hub cache's refs/main and refuses when there is none, rather than letting snapshot_download hand back whatever folder is there. That is the point of #16422, and I left it alone.

These tests' offline fixture predates it. It returns a bare tmp snapshot dir and never puts a refs/main in the Hub cache, so every case now stops at "no revision to pin" before reaching what it checks: an incomplete copy, a complete copy, a dangling blob symlink. A real offline user with a previously downloaded model has refs/main and its snapshots/<commit>, so nothing changes for them.

Change

studio/backend/tests/test_scoped_download_worker.py only:

  • The fixture points huggingface_hub.constants.HF_HUB_CACHE at a tmp dir. It writes refs/main and returns snapshots/<commit> there, the layout an earlier download leaves behind.
  • The three existing tests and their assertions are unchanged.
  • New test_offline_with_no_cached_revision_refuses_before_downloading: with no metadata and no refs/main, the worker raises the "immutable revision" OSError and never calls snapshot_download. This pins Studio Hub download: keep refs/main on the last complete snapshot under failed updates and concurrent workers #16422's refusal, so the fixture change cannot hide a regression there.

Testing

  • tests/test_scoped_download_worker.py:
    • main: 3 failed, 1 passed (the error above);
    • this branch: 5 passed.
  • Sabotage: with the offline missing-file refusal in _download_scoped_snapshot disabled, the incomplete-copy and dangling-symlink tests fail, so they still guard what they were written for.
  • tests/test_hf_download*.py plus this file: 102 passed.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 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-11-03T07:18:04.059237Z abfef2f 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: abfef2fc1e

ℹ️ 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 0f4464e into main Nov 3, 2026
@danielhanchen
danielhanchen deleted the dh/scoped-download-offline-cache branch November 3, 2026 07:24
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 3, 2026
…nslothai#16476)

The mmap startup-progress test depends on a child process generating enough real page faults inside a 1.5-second stall window before health becomes ready at 2.5 seconds. It failed in the Python 3.13 CPU job even though the same test passed locally on both base and the auth branch. The exact remote scheduling or page-cache cause is unproven; a wall-clock resource dependency makes this an unreliable test of the progress policy.

The reviewed unslothai#16471 spacing dependency is already merged. The remaining changes are confined to tests.

Drive the production startup sampler and health wait with a controlled clock and process counters. CPU time, resident memory and read-byte counters stay flat. Advancing faults keep the wait alive beyond its original deadline; fixed faults reach the original stall timeout. A separate parser check covers the platform counter fields and Linux stat parsing, including a process name containing a closing parenthesis.

The health-test fix changes no production startup code, stall budget or polling interval. The test does not sleep, skip the failing case or relax its negative assertion. Fake process IDs are outside the valid host PID range and all process access is controlled.

The final validation pass also corrects the installer progress fixture to model successful uv bootstrap. Forcing bootstrap failure could instead hit the valid torch-freeze guard before reaching the progress assertion on newer torch installations. All 16 progress checks now pass without changing installer behavior or weakening assertions. Current-main integration with this health change passes 896 checks, with two existing platform skips. That integration also verifies the upstream CI fixture fixes from unslothai#16530 through unslothai#16533.

The rewrite also removes the now-unused `os` import. The existing import-safety check correctly rejected the preceding head; the same command passes after this one-line cleanup. All 101 local health/font checks pass. Refreshed Linux, macOS and Windows staging explicitly includes that required import-safety gate. The raw logs confirm that the gate runs and passes on all three platforms.

The health-wait behavior and original test came from unslothai#11055, with later timing adjustments in unslothai#11284 and unslothai#12065. The complete health-wait test file passes 89 tests. This hardens the test contract without claiming a production mmap failure was reproduced or that every earlier CI timeout has the same cause.

Disabling production fault accounting makes the new positive case fail while the stalled case still passes. Three panel reviews and three independent focused reviews found no actionable defect. Platform counter formats are simulated on Linux; removing the worker means this case no longer covers actual native mmap page-ins. Other real-process startup tests remain.

The paired Studio switchboard completes auth, Settings and route crawling with functional `NO_REGRESSION`: 38 matching steps and one Hub visual difference. All 39 functional captures succeed on both arms. The Hub benchmark-popover comparison retains a visual/mask difference on confirmation, so exact visual parity for that capture is not claimed. The health-test change itself has no production UI effect. The included unslothai#16471 dependency changes Settings spacing and uses its existing before/after evidence below.

Current-head staging passes 117 Python checks (89 health, 12 font-contract and 16 installer progress checks), 42 Node spacing/control checks and the required import-safety gate on each of [Linux](https://github.com/Imagineer99/unsloth/actions/runs/41645022400), [Apple Silicon macOS](https://github.com/Imagineer99/unsloth/actions/runs/41645022445) and [Windows](https://github.com/Imagineer99/unsloth/actions/runs/41645022404), with zero failures or skips. Raw logs and exact source-head ancestry were checked. The current-head switchboard reports functional `NO_REGRESSION` across auth, all 19 Settings steps, model picker and route crawling. The retained Hub/data-recipes comparisons include DOM/mask differences with zero changed pixels; exact visual parity is not claimed for those captures.

The current head also carries unslothai#16471's rich-paste badge correction for the font-contract CI regression introduced by unslothai#16298. Both Settings components are byte-identical to the parent. Local validation passes 101 Python checks and 42 Node checks. Refreshed platform checks include the font contract as well as the unchanged health-policy checks.

The shared spacing dependency below is the exact unslothai#16471 change; this comparison validates that dependency.

![Shared Settings spacing dependency before and after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16471/pr16471_before_after-a78db41ffd5e.png)

The inherited rich-paste badge correction is also byte-identical to unslothai#16471. At the enlarged font setting it scales from the previous fixed 10 px to 15 px, with the feature and switch retained:

![Shared rich-paste font-scaling dependency before and after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16471/pr16471_before_after-3e473cadeed6.png)
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