Skip to content

Pin every package the dependency-floor leg installs - #784

Closed
amazloumi wants to merge 3 commits into
mainfrom
ci/pin-floor-job-packages
Closed

amazloumi wants to merge 3 commits into
mainfrom
ci/pin-floor-job-packages

Conversation

@amazloumi

@amazloumi amazloumi commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The unit-tests (dependency floors) job holds each declared dependency at its lower bound (--resolution lowest-direct), but it resolved the other 102 packages it installs again on every run, each to the newest release its requirements allow, so one outside release could fail the required unit-tests check. On main, 74 of those 102 are at their newest release today (a requirement holds the other 28 below theirs), and two floors runs of main four days apart installed different versions of nine of them (cryptography 50.0.2 and 51.0.1, fastapi, filelock, google-auth, idna, regex and three opentelemetry packages).
  • .github/dependency-floors-constraints.txt now pins all 121 packages the job installs, and the install passes it as --constraint in place of the inline rich<14.3.4. The rest of the job and the required checks do not change.
  • scripts/pin_dependency_floors.py writes that file with uv pip compile of the job's install (--resolution lowest-direct, Python 3.12, x86_64 manylinux_2_28). It prefers the versions the file already pins, then those in uv.lock, and gives a declared dependency no preference, since a preference outranks lowest-direct and would move it off its bound. It records a sha256 of its inputs: what it reads from pyproject.toml (requires-python, [project].dependencies, the video group, and [tool.uv], which holds torch's index, apart from default-groups), and the job's own requirements and target, which are constants of the script (JOB_REQUIREMENTS, PYTHON_VERSION, PYTHON_PLATFORM), not read from pyproject.toml. A unit test ties the job in ci.yml to the script: it reads only the floors job and requires its install's requirements and --group flags to equal the script's JOB_REQUIREMENTS and GROUPS, its --constraint to name the file, and the pins check to run before the install.
  • That pins check, pin_dependency_floors.py --check, is a new step after uv venv and before the install. It recomputes the hash with the standard library alone and, when an input changed since the file was written, fails with "Regenerate it with uv run python scripts/pin_dependency_floors.py". Without it, a raised floor would fail the install with a resolver error. tests/unit/test_pin_dependency_floors.py fails the same way in every unit leg, and checks that each declared dependency is pinned at its lower bound.
  • rich 14.3.3, held by the inline rich<14.3.4 before, now comes from the file at its uv.lock version. pytest stays at 9.0.2 through the job's own pytest>=9.0.2, a declared requirement that resolves to its bound, not through uv.lock; the file pins it there too. Of the 102 packages beyond the declared ones, 87 take their uv.lock version. 11 are held elsewhere by what the floors require: torch 2.12.0 pins triton, cuDNN, NCCL and cuda-toolkit exactly, and cuda-toolkit 13.0.2 pins nvJitLink; datasets 3.5.1 caps dill and multiprocess; mlflow-skinny 3.1.0 caps cachetools, importlib-metadata and packaging; and wandb 0.17.2 keeps protobuf below 6. tzdata takes no uv.lock version, since uv.lock holds it only for sys_platform == 'emscripten' or sys_platform == 'win32'. The last 3 (docker-pycreds, pytz, setproctitle) are needed only by the floors and are not in uv.lock.
  • Why a committed file: constraints taken from uv.lock when the job runs resolve only by moving five floors off their bounds (datasets 3.5.1 to 4.8.0, mlflow-skinny 3.1.0 to 3.13.0, pyarrow 15.0.0 to 21.0.0, torch 2.12.0 to 2.14.0, wandb 0.17.2 to 0.19.10), because the lock's versions follow the newest direct dependencies. A resolve-by-date cutoff (--exclude-newer) works with the PyTorch index, but it could not predate torchao 0.18.0, so rich would keep its hand pin; each move of the date would move every package at once; and the job would still re-resolve on every run under whatever uv setup-uv installs.
  • Not covered: every job, this one included, builds kempnerforge itself with the newest hatchling ([build-system] requires = ["hatchling"], which uv.lock does not lock), and --constraint does not reach that isolated build. Pinning it in this job alone would not keep the required checks green through a bad hatchling release, since lint and the uv.lock legs build the project the same way, so the hash leaves [build-system] out too. That gap is tracked in CI builds kempnerforge with whatever hatchling is newest, so one broken hatchling release can fail every required check #785.
  • Docs: CONTRIBUTING.md (the CI table, and under Dependencies when and how to regenerate the file and how to re-derive the pins from uv.lock where the floors allow it), docs/getting-started/install.md (Dependency floors) and codebase-map.json. The workflow's comment on the old hand pins is gone, and no new comment replaces it.

Testing

