Make Dependabot pip PRs produce coherent hash-pinned lockfiles#14
Merged
Merged
Conversation
- Drop the `lockfile` drift-check job in tests.yml. It only enforced the .in → .txt relationship and produced brittle failures whenever uv version or PyPI state differed between local and CI. - Add `ignore:` rules in dependabot.yml mirroring requirements.in's upper bounds. Dependabot no longer proposes capped majors, so the weekly pip PR stream shrinks to patch/minor only. Folium is intentionally uncapped (0.x for a decade; eventual 1.0 expected non-breaking). - Add dependabot-lockfile.yml: a pull_request_target workflow that fires on Dependabot pip PRs and regenerates requirements.txt with `uv pip compile --universal --generate-hashes` so the hash set stays coherent across transitives. Dependabot's own pip ecosystem bumps a direct dep's pin without re-pinning/re-hashing transitives, which breaks `pip install --require-hashes` (observed on PR #12). The workflow also re-dispatches validation CI against the updated branch since pushes via GITHUB_TOKEN don't trigger workflows by default. - README: document the new flow — caps in two places, auto-regen workflow handles hash coherence.
Pass PR-controlled values (head ref, PR number, repo) through env vars instead of interpolating them directly into inline shell commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Context: after #7 merged, Dependabot opened 6 pip PRs within 5 minutes. The GitHub Actions ones (#8, #9, #10) were clean. The pip ones (#11 ipykernel 7.2, #12 awscli 1.44.84, #13 pandas 3.0.2) were all red. Two failure modes, both inherent to Dependabot's pip ecosystem:
#11and#13cross caps inrequirements.in(ipykernel<7.0,pandas<3.0). Dependabot readsrequirements.txtdirectly and doesn't honor.inranges, so thelockfiledrift-check job fires every time.==pins but leaves other transitives unversioned / un-hashed.pip install --require-hashesrejects the file. That's what killed deps(deps): bump awscli from 1.44.81 to 1.44.84 in the aws group across 1 directory #12 even though its version is range-compatible.Neither is fixable by tweaking
requirements.in. This PR addresses both.Changes
lockfiledrift-check job intests.yml. It was brittle against uv version skew and didn't pull its weight once caps live independabot.yml.ignore:rules independabot.ymlmirroringrequirements.in's upper bounds. Dependabot no longer proposes capped majors, so the weekly pip PR stream shrinks to patch/minor only. Folium is intentionally uncapped (0.x for a decade; eventual 1.0 expected non-breaking per upstream's changelog cadence)..github/workflows/dependabot-lockfile.yml— apull_request_targetworkflow that fires on Dependabot pip PRs, regeneratesrequirements.txtwithuv pip compile --universal --generate-hashes, pushes the coherent lockfile back onto the PR branch, and re-dispatches validation CI. Runs only for thedependabot[bot]actor.Why
pull_request_targetpull_requestfrom Dependabot runs with a read-only token and can't push back.pull_request_targetruns with the base branch's perms and can, but is scoped only to this workflow and gated ongithub.actor == 'dependabot[bot]', so no attacker-controlled code executes with elevated perms. Pushes made viaGITHUB_TOKENdon't re-trigger workflows automatically, so the workflow also re-dispatchestests.yml,notebook-ci.yml,notebook-hygiene.yml, anddeps-audit.ymlagainst the updated branch.Test plan
ruff check .— cleancodespell— cleanpytest tests/ -q— 13/13 passpython3 .github/scripts/notebook_hygiene.py— 6/6 notebooks passactionlinton the new workflow — clean@dependabot rebase) and confirm the new workflow regeneratesrequirements.txtand the PR goes green🤖 Generated with Claude Code