Skip to content

Commit 03b5b49

Browse files
committed
Address carbolymer review on PR #1180
- Add changelog fragment with single-line description (no hard wraps in the YAML block scalar). - derive_name_candidates: cap at two-token names. The previous loop emitted a single-token URL like cardano.cardano.intersectmbo.org as its last candidate. If that subdomain ever resolves (wildcard DNS, future deploy, catch-all), probe_site would silently accept it and rewrite every cardano-* link to the wrong site. An early break after the suffix strip prevents the heuristic from ever emitting a URL whose subdomain is a single bare token. - Add --retry 3 --retry-delay 2 --retry-all-errors to all five curl sites. Every probe was previously a single-shot attempt (5s connect, 10s max). Worst case: Phase 3 validation downgrades a perfectly valid rewritten URL into an unclickable <span>, silently shipping a regression. Other failure modes: probe_site falling through to a wrong candidate, or the CHaP index fetch killing the whole build on a CDN hiccup.
1 parent c5c01a0 commit 03b5b49

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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. Links to dependency packages (cardano-ledger-*, plutus-*, cardano-base, etc.) were relative paths pointing to directories that don't exist on the site, resulting in 404s. A post-processing script now resolves each cross-package href via a name-suffix heuristic under *.cardano.intersectmbo.org plus a small fallback list of known IOG doc-site roots, and rewrites them to absolute URLs. Hrefs that don't resolve become annotated unclickable spans with tooltips. A follow-up GitHub Actions step opens or comments on a rolling tracking issue when the script reports actionable dead links on master, tagging the PR opener so the breakage lands on someone's board instead of going unnoticed.

scripts/fix-haddock-links.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,15 @@ derive_name_candidates() {
8989
printf '%s\n' "https://${name}.cardano.intersectmbo.org"
9090
[[ "$name" == *-* ]] || break
9191
name="${name%-*}"
92+
[[ "$name" == *-* ]] || break
9293
done
9394
}
9495

9596
probe_site() {
9697
local code
97-
code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 \
98+
code=$(curl -sI -o /dev/null -w "%{http_code}" \
99+
--connect-timeout 5 --max-time 10 \
100+
--retry 3 --retry-delay 2 --retry-all-errors \
98101
"${1}/${2}/doc-index.html" 2>/dev/null || echo "000")
99102
[[ "$code" == "200" || "$code" == "301" || "$code" == "302" ]]
100103
}
@@ -157,7 +160,8 @@ done
157160

158161
# Fetch CHaP index
159162
CHAP_PKGS_FILE=$(mktemp_tracked)
160-
curl -sL https://chap.intersectmbo.org/01-index.tar.gz \
163+
curl -sL --retry 3 --retry-delay 2 --retry-all-errors \
164+
https://chap.intersectmbo.org/01-index.tar.gz \
161165
| tar -tz | grep -oP '^[^/]+' | sort -u > "$CHAP_PKGS_FILE"
162166
declare -A CHAP_SET
163167
while IFS= read -r pkg; do CHAP_SET["$pkg"]=1; done < "$CHAP_PKGS_FILE"
@@ -345,7 +349,7 @@ if [[ $reexport_total -gt 0 ]]; then
345349
# shellcheck disable=SC2016
346350
awk -F'\t' '{print $4}' "$REEXPORT_CANDIDATES" | sort -u | \
347351
xargs -P 16 -I{} sh -c \
348-
'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' \
352+
'code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 --retry 3 --retry-delay 2 --retry-all-errors "{}"); if [ "$code" = "200" ] || [ "$code" = "301" ] || [ "$code" = "302" ]; then echo "{}"; fi' \
349353
> "$REEXPORT_VALID_FILE" 2>/dev/null
350354
fi
351355

@@ -408,7 +412,7 @@ url_count=$(wc -l < "$URLS_FILE")
408412
if [[ $url_count -gt 0 ]]; then
409413
# shellcheck disable=SC2016 # single quotes intentional: expansions evaluated by inner sh -c
410414
xargs -P 16 -I{} sh -c \
411-
'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' \
415+
'code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 --retry 3 --retry-delay 2 --retry-all-errors "{}"); if [ "$code" != "200" ] && [ "$code" != "301" ] && [ "$code" != "302" ]; then echo "{}"; fi' \
412416
< "$URLS_FILE" > "$DEAD_URLS_FILE" 2>/dev/null
413417
fi
414418
dead_count=$(wc -l < "$DEAD_URLS_FILE" | tr -d ' ')
@@ -456,7 +460,7 @@ if [[ $dead_count -gt 0 ]]; then
456460
# shellcheck disable=SC2016
457461
awk -F'\t' '{print $2}' "$RESCUE_CANDIDATES" | sort -u | \
458462
xargs -P 16 -I{} sh -c \
459-
'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' \
463+
'code=$(curl -sI -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 --retry 3 --retry-delay 2 --retry-all-errors "{}"); if [ "$code" = "200" ] || [ "$code" = "301" ] || [ "$code" = "302" ]; then echo "{}"; fi' \
460464
> "$RESCUE_VALID_FILE" 2>/dev/null
461465
fi
462466

0 commit comments

Comments
 (0)