On CPU, with uv 0.13.8. The floor environments use CPython 3.12.16 and are built exactly as the job builds them; the uv.lock environments use CPython 3.12.11 and 3.14.10. 1cc2b59 is the first commit; 0056352 leaves default-groups out of the hash, which changes only the hash line of the pins file, so both install the same 122 versions. 5157baf ties the job to the script; it changes no input of the install, so it installs the same 122 versions too.

  • uv run ruff check . and uv run ruff format --check . pass (ruff 0.15.9), at 5157baf
  • uv run pyright kempnerforge/ (not run: no kempnerforge/ change)
  • uv run pytest tests/unit/ -v --timeout=60 at 1cc2b59, in the floor environment built exactly as the new job builds it: 6699 passed, 15 skipped, 1 failed. Main 3899909's floor install, built the same way in a second venv: 6668 passed, 15 skipped, 1 failed. The 31 extra passes are the cases of the new test file. The one failure is the same in both, test_pipeline_checkpoint_layouts.py::TestAcrossRanks::test_the_stages_continue_a_run_saved_without_pp[muon-pp3] hitting the 60 s limit, a known cluster-only timeout (test_streaming_resume.py's worker and multi-rank tests need more than the unit tier's 60 s on cluster CPU nodes #754). Alone with --timeout=600 it passes in both environments, in 43 s and 33 s.
  • The job's steps at 0056352, in a fresh venv: --check passes, the install takes the same 122 versions as at 1cc2b59, scripts/check_dependency_floors.py --group video passes (17 of 17 at their lower bounds), and tests/unit/test_pin_dependency_floors.py with tests/unit/test_check_dependency_floors.py passes there (63 passed), as it does in the uv.lock environments on Python 3.12 and 3.14.
  • The pins hold, at 1cc2b59 and 0056352: a second resolution of the new install command gives the same 121 versions as the file. With newer releases of six and certifi offered as local wheels (and of idna and typing-extensions at 1cc2b59), it still takes the pinned versions, while main's command takes the offered six 99.0.0 and certifi 2099.1.1.
  • The script, at 0056352: a second run writes a byte-identical file, and so does a run without the file (from uv.lock alone). --check exits 1 with the regenerate message after raising or lowering a floor, adding or removing a runtime dependency, raising the video floor, moving torch's index or raising requires-python, and exits 0 after an edit of the dev group, default-groups or [build-system]; a reorder of the dependencies also exits 0 (at 1cc2b59, and in a unit test).
  • At 5157baf: tests/unit/test_pin_dependency_floors.py passes (37 passed in each) in the uv.lock environments on Python 3.12 and 3.14 and in the floor environment, where it passes with tests/unit/test_check_dependency_floors.py too (67 passed). --check and the floor check pass there, and the pins file is byte-identical to 0056352's. Each of these edits now fails a test of that file, which passes again once the edit is undone: adding "pytest-xdist>=3.6.1", or an unquoted pytest-xdist, to the install; dropping its --group video or its --constraint; moving the pins check after the install; and dropping the job's requirements and target from the hash, with the file restamped.
  • CI at 5157baf: every check passes. The floors job ran uv 0.13.13: the pins check passes, the install resolves and installs 122 packages (the 121 pins and kempnerforge), and all 17 declared dependencies are at their lower bounds (6703 passed, 18 skipped). Its first run hit test_router_balance's FSDP2 test aborts a gloo rank with SIGABRT at shutdown in the dependency-floors unit job #751's gloo SIGABRT in test_loss.py (6702 passed, 1 failed), which End finished gloo test ranks without interpreter shutdown #770 fixes; the re-run passed.
  • If distributed code changed: uv run torchrun --nproc_per_node=4 -m pytest tests/distributed/ -v (not run: no distributed code changes)
  • If training loop / parallelism / optimizers changed: uv run pytest tests/e2e/ --e2e -v (not run: no such changes)

Closes #746

The leg held each declared dependency at its lower bound but took every
other package at its newest release, so a release anywhere could fail the
required unit-tests check. .github/dependency-floors-constraints.txt now
pins every package the leg installs. scripts/pin_dependency_floors.py writes
it with uv pip compile, preferring the pins the file already has and then
those in uv.lock, and records a hash of the pyproject.toml inputs, which the
leg checks before its install. The hand pins of pytest and rich are now
part of the file, at their uv.lock versions.
default-groups only chooses the groups of project commands such as uv sync,
and the floor job names its groups, so a change to it no longer asks for a
regeneration. The uv.lock preferences now come from every group, so they do
not depend on default-groups either. The hash still leaves out
[build-system]: the pins cover what the job installs, not the isolated build
of the project.
@amazloumi amazloumi added the dependencies Pull requests that update a dependency file label Dec 5, 2026
@codecov

codecov Bot commented Dec 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The test of the workflow now reads only the floor leg's job: its install's
requirements and --group flags must equal the script's JOB_REQUIREMENTS and
GROUPS, its --constraint must name the pins file, and the pins check must
run before the install. Before, it only looked for those strings anywhere in
ci.yml, so an added requirement, a dropped --group video or a check moved
after the install passed. The input hash test now also changes each of the
job's own inputs the hash covers: its requirements, Python version and
platform. The workflow comment above the pins check is gone, and the docs
no longer say that a run without the file moves every pin back to uv.lock.
@amazloumi

Copy link
Copy Markdown
Member Author

Closing in favor of #783, which holds the floor leg to a release cutoff and also closes #746.

@amazloumi amazloumi closed this Dec 5, 2026
@amazloumi amazloumi reopened this Dec 5, 2026
@amazloumi

Copy link
Copy Markdown
Member Author

Reopened: #783 now covers #492 and #336, and this PR keeps #746.

@amazloumi
amazloumi marked this pull request as ready for review December 6, 2026 00:29
@amazloumi

Copy link
Copy Markdown
Member Author

@Naeemkh #783 merged before its #746 part was dropped, so main now holds the floor leg to a release cutoff and #746 is closed. I'm closing this one in favor of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependency-floor CI leg: numpy, pyarrow and pandas have no floor, a floor set too low still passes, and unpinned packages can turn it red

1 participant