From c7713cac65a8f537ef09eeffc81332c0fc51068a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?AI=E4=B8=8D=E6=AD=A2=E8=AF=AD?= <12096460+jnMetaCode@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:37:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(verify-release):=20429=20=E8=A2=AB=E5=88=A4?= =?UTF-8?q?=E6=88=90=E6=AD=BB=E9=93=BE=20=E2=80=94=E2=80=94=20=E5=A4=96?= =?UTF-8?q?=E9=93=BE=E9=97=A8=E7=A6=81=E5=BC=80=E5=A7=8B=E8=AF=AF=E6=8A=A5?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 发版前跑 verify-release,H 段报 `死链(429): https://windsurf.com`。手工用浏览器 UA 复核了几次,稳定 429 —— 站点活着,只是对反复验活限流。 判活口径写的是 `2*|3*|403`,把「服务器答复了但不是 200/403」一律当死。而 429 恰恰 证明 URL 存在:能限流就是能路由到资源。 这条门禁自己的立项理由是「一个会误报的门禁比没有门禁更糟:人会学会忽略它」。 它现在正在做那件事:唯一的 FAIL 每次都是同一条误报,跑几次就会开始忽略整段输出。 判活口径改为 `2*|3*|401|403|405|429` —— 都属于「答复了,只是不欢迎自动化访问」: | 码 | 含义 | 为什么不是死 | |---|---|---| | 401 | 要登录 | 资源存在,只是要凭证 | | 403 | 拒爬虫 | 原本就在白名单里 | | 405 | 不认这个请求方式 | 服务器识别了这个路径 | | 429 | 限流 | 能限流就是能路由到资源 | 真正的死仍然只有两种:404/410,以及连不上(curl 返回空)。 双向验证: - 往 docs/README.aider.md 塞一条 github.com/anthropics/this-repo-does-not-exist-xyz, 门禁照报 `死链(404)`,FAIL 1 —— 没被这次放宽削弱 - 还原后 115 pass / 0 fail --- scripts/verify-release.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/verify-release.sh b/scripts/verify-release.sh index 783b98d..047cad5 100755 --- a/scripts/verify-release.sh +++ b/scripts/verify-release.sh @@ -262,7 +262,7 @@ if curl -sS -o /dev/null --max-time 5 https://github.com 2>/dev/null; then grep -rhoE "https://[a-zA-Z0-9./_-]+" "$REPO"/docs/*.md "$REPO"/README.md "$REPO"/README.zh-Hant.md 2>/dev/null \ | grep -viE "jnmetacode|aiolaola|user-images|shields\.io|opensource\.org|makeapullrequest|npmjs\.com|compshare|cubence|claude\.ai/code" \ | sed 's/[.,)]*$//' | sort -u \ - | xargs -P 10 -I{} sh -c 'c=$(curl -sS -o /dev/null -w "%{http_code}" -L --max-time 8 "$1" 2>/dev/null); case "$c" in 2*|3*|403) ;; *) echo "$1" ;; esac' _ {} \ + | xargs -P 10 -I{} sh -c 'c=$(curl -sS -o /dev/null -w "%{http_code}" -L --max-time 8 "$1" 2>/dev/null); case "$c" in 2*|3*|401|403|405|429) ;; *) echo "$1" ;; esac' _ {} \ > "$LINKTMP" 2>/dev/null # 第二遍:只对嫌疑名单串行复核,放宽超时并让 curl 自己重试。两遍都判死才算死。 suspects=$(wc -l < "$LINKTMP" | tr -d ' ') @@ -271,8 +271,14 @@ if curl -sS -o /dev/null --max-time 5 https://github.com 2>/dev/null; then while read -r u; do [ -z "$u" ] && continue c=$(curl -sS -o /dev/null -w "%{http_code}" -L --max-time 25 --retry 2 --retry-delay 1 "$u" 2>/dev/null) + # 判活口径 = 「服务器答复了」,而不是「答复是 200」: + # 401 要登录、403 拒爬虫、405 不认 HEAD/GET 的方式、429 限流 + # —— 这四种都证明 URL 存在,只是不欢迎自动化访问。 + # 429 是实测加的:windsurf.com 对反复验活稳定返回 429(浏览器 UA 也一样), + # 而链接本身是活的。判成死链就是误报,而误报的门禁会被学会忽略 —— 那还不如没有。 + # 真正的死只有两种:4xx 里的 404/410,以及连不上(curl 返回空)。 case "$c" in - 2*|3*|403) ;; + 2*|3*|401|403|405|429) ;; *) bad "死链(${c:-无响应}): ${u}"; dead=$((dead+1)) ;; esac done < "$LINKTMP"