Skip to content

CI: Deduplicate links in the Check Links report - #9140

Open
Esteban82 wants to merge 1 commit into
masterfrom
check-links-dedupe-report
Open

CI: Deduplicate links in the Check Links report#9140
Esteban82 wants to merge 1 commit into
masterfrom
check-links-dedupe-report

Conversation

@Esteban82

Copy link
Copy Markdown
Member

The same broken link often gets listed once per file that references
it, so a single dead link can flood the weekly "Link Checker Report"
issue with repeated entries.

Added a post-processing step that keeps only the first occurrence of
each link in the report and drops the per-file subsections that end
up empty after deduplication.

Assisted-by: Claude Sonnet 5 (High effort)

lychee lists the same broken link once per file that references it,
so a link cited from many docs pages shows up many times in the
weekly report/issue. Add a post-processing step that keeps only the
first occurrence of each link and drops now-empty per-file sections.

Assisted-by: Claude Sonnet 5 (High effort)
@Esteban82 Esteban82 added the AI-assisted All (or most) of the code was written by Artificial Intelligence. label Aug 23, 2026
@Esteban82
Esteban82 requested review from joa-quim and seisman August 23, 2026 14:20
@Esteban82
Esteban82 marked this pull request as ready for review August 23, 2026 14:20
@Esteban82 Esteban82 added the maintenance Boring but important stuff for the core devs label Aug 23, 2026
@seisman

seisman commented Aug 23, 2026

Copy link
Copy Markdown
Member

It's easy to write a ~100-line script with Claude to process the output, but I feel it's too complex for us to maintain.

Looking at the latest report in #9139, maybe we should ignore timeout errors and 403 errors? I think we care about 404 errors the most.

@Esteban82

Copy link
Copy Markdown
Member Author

I could simplify this to a short bash pipeline instead:

- name: Deduplicate links in the report
  if: steps.lychee.outputs.exit_code != 0
  run: |
    {
      awk '/^## /{exit} {print}' /tmp/lychee-out.md
      echo
      echo "## Broken/timed-out links"
      echo
      grep '^\* \[' /tmp/lychee-out.md | sed -E 's/ \(at [^)]*\)//' | sort -u
    } > /tmp/lychee-dedup.md
    mv /tmp/lychee-dedup.md /tmp/lychee-out.md

The trade-off is that the report becomes a flat, deduplicated list instead of being grouped per source file, so it wouldn't say which file(s) each broken link came from anymore.

Would that be better for you?

@seisman

seisman commented Aug 24, 2026

Copy link
Copy Markdown
Member

The trade-off is that the report becomes a flat, deduplicated list instead of being grouped per source file, so it wouldn't say which file(s) each broken link came from anymore.

The Python script has the same drawback because it reports only the first occurrence of a broken link.

I usually use grep/ack to find the files with broken links, so I feel it's not a big issue. In other words, I feel the bash script version is better than the Python version.

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

Labels

AI-assisted All (or most) of the code was written by Artificial Intelligence. maintenance Boring but important stuff for the core devs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants