From f3405d1d532fb126264ed1d97c2a2751eb91bf67 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 5 Aug 2026 05:57:04 +0000 Subject: [PATCH] [Fix] (CI): narrow the trace fixture Git LFS fallback to the files mirrors lost The fetch script tries git.hit.moe, then the repo.miawa.cn mirror, and only then Git LFS, but it bailed out of the mirror loop on the first file no mirror could serve and then pulled the whole case from GitHub. A case whose mirrors served every file but one paid GitHub's LFS bandwidth for all of them. Collect the files that survived every mirror and every retry instead, and scope the LFS fallback to just those, matching what the local macOS retrace helper already does. --- .github/scripts/fetch-trace-fixture-lfs.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/scripts/fetch-trace-fixture-lfs.sh b/.github/scripts/fetch-trace-fixture-lfs.sh index 5dbd9df9..ac0be72c 100644 --- a/.github/scripts/fetch-trace-fixture-lfs.sh +++ b/.github/scripts/fetch-trace-fixture-lfs.sh @@ -201,6 +201,11 @@ fetch_file_from_mirror() { return 1 } +# Files no mirror could serve, even after retrying every mirror. Only these fall +# back to Git LFS, so a mirror that served the rest of the case still spares +# GitHub the bandwidth for those files. +mirror_failures=() + fetch_from_mirror() { mkdir -p "${fixture_dir}" for file in "${files[@]}"; do @@ -219,17 +224,19 @@ fetch_from_mirror() { echo "Mirror did not serve ${name}; trying the next mirror" >&2 done if [ "${fetched}" -ne 1 ]; then - return 1 + mirror_failures+=("${file}") fi done + [ "${#mirror_failures[@]}" -eq 0 ] } if fetch_from_mirror; then echo "Fetched trace fixture files for ${case_name} from mirror: ${include}" else - echo "All mirrors failed for ${case_name}; falling back to Git LFS: ${include}" + fallback_include="$(IFS=,; echo "${mirror_failures[*]}")" + echo "All mirrors failed for ${#mirror_failures[@]} of ${#files[@]} file(s) of ${case_name}; falling back to Git LFS: ${fallback_include}" git lfs install --local - git lfs pull --include="${include}" --exclude="" + git lfs pull --include="${fallback_include}" --exclude="" fi for file in "${files[@]}"; do