Skip to content

Treat 502/503/504 as a transient answer, not a dead link - #299

Closed
bfs2021 wants to merge 1 commit into
TMHSDigital:mainfrom
bfs2021:fix/link-check-transient-5xx
Closed

bfs2021 wants to merge 1 commit into
TMHSDigital:mainfrom
bfs2021:fix/link-check-transient-5xx

Conversation

@bfs2021

@bfs2021 bfs2021 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Problem

The weekly link check reports a 502/503/504 as a dead link (site/lib/link-check.mjs:61). When one big host has a short outage, every entry on it lands under "Dead": the 2026-11-09 run (#274) listed 70 github.com entries as dead from HTTP 504s, and a recheck the same day returned 200 for all 70. Fixes #275.

Root cause

classify() treats every status from 400 up as permanent. A gateway answer means the host could not answer at that moment, not that the page is gone, so the report cannot tell an outage from a removed source.

Fix

  • classify() returns a new unavailable kind for 502/503/504, before the >= 400 branch. 404/410 and every other 4xx/5xx answer still classify as dead.
  • site/check-links.mjs lists those entries under the existing Could not check section (with the API skips) and keeps them out of problems, so an outage no longer opens entries that need a licence re-read.
  • The script's header comment and the run summary count now name the transient case.

The optional delayed retry from the issue is not included: the existing immediate retry already covers a blip, and a 30 s wait per entry would lengthen the run without changing the classification.

Testing

  • node site/lib/lib.test.mjs: 1710 assertions pass. New cases: 502/503/504 return unavailable (all three failed with "dead" on the old classify), 410 still dead, and a 502 detail names the status.
  • npm test passes (274 + 1710 assertions), npm run lint reports "66 scripts parse, no unused imports".

This change was drafted by an agent; the classification and the report section were read in the source before submitting.

…#275)

A gateway answer says the host was unavailable at that moment. Reporting every
entry on it as dead turned one GitHub outage into 70 false alarms in the
2026-11-09 report. classify() now returns kind "unavailable", the report lists
those under Could not check, and they are not counted as problems. 404/410 and
other 4xx/5xx answers stay dead.
@TMHSDigital

Copy link
Copy Markdown
Owner

Thanks! Closing in favour of #300, which fixed the same classification and also covers licence pages and the retry. Your write-up of the cause was spot on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Link check reports transient 5xx answers (GitHub outage) as dead links

2 participants