FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ci: improve `linkcheck` job behavior and failure modes by rgommers · Pull Request #2182 · pypa/packaging.python.org · GitHub

Repository navigation

ci: improve linkcheck job behavior and failure modes - #2182

Open
rgommers wants to merge 3 commits into
pypa:mainfrom
rgommers:ci-improve-linkcheck
Open

rgommers wants to merge 3 commits into
pypa:mainfrom
rgommers:ci-improve-linkcheck

Conversation

rgommers commented Nov 11, 2026 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

Addresses the persistent issues with linkcheck failures on unrelated PRs. Closes gh-2037.

The key choice to make is when linkcheck fails and where that shows up. This PR does the following (aligned with the high-level approach mentioned in gh-2037):

  • Keep a baseline cache with the full linkcheck results (only uploaded from main). If that cache doesn't exist, then generate it on the fly.
  • On PRs and merge queues, only validate links that are introduced in that PR. Existing broken/unavailable links will not fail any job.
  • On pushes to main, run full linkcheck. Individual link failures remain visible, but do not fail the aggregate check job. Upload the reports, summarize failing URLs, and save the baseline for subsequent PRs.
  • On daily cron jobs, fail linkcheck and the subsequent check job, and report the failing links in the job summary (example here on my fork).
    • This will not auto-open an issue on this repo (that'd be too noisy), but it will generate notifications for people subscribed to failures or who look at the Actions tab on this repo. Actual broken links will be noticed and fixed on a reasonable timescale, rather than silently keep failing forever.
    • The summary is very useful; the current linkcheck job just fails without any obvious indication for what is wrong, and then you can go browse the log to spot the problem.

The baseline is an exact base commit, without fallback to older cached reports. URL matching is exact, so new paths, query strings, and fragments remain checked. A cache miss generates the baseline in a temporary worktree; existing broken links are accepted when the base run produces a valid report.

Because this stuff is inherently quite fragile, introduce a small test suite that validates that broken links, a missing cache, and the report generation are actually working as advertised. This introduces pytest as a new test dependency; that should be fine (I considered unittest, but there's no reason to avoid a pytest dependency in this repo).

Finally, the last commit adds notes on linkcheck to the contributor guide.

Developed with Codex / Sol 6.1. Tested all CI modes on my fork at rgommers#1.


📚 Documentation preview 📚: https://python-packaging-user-guide--2182.org.readthedocs.build/en/2182/

Compare PR and merge-queue links with the exact base revision's Sphinx
JSONL report. Escape and anchor known URLs so new paths and fragments
remain checked, while preserving checks for local links and manual
exclusions.

Restore an exact-SHA baseline cache published only by main pushes. On a
cache miss, fetch the base commit and generate its report in a temporary
worktree rather than weakening enforcement. Accept existing broken links
in that report, but reject missing or malformed reports.

Make new-link failures block PRs and merge queues. Keep full checks on
pushes informational and retain failing daily checks for site-wide link
monitoring. Upload full reports and summarize failing URLs so maintainers
can investigate outages without blocking unrelated changes.
Add a Nox test session to CI and use pytest fixtures and parametrization
to cover exact URL matching, report validation, and monitoring summaries.

Exercise Sphinx against a local HTTP server to prove existing broken URLs
are skipped while new working and broken URLs are actually checked.
Use temporary Git repositories to verify cache reuse, environment
isolation, and worktree cleanup on success and failure. Include a shallow
clone so fetching a missing base commit is tested as it occurs in CI.

Keep network requests local and Git mutations confined to disposable
repositories so contributors can run the suite against their own checkout.
Explain how to run full local linkcheck and the pytest suite through Nox,
including report locations and the use of temporary repositories in tests.

Describe exact-base filtering and cache-miss generation for PRs and merge
queues. Distinguish informational full checks after main pushes from
failing daily monitoring, and point contributors to uploaded reports and
job summaries when investigating link failures.
rgommers added the type: maintenance Regular maintenance of the guide, CI and repo label Nov 11, 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

Labels

type: maintenance Regular maintenance of the guide, CI and repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linkcheck for newly add links in PRs

2 participants


Back | FazBrowse Home | New Git URL