Repository navigation
Replace htmltest with Lychee for link checking - #2665
Merged
Merged
Conversation
- Adds tests/lychee (run via test:lychee) that pin the behavior the htmltest to Lychee switch depends on: Lychee is installed, and local paths, local fragments, external URLs, and external fragments each pass and fail as expected. - Targets docsy.dev for the external cases -- a site we control -- with a canary that fails loudly if the referenced page or anchor ever moves; set LYCHEE_SANITY_NO_NET=1 to skip the network cases. - Encodes the offline pretty-URL fragment gap as a todo test (Lychee resolves /foo/ to the directory, not foo/index.html, when scanning anchors), so the suite documents the limitation now and flips green once Lychee fixes it.
- Replaces the pretty-URL fragment todo with two passing tests: one proving `--index-files index.html` resolves a Hugo pretty-URL directory link for offline fragment checks, and one guarding the failure mode without the flag (so a future lychee that resolves indexes by default becomes a visible signal). - The fix matches otel.io's generated lychee.toml (`include_fragments` + `index_files`); offline pretty-URL fragments were never a real blocker, just a missing config option.
- Removes redundant comments that the test names and the thoughtry tracker already convey, keeping only the non-obvious `--index-files` note.
- Adds `docsy.dev/lychee.toml`, ported from `.htmltest.yml` (excludes and fragment checking via `include_fragments`/`index_files`); an offline run over the built site reaches full htmltest parity (0 errors). - Adds `scripts/check-links-lychee.sh`, which resolves the absolute `public/` path and bridges a `GITHUB_TOKEN` from `gh` when unset, and wires the `check:links:lychee` npm scripts (`:internal` runs offline). htmltest stays the default checker for now.
Make Lychee the sole link checker for docsy.dev, dropping htmltest and its caching artifacts (the prior commit added the Lychee config and run script alongside htmltest). - Point `_check:links` and `check:links:internal` at the Lychee wrapper, and remove the htmltest plumbing: `.htmltest.yml`, the `make`-based targets, the committed `refcache.json`, and the `prune:refcache`, refcache-unescape, and full-vs-lean matrix scripts. - Extend `lychee.toml` excludes to reach a clean run: the per-page provenance `commit/` links htmltest skipped via `data-proofer-ignore`; bot-walled hosts (npmjs, Algolia) and SPA fragment routes (Prism builder hash, AWS signup); and a temporary block, to remove after 0.16.0 ships, for the unreleased tag and the version dropdown's links to pages new or draft this cycle. - Ignore `lychee.toml` in Prettier (no TOML parser) and drop a stale htmltest mention in a fixture-site test comment.
Commit a pre-warmed `.lycheecache` (938 OK entries) so CI and local runs skip re-checking known-good external links within `max_cache_age`. A later housekeeping workflow will refresh it periodically.
The fixes for 55 externals broken by upstream restructures (GitHub theme-paths, gohugo.io anchors, Google SEO, Mermaid) live on a parked branch (chalin-m24-docsy-link-rot-2026-0626) to keep this PR tooling-only. Exclude them here so the online link check stays green until that branch lands; the marked block is removed once it does.
Adds a pinned lychee install step to the test workflow: the switch dropped htmltest's Makefile auto-install, but the new wrapper expects `lychee` on PATH, so the blocking online link check (ci:test, Linux only) failed with "lychee not found". Fetches the release binary directly (lychee-action's installer can't handle the versioned tarball layout) into `$HOME/.local/bin` and adds it to `GITHUB_PATH`; gated to the Linux runner since Windows doesn't run the check.
- lychee writes .lycheecache in a nondeterministic order, so a CI link check rewrites the committed cache and the post-test clean-tree check (_diff:check) fails on the dirty file. - Sort the cache after each run in the run wrapper and commit it sorted, so warm reruns yield a byte-identical file; a genuinely new uncached URL still changes the cache, which usefully flags a coverage gap.
- Pass GITHUB_TOKEN inline to lychee instead of exporting it, so a token bridged from gh never lingers in the script's environment (e.g. for the later cache-sort step). - Generalize the header comment so the wrapper reads repo-agnostically, ahead of a planned generic version usable by any repo.
This was referenced Jun 26, 2026
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.
docsy.devlink checking from the unmaintained htmltest to Lycheescripts/check-links-lychee.sh) over the built site, bridginggh's token intoGITHUB_TOKENso local runs aren't GitHub-throttled..htmltest.ymlintolychee.toml, keeping full fragment checking (include_fragments+index_files) for parity..lycheecache(938 OK entries) and atest:lycheesanity suite (10 tests)..htmltest.yml,refcache.json, the prune/unescape/matrix scripts, and themakelink targets.lychee.tomlblock excludes 55 externals broken by upstream restructures (GitHub theme-paths, gohugo.io anchors, Google SEO, Mermaid); their fixes are partitioned onto a follow-up content-only branch, and the block is removed once that lands.test:lychee10/10; build, format, and markdownlint clean.