fix(ci): drive linkinator via its API to end the exit-13 link-check flake#62
Merged
Conversation
…lake
The links job shelled out to `npx linkinator`, whose CLI runs `await main()`
at the top level. On Node 22 the event loop can empty while that await is
still pending, aborting with exit 13 ("unsettled top-level await") after
fetching only `/` — a deterministic crash, not a broken link, that the
earlier retry-on-13 hardening (#58/#59) could not reliably paper over (it
still failed on PRs #60 and #61).
Replace the CLI with scripts/check-links.mjs, which drives linkinator's
LinkChecker class programmatically and resolves with `.then()`/process.exit
so our process can't hit the same foot-gun. Pin linkinator as a devDependency
for a stable version. Both jobs (internal --internal, external --config) use
it; the config's `skip` list maps to the API's `linksToSkip`.
Verified locally: builds, serves, and scans 1500 internal links (0 broken,
exit 0) with no exit-13 crash.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying specification-website with
|
| Latest commit: |
6545ac4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d781edf8.specification-website.pages.dev |
| Branch Preview URL: | https://fix-links-programmatic-api.specification-website.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces the
npx linkinatorCLI call in the Links workflow with a small programmatic-API script,scripts/check-links.mjs, and pinslinkinatoras a devDependency.Why
linkinator@6's CLI runs
await main()at the top level. On Node 22 the event loop can empty while that await is still pending, aborting with exit 13 ("unsettled top-level await") after fetching only/. That's a deterministic tooling crash, not a broken link — and the earlier retry-on-13 hardening (#58/#59) couldn't reliably paper over it: the Internal links check still went red on PRs #60 and #61.The script drives linkinator's
LinkCheckerclass directly and resolves with.then()/process.exitinstead of a top-level await, so our own process can't hit the same foot-gun. Real broken links still exit 1; a crash exits 2.Details
--internal): skips every off-host link, same as before.--config linkinator.config.json): the config'sskiplist is mapped to the API'slinksToSkip;recurse,concurrency,timeout,retry,retryErrors,retryErrorsCountpass straight through.astro preview --port 4321and point the script at it.Verification
Built, served, and ran locally against the preview server:
No exit-13 crash.
npm run lintandprettier --checkpass.🤖 Generated with Claude Code