Skip to content

Commit 0396d5f

Browse files
committed
Address Copilot review: accept 307/308 redirects, add Herald fragment
Two fixes from Copilot's review: - HTTP probes now accept 307 and 308 alongside 200/301/302. Modern HTTP increasingly uses 307 (temporary, method-preserving) and 308 (permanent, method-preserving) instead of 302/301; treating them as failures could misclassify valid upstream sites as dead. Four occurrences updated: probe_site, the Phase 3 main validator, the Phase 2b reexport probe, and the Phase 3a rescue probe. - Add a Herald changelog fragment under .changes/. The repo enforces these via .herald.yml and the existing PR template's YAML block isn't a substitute for a tracked file.
1 parent 731b50a commit 0396d5f

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
project: cardano-api
2+
pr: 1180
3+
kind:
4+
- bugfix
5+
- documentation
6+
description: |
7+
Fix broken cross-package Haddock links on the hosted documentation site.
8+
Links to dependency packages (cardano-ledger-*, plutus-*, cardano-base, etc.)
9+
were relative paths pointing to directories that don't exist on the site,
10+
resulting in 404s. A post-processing script now resolves each cross-package
11+
href via a name-suffix heuristic under *.cardano.intersectmbo.org plus a
12+
small fallback list of known IOG doc-site roots, and rewrites them to
13+
absolute URLs. Hrefs that don't resolve become annotated unclickable spans
14+
with tooltips. A follow-up GitHub Actions step opens or comments on a
15+
rolling tracking issue when the script reports actionable dead links on
16+
master, tagging the PR opener so the breakage lands on someone's board
17+
instead of going unnoticed.

scripts/fix-haddock-links.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ probe_site() {
172172
local code
173173
code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 \
174174
"${1}/${2}/doc-index.html" 2>/dev/null || echo "000")
175-
[[ "$code" == "200" || "$code" == "301" || "$code" == "302" ]]
175+
[[ "$code" == "200" || "$code" == "301" || "$code" == "302" || "$code" == "307" || "$code" == "308" ]]
176176
}
177177

178178
resolve_url() {
@@ -433,7 +433,7 @@ if [[ $reexport_total -gt 0 ]]; then
433433
# shellcheck disable=SC2016
434434
awk -F'\t' '{print $4}' "$REEXPORT_CANDIDATES" | sort -u | \
435435
xargs -P 16 -I{} sh -c \
436-
'code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 "{}"); if [ "$code" = "200" ] || [ "$code" = "301" ] || [ "$code" = "302" ]; then echo "{}"; fi' \
436+
'code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 "{}"); if [ "$code" = "200" ] || [ "$code" = "301" ] || [ "$code" = "302" ] || [ "$code" = "307" ] || [ "$code" = "308" ]; then echo "{}"; fi' \
437437
> "$REEXPORT_VALID_FILE" 2>/dev/null
438438
fi
439439

@@ -502,7 +502,7 @@ url_count=$(wc -l < "$URLS_FILE")
502502
if [[ $url_count -gt 0 ]]; then
503503
# shellcheck disable=SC2016 # single quotes intentional: expansions evaluated by inner sh -c
504504
xargs -P 16 -I{} sh -c \
505-
'code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 "{}"); if [ "$code" != "200" ] && [ "$code" != "301" ] && [ "$code" != "302" ]; then echo "{}"; fi' \
505+
'code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 "{}"); if [ "$code" != "200" ] && [ "$code" != "301" ] && [ "$code" != "302" ] && [ "$code" != "307" ] && [ "$code" != "308" ]; then echo "{}"; fi' \
506506
< "$URLS_FILE" > "$DEAD_URLS_FILE" 2>/dev/null
507507
fi
508508
dead_count=$(wc -l < "$DEAD_URLS_FILE" | tr -d ' ')
@@ -550,7 +550,7 @@ if [[ $dead_count -gt 0 ]]; then
550550
# shellcheck disable=SC2016
551551
awk -F'\t' '{print $2}' "$RESCUE_CANDIDATES" | sort -u | \
552552
xargs -P 16 -I{} sh -c \
553-
'code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 "{}"); if [ "$code" = "200" ] || [ "$code" = "301" ] || [ "$code" = "302" ]; then echo "{}"; fi' \
553+
'code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 "{}"); if [ "$code" = "200" ] || [ "$code" = "301" ] || [ "$code" = "302" ] || [ "$code" = "307" ] || [ "$code" = "308" ]; then echo "{}"; fi' \
554554
> "$RESCUE_VALID_FILE" 2>/dev/null
555555
fi
556556

0 commit comments

Comments
 (0)