From 9c59790f82d4bc6c69dc33eb02234d51fb8c31d9 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sat, 5 Dec 2026 05:46:40 +0000 Subject: [PATCH 1/2] Links: lychee checks the built site's own links and anchors offline in CI, and every live link nightly (sc-9611) --- .github/workflows/audit.yml | 21 +++++++++++++++++++++ .github/workflows/ci.yml | 9 +++++++++ AGENTS.md | 5 ++++- lychee.toml | 16 ++++++++++++++++ mise.toml | 1 + 5 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 lychee.toml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index f6876b5b..04375806 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -81,3 +81,24 @@ jobs: [[ "$commit" =~ ^[0-9a-f]{40}$ ]] || { echo "::error::no commit from https://api.visualci.com/status"; exit 1; } trivy image --scanners vuln --ignore-unfixed --severity HIGH,CRITICAL --exit-code 1 --ignorefile .trivyignore.yaml \ "ghcr.io/docspring/visualci-app:$commit" + + # Every link on the live site, outside ones included (lychee.toml), daily and by hand: CI checks the site's own links + # offline, so a page someone else moved or took down turns up here. + links: + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + - uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0 + with: + install_args: lychee + # The pages from the live sitemap. GITHUB_TOKEN keeps lychee's github.com checks inside the API's rate limit. + - env: + GITHUB_TOKEN: ${{ github.token }} + run: | + curl -fsS --retry 3 --max-time 20 https://visualci.com/sitemap.xml | grep -o '[^<]*' | cut -c6- >pages.txt + [ -s pages.txt ] || { echo "::error::no pages in https://visualci.com/sitemap.xml"; exit 1; } + lychee --format compact --files-from pages.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f95eebf..307b8bf4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -627,6 +627,15 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} VISUALCI_REQUIRE_WASM: "1" + # Every page, file and #anchor the site links to is in the build, its absolute https://visualci.com/ links + # included (lychee.toml; offline, so an outside site never fails a build: the Audit workflow checks those nightly). + - uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0 + with: + install_args: lychee + - run: | + site=$PWD/frontend/dist-site + lychee --offline --root-dir "$site" --remap "^https://visualci\.com/?(.*)\$ file://$site/\$1" --format compact \ + 'frontend/dist-site/**/*.html' - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: dist-site diff --git a/AGENTS.md b/AGENTS.md index 21aff261..572c2d92 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -26,7 +26,10 @@ design is in `docs/design.md`; read it before changing the architecture, and upd cap, never raise a cap, and delete its line once it's under the limit. **Every lint suppression** (`#[allow(...)]`, `@ts-expect-error`, `# noqa`, a zizmor ignore and the rest) is listed in `scripts/ci/suppressions.txt` with its reason, added in the change that adds it (`scripts/ci/check_suppressions.py`). Fix what a lint finds before you - reach for a suppression. Allow a word or turn a lint rule off for a file only in those + reach for a suppression. +- **Links are checked** by lychee (`lychee.toml`): CI's `clients` job checks every page, file and `#anchor` the built + site links to, offline, so a broken internal link fails the build that makes it. The Audit workflow checks every link + on the live site, outside ones included, each night. Exclude a link in `lychee.toml` only with the reason beside it. Allow a word or turn a lint rule off for a file only in those files, with the reason beside it. Pin every action by commit SHA with its version in a comment (`pinact run` does it). Ignore a zizmor finding only inline (`# zizmor: ignore[audit]`) with the reason beside it; allow a made-up value in `.betterleaks.toml` only with a description of what it is. A real secret that reached a commit is revoked, diff --git a/lychee.toml b/lychee.toml new file mode 100644 index 00000000..224de57b --- /dev/null +++ b/lychee.toml @@ -0,0 +1,16 @@ +# lychee (links), run by CI's clients job over the built site (offline: every page, file and #anchor the site links +# to, its own https://visualci.com/ links included) and nightly by the Audit workflow over the live site (every link, +# outside ones too). mise.toml pins it. Exclude a link here only with the reason beside it. +include_fragments = "full" +# Pages are folders with an index.html (/docs/agents/ is docs/agents/index.html). +index_files = ["index.html"] +no_progress = true +max_concurrency = 8 +exclude = [ + # The app, API and MCP hosts answer only signed-in or API requests (the site links their sign-in and endpoints). + '^https://(app|api|mcp)\.visualci\.com', +] +remap = [ + # GitHub builds a repository page's #readme anchor in JavaScript, so it's never in the HTML lychee reads. + '^(https://github\.com/[^#]+)#readme$ $1', +] diff --git a/mise.toml b/mise.toml index a7396b97..9e0ea562 100644 --- a/mise.toml +++ b/mise.toml @@ -12,3 +12,4 @@ trivy = "0.77.0" hadolint = "2.15.1" typos = "1.53.0" oxlint = "1.96.0" +lychee = "0.24.2" From 16c3d1270cbc413bb00365d5dc4fd24186628667 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sat, 5 Dec 2026 06:04:20 +0000 Subject: [PATCH 2/2] Links: the Markdown copies and llms.txt checked too, the app's public pages no longer excluded, http and www links remapped; ci.md's template link in code (review) --- .github/workflows/ci.yml | 8 ++++++-- frontend/public/ci.md | 2 +- lychee.toml | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 307b8bf4..14a8a1fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -632,10 +632,14 @@ jobs: - uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0 with: install_args: lychee + # The pages, their Markdown copies and llms.txt. The site's own absolute links point at the build; a Markdown copy's + # #anchor (an HTML page's id) is dropped, since a Markdown heading has none (one remap applies per link: first wins). - run: | site=$PWD/frontend/dist-site - lychee --offline --root-dir "$site" --remap "^https://visualci\.com/?(.*)\$ file://$site/\$1" --format compact \ - 'frontend/dist-site/**/*.html' + lychee --offline --root-dir "$site" --format compact \ + --remap "^https?://(www\.)?visualci\.com/([^#]+\.md)#.*\$ file://$site/\$2" \ + --remap "^https?://(www\.)?visualci\.com/?(.*)\$ file://$site/\$2" \ + "$site/**/*.html" "$site/**/*.md" "$site/llms.txt" "$site/llms-full.txt" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: dist-site diff --git a/frontend/public/ci.md b/frontend/public/ci.md index b02693ba..8e6ab535 100644 --- a/frontend/public/ci.md +++ b/frontend/public/ci.md @@ -19,7 +19,7 @@ visualci build finalize when `VISUALCI_TOKEN` is empty (pull requests from forks). - **CircleCI:** https://visualci.com/docs/ci/circleci.md - **GitLab CI:** https://visualci.com/docs/ci/gitlab.md -- **Buildkite, Jenkins, Bitbucket, Semaphore, TeamCity, Travis:** https://visualci.com/docs/ci/.md +- **Buildkite, Jenkins, Bitbucket, Semaphore, TeamCity, Travis:** `https://visualci.com/docs/ci/.md` (`buildkite`, `jenkins`, `bitbucket`, `semaphore`, `teamcity`, `travis`) - **Anything else:** https://visualci.com/docs/ci/other.md Parallel jobs share one build: `visualci build create --nonce --shards `, and each job runs diff --git a/lychee.toml b/lychee.toml index 224de57b..89b348cd 100644 --- a/lychee.toml +++ b/lychee.toml @@ -7,10 +7,14 @@ index_files = ["index.html"] no_progress = true max_concurrency = 8 exclude = [ - # The app, API and MCP hosts answer only signed-in or API requests (the site links their sign-in and endpoints). - '^https://(app|api|mcp)\.visualci\.com', + # Sign-in pages and API endpoints answer only signed-in or API requests. The app's public pages (galleries, the + # demo) are still checked. + '^https://app\.visualci\.com/(auth|api|oauth)/', + '^https://(api|mcp)\.visualci\.com', ] remap = [ # GitHub builds a repository page's #readme anchor in JavaScript, so it's never in the HTML lychee reads. '^(https://github\.com/[^#]+)#readme$ $1', + # The Markdown copies (for agents) link anchors by their HTML pages' ids, which a Markdown heading doesn't have. + '^(https://visualci\.com/[^#]+\.md)#.*$ $1', ]