@@ -316,7 +316,16 @@ jobs:
316316 - uses : actions/checkout@v4
317317 - name : Install lua
318318 run : sudo apt-get install -y --no-install-recommends lua5.4
319- - name : Check CN mirror assets are reachable
319+ # REACHABLE IS NOT ENOUGH, and the gap is not hypothetical: a mirror
320+ # asset whose CONTENT is stale answers 200 all day. It happens whenever a
321+ # fork tag is re-cut at the same upstream version — gitcode cannot
322+ # overwrite a same-named asset (and DELETE on a release returns 405), so
323+ # the old tarball stays up while GLOBAL moves on, and CN users silently
324+ # get the previous build. Measured twice on mcpplibs/libglvnd v1.7.0.
325+ #
326+ # tests/list_cn_urls.lua already emits `url<TAB>sha256`; this now uses
327+ # the second column instead of throwing it away.
328+ - name : Check CN mirror assets are reachable AND match the descriptor
320329 env :
321330 PKGS : ${{ needs.select.outputs.pkgs }}
322331 run : |
@@ -338,16 +347,27 @@ jobs:
338347 echo "checking $total CN mirror url(s)"
339348 while IFS=$'\t' read -r url sha; do
340349 [ -z "$url" ] && continue
341- # follow redirects; gitcode release assets resolve to object storage
342- code=$(curl -fsSL -o /dev/null -w '%{http_code}' --retry 2 --max-time 60 "$url" || echo "000")
343- if [ "$code" != "200" ]; then
344- echo "::error::CN mirror unreachable ($code): $url"
350+ # follow redirects; gitcode release assets resolve to object storage.
351+ # The body is downloaded either way — a gitcode release page can 200
352+ # while the asset behind it is gone — so hashing it costs nothing
353+ # extra and answers the second question too.
354+ got=$(curl -fsSL --retry 2 --max-time 120 "$url" 2>/dev/null | sha256sum | cut -d' ' -f1)
355+ if [ -z "$got" ] || [ "$got" = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ]; then
356+ # empty stream hashes to that constant; treat it as unreachable
357+ echo "::error::CN mirror unreachable or empty: $url"
358+ fail=1
359+ elif [ -n "$sha" ] && [ "$got" != "$sha" ]; then
360+ echo "::error::CN mirror CONTENT differs from the descriptor: $url"
361+ echo " descriptor: $sha"
362+ echo " mirror: $got"
363+ echo " gitcode cannot overwrite a same-named asset; delete the"
364+ echo " release asset and re-publish it with gtc."
345365 fail=1
346366 else
347367 echo "ok: $url"
348368 fi
349369 done < /tmp/cn.tsv
350- [ $fail -eq 0 ] && echo "All CN mirror urls reachable."
370+ [ $fail -eq 0 ] && echo "All CN mirror urls reachable and matching ."
351371 exit $fail
352372
353373 # ── The whole test surface, as a mcpp workspace ───────────────────────
0 commit comments