Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Give every installing job its own pip cache key (#9781)
Daniel Han2640fad25571
diff --git a/.github/actions/pip-cache-restore/action.yml b/.github/actions/pip-cache-restore/action.ymlindex 33f18260b59..e6ed64d1c63 100644--- a/.github/actions/pip-cache-restore/action.yml+++ b/.github/actions/pip-cache-restore/action.yml@@ -30,6 +30,26 @@ description: >-runs on the default branch only.inputs:+ name:+ description: >-+ Short, stable identifier for the INSTALLING JOB (`consolidated`,+ `notebooks-colab`, ...). Two things depend on it.++ Jobs that install different things must not share a key. Five jobs here+ passed the same key-files and so resolved to the same key; the save is+ gated on `cache-hit != 'true'`, so whichever finished first on main wrote+ the cache and the other four restored it exactly, installed their own+ extra wheels, and never saved them. Those extras were re-downloaded on+ every run of main, forever, and nothing about it was visible.++ It also makes each family its own key prefix. Without that, generations of+ five different jobs sit under `pip-<os>-<arch>-py<ver>-` and cannot be told+ apart from five generations of one, so cache-janitor.yml cannot prune any+ of them. 14 GiB of unreachable pip entries had accumulated by 2026-08-26+ for exactly that reason.++ Lowercase, digits and dashes; it goes into the cache key verbatim.+ required: truekey-files:description: >-Newline-separated glob(s) whose hash keys the cache. Pass the files this@@ -47,6 +67,9 @@ outputs:key:description: The full cache key, to hand to pip-cache-save.value: ${{ steps.probe.outputs.key }}+ prefix:+ description: The cache key without the dependency hash, i.e. the restore-key.+ value: ${{ steps.probe.outputs.prefix }}cache-hit:description: 'true when the exact key was restored.'value: ${{ steps.restore.outputs.cache-hit }}@@ -84,7 +107,28 @@ runs:echo "::error::pip-cache: key-files matched no file, so the cache key would not distinguish anything. Given: ${{ inputs.key-files }}"exit 1fi- echo "key=pip-${{ runner.os }}-${{ runner.arch }}-py${pyver}-${hash}" >> "$GITHUB_OUTPUT"+ name="${{ inputs.name }}"+ # An empty or surprising segment collapses distinct jobs onto one key, or+ # breaks the janitor's prefix grouping. Both fail silently, so check here.+ case "$name" in+ ''|*[!a-z0-9-]*)+ echo "::error::pip-cache: name must be lowercase letters, digits and dashes. Given: '$name'"+ exit 1 ;;+ esac++ # `v2` is a real load-bearing segment, not decoration. Keys minted before+ # `name` existed look like `pip-Linux-X64-py3.12-<hash>`, and `Linux` is a+ # valid name, so nothing distinguishes an old key from a new one whose job+ # happens to be called `linux`. The janitor matches `pip-v2-` only, which+ # leaves every legacy entry untouched to expire on its own 7-day idle+ # timer rather than being ranked against keys it has nothing to do with.+ #+ # Emitted separately so the restore-key fallback and the janitor's+ # grouping are built from the same string as the key, not a copy that+ # can drift.+ prefix="pip-v2-${name}-${{ runner.os }}-${{ runner.arch }}-py${pyver}-"+ echo "prefix=$prefix" >> "$GITHUB_OUTPUT"+ echo "key=${prefix}${hash}" >> "$GITHUB_OUTPUT"- name: Restore the pip cacheid: restore@@ -94,3 +138,15 @@ runs:with:path: ${{ steps.probe.outputs.dir }}key: ${{ steps.probe.outputs.key }}+ # WITH a prefix fallback, unlike the frontend-dist cache. A dist cache is+ # a build output: the wrong generation is wrong, so only an exact key will+ # do. This is pip's HTTP cache, addressed by URL and content hash, where+ # the previous generation is the current one minus whatever moved. A+ # dependency bump then costs the changed wheels instead of all of them,+ # and a stale entry cannot serve wrong content -- the worst it can do is+ # miss. Same argument that lets the key carry 3.12 rather than 3.12.14.+ #+ # `name` is inside the prefix, so the fallback stays inside this job's own+ # family and never hands one job the wheels another downloaded.+ restore-keys: |+ ${{ steps.probe.outputs.prefix }}diff --git a/.github/workflows/cache-janitor.yml b/.github/workflows/cache-janitor.ymlindex a744a637a61..0d4dcec87c5 100644--- a/.github/workflows/cache-janitor.yml+++ b/.github/workflows/cache-janitor.yml@@ -3,27 +3,62 @@name: Cache janitor-# Keeps Actions cache usage clear of the 50 GB ceiling. At the ceiling GitHub-# evicts by LRU regardless of reachability, and a partially evicted cache still-# restores, then misses on the evicted objects: the hit rate collapses with-# nothing failing.+# Keeps Actions cache usage clear of the 50 GiB ceiling. At the ceiling GitHub+# deletes whole entries by last-access date, regardless of reachability, so the+# live entry of a family can go between the run that wrote it and the run that+# needs it. The documented result is cache thrashing: entries created and deleted+# at a high frequency, the hit rate collapsing with nothing failing.#-# Deletes only families that resolve via restore-keys, where GitHub returns the-# most recent prefix match so older generations serve no routine build:-# codeql-overlay-base-database-* keys embed commit SHA + run id-# v0-rust-* Swatinem/rust-cache+# The ceiling is per-repository and admin-set. 50 GiB is this repo's; the zoo's+# is 20 GiB, where the same constant copied across was wrong for a week and the+# warning could never fire. If someone raises it, this number and the threshold+# at the bottom are the two places to change.+#+# Four families are pruned.+#+# 1. Caches on refs/pull/N/* whose PR is closed or merged. Lookup is scoped+# by ref and nothing but that PR's own runs can restore its merge ref, so+# once the PR is not open the entry is unreachable for good, and GitHub+# does not collect it on merge. Almost everything here already saves on+# main only, so this is a backstop rather than the main event. The PR state+# decides, not age: an open PR's caches are live no matter how old, and a+# lookup that errors keeps the cache.+#+# 2. Superseded generations of families whose keys embed a build identity:+# codeql-overlay-base-database-* keys embed commit SHA + run id+# v0-rust-* Swatinem/rust-cache+#+# 3. Superseded generations of pip-v2-*, the pip HTTP caches written by+# .github/actions/pip-cache-save. `name` is inside the prefix as of the+# commit that added it, so each installing job is its own family and its+# generations rank against each other and nothing else. Before that every+# job sat under `pip-<os>-<arch>-py<ver>-`, five of them sharing one key,+# and no prefix could tell five live caches from five generations of one --+# so this family could not be pruned at all, and 57 entries were still+# resident on 2026-08-26 having last been read a day or more earlier.+#+# Legacy `pip-<os>-...` keys are deliberately NOT matched. `Linux` is a+# valid name, so an old key is indistinguishable from a new one whose job+# is called `linux`; they are left to expire on their own 7-day timer+# rather than be ranked against keys they have nothing to do with.+#+# 4. Superseded generations of uv-* (the uv download cache) and fe-dist-* (the+# built frontend). One key formula each across all their call sites, so the+# prefix is unambiguous without a name. fe-dist takes no restore-keys by+# design, so an older generation answers only an exact revert of the+# frontend sources; 59 entries in 3 families had accumulated there.## "Older" is not the same as unreachable. rust-cache passes its full key to# restoreCache, which tries an exact match first, so a build returning to an# earlier dependency state (a re-run of an old commit, a lockfile revert) can-# still hit an older generation exactly. Pruning trades those rare exact hits-# for headroom, which is the point; keep is the dial.+# still hit an older generation exactly. The pip and uv caches are the same+# shape. keep is the dial, and it is set for hit rate, not for headroom: the budget exists to be+# spent, so a generation that can still answer something stays. What goes is what+# can answer nothing -- unreachable refs, and generations past keep.## Everything else is left alone. The hf-* / *-gguf-* model caches use exact keys,# so an entry that looks superseded is the only one its key will ever match and-# deleting it costs a multi-GB re-download. setup-python does resolve by-# restore-keys, but its hash is over the dependency file: one generation is live-# at a time, and a superseded one expires by itself after 7 days unused.+# deleting it costs a multi-GB re-download.on:schedule:@@ -36,7 +71,7 @@ on:options: [report, delete]default: reportkeep:- description: 'Generations kept per prefix. 2 so an in-flight run cannot lose the cache it just resolved.'+ description: 'Generations kept per prefix. 2 so an in-flight run cannot lose the cache it just resolved, and so a reverted dependency bump still hits.'type: stringdefault: '2'@@ -55,6 +90,7 @@ jobs:timeout-minutes: 20permissions:actions: write+ pull-requests: readsteps:- name: Prunecontinue-on-error: true # housekeeping must never page anyone@@ -68,6 +104,7 @@ jobs:set -euo pipefailrepo="$GITHUB_REPOSITORY"all="$RUNNER_TEMP/caches.tsv"+ live="$RUNNER_TEMP/live.tsv"grouped="$RUNNER_TEMP/grouped.tsv"# Whitelist 1..99. Anything `[ n -le KEEP ]` cannot compare exits 2,@@ -77,6 +114,8 @@ jobs:# range fails the same way.case "$KEEP" in [1-9]|[1-9][0-9]) ;; *) echo "::warning::invalid keep=$KEEP, using 2"; KEEP=2 ;; esac+ gib() { awk -v b="${1:-0}" 'BEGIN { printf "%.1f", b / 1073741824 }'; }+# Report a failed inventory. Deleting nothing is the safe direction,# but silence means a broken janitor looks identical to a clean repo# and nothing notices until the ceiling does.@@ -89,8 +128,51 @@ jobs:total=$(awk -F'\t' '{s+=$3} END {printf "%d", s+0}' "$all")count=$(grep -c . "$all" || true)- echo "$count caches, $(( total / 1073741824 )) GiB, delete=$DELETE keep=$KEEP"+ echo "$count caches, $(gib "$total") GiB, delete=$DELETE keep=$KEEP"++ freed=0; deleted=0; stale_pr=0+ # Pass 1: caches belonging to a PR that is no longer open. Unreachable+ # regardless of generation, so this runs before ranking and removes+ # them from it -- otherwise a merged PR's entries occupy the keep slots+ # of their own (ref, version, prefix) group and shield each other.+ declare -A prstate=()+ : > "$live"+ while IFS=$'\t' read -r id created size ref ver key; do+ [ -z "${id:-}" ] && continue+ num=""+ case "$ref" in+ refs/pull/*/merge|refs/pull/*/head)+ num="${ref#refs/pull/}"; num="${num%/*}" ;;+ esac+ if [ -n "$num" ]; then+ case "$num" in+ ''|*[!0-9]*) num="" ;; # not a PR number; fall through to ranking+ esac+ fi+ if [ -n "$num" ]; then+ if [ -z "${prstate[$num]:-}" ]; then+ # An error must not read as "closed". Default to open so a rate+ # limit or a transient 5xx keeps the cache instead of freeing it.+ prstate[$num]=$(gh api "repos/$repo/pulls/$num" -q '.state' < /dev/null 2>/dev/null || echo open)+ [ -n "${prstate[$num]}" ] || prstate[$num]=open+ fi+ if [ "${prstate[$num]}" != "open" ]; then+ echo "stale PR #$num ($(gib "$size") GiB): $key"+ stale_pr=$(( stale_pr + 1 ))+ if [ "$DELETE" != "yes" ]; then+ freed=$(( freed + size )); deleted=$(( deleted + 1 )); continue+ fi+ if gh api -X DELETE "repos/$repo/actions/caches/$id" --silent < /dev/null 2>/dev/null; then+ freed=$(( freed + size )); deleted=$(( deleted + 1 ))+ fi+ continue+ fi+ fi+ printf '%s\t%s\t%s\t%s\t%s\t%s\n' "$id" "$created" "$size" "$ref" "$ver" "$key" >> "$live"+ done < "$all"++ # Pass 2: rank the survivors by generation within each family.: > "$grouped"while IFS=$'\t' read -r id created size ref ver key; do[ -z "${id:-}" ] && continue@@ -99,6 +181,13 @@ jobs:pre=$(printf '%s' "$key" | sed -E 's/-[0-9a-f]{40}-[0-9]+-[0-9]+$//') ;;v0-rust-*)pre=$(printf '%s' "$key" | sed -E 's/-[0-9a-f]{8,}$//') ;;+ pip-v2-*|uv-*|fe-dist-*)+ # Strip only the trailing dependency hash. Everything before it --+ # the job name for pip-v2, the OS for uv and fe-dist -- stays in the+ # prefix on purpose: those are separate keys that never substitute+ # for one another, and folding them into one group would rank live+ # caches as generations of each other and delete all but two.+ pre=$(printf '%s' "$key" | sed -E 's/-[0-9a-f]{64}$//') ;;*) continue ;;esac# Unshortened means the suffix did not match, which would make@@ -110,15 +199,16 @@ jobs:# independently. Ranking them together lets two entries from one# scope evict every usable entry of another.printf '%s\t%s\t%s\t%s\n' "$ref|$ver|$pre" "$created" "$id" "$size" >> "$grouped"- done < "$all"+ done < "$live"sort -t"$(printf '\t')" -k1,1 -k2,2r -o "$grouped" "$grouped"- prev=""; n=0; freed=0; deleted=0+ prev=""; n=0; superseded=0while IFS=$'\t' read -r pre created id size; do[ -z "${pre:-}" ] && continueif [ "$pre" != "$prev" ]; then prev="$pre"; n=1; else n=$(( n + 1 )); fi[ "$n" -le "$KEEP" ] && continue+ superseded=$(( superseded + 1 ))if [ "$DELETE" != "yes" ]; thenfreed=$(( freed + size )); deleted=$(( deleted + 1 )); continuefi@@ -130,7 +220,7 @@ jobs:after=$(( total - freed ))verb="pruned"; [ "$DELETE" = "yes" ] || verb="would prune"- echo "$verb $deleted caches, $(( freed / 1073741824 )) GiB"+ echo "$verb $deleted caches, $(gib "$freed") GiB"{echo "### Cache janitor"echo ""@@ -139,12 +229,16 @@ jobs:echo "| mode | $([ "$DELETE" = yes ] && echo delete || echo 'report only') |"echo "| kept per prefix | $KEEP |"echo "| caches total | $count |"+ echo "| closed-PR candidates | $stale_pr |"+ echo "| superseded candidates | $superseded |"echo "| candidates $verb | $deleted |"- echo "| freed | $(( freed / 1073741824 )) GiB |"- echo "| usage before | $(( total / 1073741824 )) GiB of 50 GB |"- echo "| usage after | $(( after / 1073741824 )) GiB of 50 GB |"+ echo "| freed | $(gib "$freed") GiB |"+ echo "| usage before | $(gib "$total") GiB of 50 GiB |"+ echo "| usage after | $(gib "$after") GiB of 50 GiB |"} >> "$GITHUB_STEP_SUMMARY"+ # 80% of the 50 GiB ceiling. Above this a single dependency bump can+ # push the repo over between two scheduled sweeps.if [ "$after" -gt 42949672960 ]; then- echo "::warning::Cache usage is $(( after / 1073741824 )) GiB of 50 GB after pruning. Lower keep to 1, or find the family that grew."+ echo "::warning::Cache usage is $(gib "$after") GiB of 50 GiB after pruning. Lower keep to 1, or find the family that grew."fidiff --git a/.github/workflows/consolidated-tests-ci.yml b/.github/workflows/consolidated-tests-ci.ymlindex 0c3a4b190c6..301efb4bb1e 100644--- a/.github/workflows/consolidated-tests-ci.yml+++ b/.github/workflows/consolidated-tests-ci.yml@@ -145,6 +145,7 @@ jobs:id: pip-cacheuses: ./.github/actions/pip-cache-restorewith:+ name: consolidatedkey-files: |pyproject.tomlstudio/backend/requirements/*.txt@@ -2366,6 +2367,7 @@ jobs:id: pip-cacheuses: ./.github/actions/pip-cache-restorewith:+ name: llama-cpp-smokekey-files: |pyproject.tomlstudio/backend/requirements/*.txtdiff --git a/.github/workflows/mlx-ci.yml b/.github/workflows/mlx-ci.ymlindex 34c9067ec0d..896e8c947bc 100644--- a/.github/workflows/mlx-ci.yml+++ b/.github/workflows/mlx-ci.yml@@ -192,6 +192,7 @@ jobs:id: pip-cacheuses: ./.github/actions/pip-cache-restorewith:+ name: mlxkey-files: |pyproject.tomlstudio/backend/requirements/*.txtdiff --git a/.github/workflows/notebooks-ci.yml b/.github/workflows/notebooks-ci.ymlindex 0303089a477..3d30aff807a 100644--- a/.github/workflows/notebooks-ci.yml+++ b/.github/workflows/notebooks-ci.yml@@ -293,6 +293,7 @@ jobs:# exist and the step fails with "Can't find 'action.yml'".uses: ./unsloth/.github/actions/pip-cache-restorewith:+ name: notebooks-apikey-files: |unsloth/.github/workflows/notebooks-ci.yml@@ -428,6 +429,7 @@ jobs:# exist and the step fails with "Can't find 'action.yml'".uses: ./unsloth/.github/actions/pip-cache-restorewith:+ name: notebooks-colab# The freeze is the pin set, so it is what the downloads depend on. The# workflow comes too because the seed step rewrites those pins in place# -- CPU index mapping, skips, spoofs -- so an edit there changes whatdiff --git a/.github/workflows/studio-backend-ci.yml b/.github/workflows/studio-backend-ci.ymlindex 38872bf5f92..07911417ed5 100644--- a/.github/workflows/studio-backend-ci.yml+++ b/.github/workflows/studio-backend-ci.yml@@ -158,6 +158,7 @@ jobs:id: pip-cacheuses: ./.github/actions/pip-cache-restorewith:+ name: studio-backendkey-files: |pyproject.tomlstudio/backend/requirements/*.txt@@ -360,6 +361,7 @@ jobs:id: pip-cacheuses: ./.github/actions/pip-cache-restorewith:+ name: repo-cpu-testskey-files: |pyproject.tomlstudio/backend/requirements/*.txtdiff --git a/.github/workflows/studio-export-capability-ci.yml b/.github/workflows/studio-export-capability-ci.ymlindex d6863f264b9..395b501ff59 100644--- a/.github/workflows/studio-export-capability-ci.yml+++ b/.github/workflows/studio-export-capability-ci.yml@@ -84,6 +84,7 @@ jobs:id: pip-cacheuses: ./.github/actions/pip-cache-restorewith:+ name: studio-exportkey-files: |.github/workflows/studio-export-capability-ci.ymldiff --git a/.github/workflows/version-compat-ci.yml b/.github/workflows/version-compat-ci.ymlindex 40682198899..7bb66504e79 100644--- a/.github/workflows/version-compat-ci.yml+++ b/.github/workflows/version-compat-ci.yml@@ -168,6 +168,7 @@ jobs:# exist and the step fails with "Can't find 'action.yml'".uses: ./unsloth/.github/actions/pip-cache-restorewith:+ name: version-compat-spoofkey-files: |unsloth/.github/workflows/version-compat-ci.yml@@ -276,6 +277,7 @@ jobs:# exist and the step fails with "Can't find 'action.yml'".uses: ./unsloth/.github/actions/pip-cache-restorewith:+ name: version-compat-grpokey-files: |unsloth/.github/workflows/version-compat-ci.ymldiff --git a/tests/studio/test_pip_cache_naming.py b/tests/studio/test_pip_cache_naming.pynew file mode 100644index 00000000000..a4c1d2bcaa2--- /dev/null+++ b/tests/studio/test_pip_cache_naming.py@@ -0,0 +1,133 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++"""Every installing job must own its pip cache key, and no two may share one.++Five jobs did share one, and neither consequence showed up as red.++pip-cache-save is gated on `cache-hit != 'true'`, so whichever job finished+first on main wrote the cache and the other four restored it EXACTLY, installed+their own extra wheels, and never saved them -- re-downloading those on every+run of main, forever.++And a shared prefix cannot be ranked. cache-janitor.yml prunes by generation+within a prefix, and five live jobs under `pip-<os>-<arch>-py<ver>-` are+indistinguishable from five generations of one, so the family could not be+pruned at all: 57 stale entries on 2026-08-26, against 41.4 of 50 GiB.++`name` fixes both, and only stays fixed if nothing silently reuses one.+"""++import re+import pathlib++import pytest+import yaml+++REPO = pathlib.Path(__file__).resolve().parents[2]+WORKFLOWS = sorted((REPO / ".github" / "workflows").glob("*.yml"))+RESTORE_SUFFIX = "actions/pip-cache-restore"+SAVE_SUFFIX = "actions/pip-cache-save"+++def _jobs(path):+ doc = yaml.safe_load(path.read_text()) or {}+ for name, job in (doc.get("jobs") or {}).items():+ yield name, (job.get("steps") or [])+++def _restores(steps):+ # Suffix match: jobs checking out into a subdirectory say ./unsloth/.github/...+ return [s for s in steps if str(s.get("uses", "")).endswith(RESTORE_SUFFIX)]+++def test_call_sites_exist():+ # A suffix that matches nothing would make every assertion below vacuous.+ found = sum(len(_restores(steps)) for p in WORKFLOWS for _, steps in _jobs(p))+ assert found >= 10, f"only {found} pip-cache-restore call sites found; this test is stale"++[email protected]("path", WORKFLOWS, ids = lambda p: p.name)+def test_no_builtin_setup_python_pip_cache(path):+ for job, steps in _jobs(path):+ for step in steps:+ if not str(step.get("uses", "")).startswith("actions/setup-python@"):+ continue+ assert "cache" not in (step.get("with") or {}), (+ f"{path.name}:{job} uses setup-python's built-in cache, which saves on "+ f"whatever ref the job ran on. Use the pip-cache-restore / -save pair."+ )++[email protected]("path", WORKFLOWS, ids = lambda p: p.name)+def test_every_restore_names_itself(path):+ for job, steps in _jobs(path):+ for step in _restores(steps):+ name = (step.get("with") or {}).get("name", "")+ assert re.fullmatch(r"[a-z0-9-]+", name or ""), (+ f"{path.name}:{job} restore name={name!r} must be lowercase letters, "+ f"digits and dashes; it goes into the cache key verbatim."+ )+ files = [f for f in ((step.get("with") or {}).get("key-files") or "").split() if f]+ assert files, f"{path.name}:{job} passes no key-files"+++def test_no_two_jobs_share_a_cache_name():+ seen = {}+ for path in WORKFLOWS:+ for job, steps in _jobs(path):+ for step in _restores(steps):+ name = (step.get("with") or {}).get("name") or ""+ where = f"{path.name}:{job}"+ assert name not in seen, (+ f"cache name {name!r} is used by both {seen[name]} and {where}. "+ f"A shared name is a shared key: only the first job to finish on "+ f"main saves, the rest silently re-download their extras every run."+ )+ seen[name] = where+++def test_jobs_sharing_key_files_still_have_distinct_names():+ # Jobs given the same key-files are the likeliest to be given the same name,+ # which is the exact case that produced the original defect.+ by_files = {}+ for path in WORKFLOWS:+ for job, steps in _jobs(path):+ for step in _restores(steps):+ with_ = step.get("with") or {}+ files = " ".join((with_.get("key-files") or "").split())+ by_files.setdefault(files, []).append((f"{path.name}:{job}", with_.get("name")))+ for files, entries in by_files.items():+ names = [n for _, n in entries]+ assert len(names) == len(set(names)), (+ f"{len(entries)} jobs share key-files {files!r} and reuse a name among "+ f"{names}; each needs its own so each can save its own wheels"+ )+++def test_key_is_versioned_and_carries_the_name():+ action = (REPO / ".github/actions/pip-cache-restore/action.yml").read_text()+ assert 'prefix="pip-v2-${name}-' in action, (+ "the key must stay pip-v2-<name>-... . The v2 segment is what lets "+ "cache-janitor.yml match only post-rename keys: 'Linux' is a valid name, so "+ "a legacy pip-<os>-... key is otherwise indistinguishable from a new one."+ )+++def test_janitor_matches_v2_keys_only():+ janitor = (REPO / ".github/workflows/cache-janitor.yml").read_text()+ assert (+ "pip-v2-*|uv-*|fe-dist-*)" in janitor+ ), "janitor no longer ranks the pip/uv/fe-dist families"+ assert "\n pip-*)" not in janitor, (+ "the janitor must not match bare pip-* : legacy keys from before `name` "+ "existed would then be ranked against unrelated jobs' keys and deleted."+ )+++def test_save_runs_on_the_default_branch_only():+ action = yaml.safe_load((REPO / ".github/actions/pip-cache-save/action.yml").read_text())+ condition = " ".join(str(action["runs"]["steps"][0].get("if", "")).split())+ assert "github.ref == 'refs/heads/main'" in condition+ assert "always()" in condition