Skip to content

Add recursive website link checking - #2283

Open
lrt950 wants to merge 1 commit into
lycheeverse:masterfrom
lrt950:feat/recursive-link-checking
Open

lrt950 wants to merge 1 commit into
lycheeverse:masterfrom
lrt950:feat/recursive-link-checking

Conversation

@lrt950

@lrt950 lrt950 commented Aug 17, 2026

Copy link
Copy Markdown

Closes #78.

Summary

  • add -R / --recursive website crawling, limited to input domains by default
  • add --max-depth and --recursed-domains controls
  • reuse the configured collector and shared host pool for recursively discovered pages
  • deduplicate crawled pages after fragment normalization and stop recursion at external redirect destinations
  • preserve checks for external links without following them

Pipeline and termination

Recursive requests carry the existing WaitGuard, so the pipeline terminates only after all dynamically discovered work completes. Sends into the bounded feedback channel are spawned independently from response processing; this avoids the full-channel deadlock that affected earlier attempts while retaining backpressure. Page collection also remains bounded by max_concurrency.

Validation

  • cargo test --workspace --features check_example_domains
  • cargo clippy --workspace --all-targets --features check_example_domains -- -D warnings

The CLI tests cover nested broken links, depth limits, default and configured domain boundaries, external redirects, and the bounded-channel case at --max-concurrency 1.

@lrt950 lrt950 mentioned this pull request Aug 17, 2026
@katrinafyi

Copy link
Copy Markdown
Member

The biggest issues that I see at first are that there is no deduplication of recursive requests, and the tokio::spawn on every recursive URL is essentially the same as an unbounded channel but with more overhead.

@iGotYourBackMr

Copy link
Copy Markdown

@lrt950 I reproduced the two blockers from @katrinafyi's review and prepared a focused companion PR on top of your exact head commit: lrt950#1 (7b2420af). Would you be willing to merge it into feat/recursive-link-checking?

The patch:

  • replaces the spawn-per-URL bounded sender with an unbounded feedback channel, matching the direction discussed in Pass channel sender along to prevent deadlocks #2229 and removing the per-task overhead;
  • atomically deduplicates discovered URIs before enqueueing them and seeds the set with initial requests;
  • adds a deterministic concurrent regression where /a and /b both discover the same delayed /target.

On unmodified #2283, that regression fails with 4 Total / 3 Unique; with the patch it passes with 3 Total, and Wiremock verifies exactly one request to /target. All eight recursive CLI tests pass, as does focused Clippy with warnings denied. The implementation and testing were AI-assisted by OpenAI Codex on behalf of iGotYourBackMr.

@lfrancke, you confirmed that you are willing to split the EUR 100 bounty. If this focused fix is accepted into #2283 and the feature is ultimately merged upstream, would you confirm a split of at least EUR 20, payable through PayPal to iGotYourBackMr? I will treat it as pending unless the contribution is adopted and payment is approved.

@B-Lounes

B-Lounes commented Sep 8, 2026

Copy link
Copy Markdown

@lrt950 I reproduced a separate error-reporting problem: malformed links in a recursively discovered page, or a failure fetching that page's content after its link check succeeds, are logged and dropped. Lychee then exits 0 with zero reported errors.

The tested follow-up is available as an apply-ready patch, with reproduction, validation, and integration notes. It applies with git am to your current 9623a957 head and changes two files. I verified that applying the published patch produces exactly the tested source tree. My current GitHub credentials couldn't publish a companion branch carrying the older workflow history, so I'm supplying the patch directly for review.

All three new local regressions fail on this branch and both companion implementations; all nine recursion tests pass with the fix. Combining it with the depth correction in lrt950#2 passes all ten recursion tests. The deduplication work in lrt950#1 needs a stream-setup adjustment to preserve error items. Workspace Clippy and formatting pass; the validation notes identify two external-service test failures also reproduced on the unchanged branch.

@lfrancke, if this contribution is adopted into the completed feature, would a €20 share of the reconfirmed €100 total reward be available? No allocation or payment is assumed.

This implementation, testing, and description were prepared with OpenAI Codex on behalf of B-Lounes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add recursive option

4 participants