Repository navigation
Description
disableLinkDiscovery is honoured on the fetch path and ignored on the cache-reuse path, so a crawl that is meant not to follow links follows them as soon as a page is reused.
The fetch path gates discovery:
// packages/crawler/src/core/crawler.ts
const shouldDiscoverLinks = !config.disableLinkDiscovery || config.sitemapPendingCount === 0;
if (parsed.document && shouldDiscoverLinks) {
const crawlableUrls = extractCrawlableUrls(parsed.document, result.finalUrl);
for (const url of crawlableUrls) {
yield* enqueueUrl(crawlId, url, entry.depth + 1, entry.normalizedUrl, "discovered");
}
}reuseCachedPage does the same enqueue with no such check. It re-derives the outlinks from cachedPage.parsedData (or by re-parsing the cached HTML) and enqueues every one of them unconditionally.
So with incremental: true and disableLinkDiscovery: true, one reused page is enough to put the whole site back in the frontier. A cached homepage puts every link it carries into the queue, those pages are fetched, and the crawl the caller asked to be narrow is not.
Who this affects
Quick coverage sets disableLinkDiscovery and has since long before the incremental cache existed, so any quick audit that reuses a cached page is affected today. The hosted side also has a per-website "sitemap only" scope that sets the same flag.
Reproduction
A cached homepage linking to /off-map, a healthy sitemap that does not list it, disableLinkDiscovery: true and incremental: true. /off-map is discovered and fetched.
Suggested fix
Apply the same gate on the reuse path, so the two ways a page is processed agree about whether its links may be followed. sitemapPendingCount is already on the config where reuseCachedPage can read it, so the condition can be the identical expression rather than a second one that can drift.
The hosted side has worked around this by turning cache reuse off whenever the narrow scope is asked for, which costs those runs their reuse. That workaround can come out once the gate is applied here.
Acceptance Criteria
- A crawl with
disableLinkDiscovery: truedoes not enqueue outlinks from a reused cached page - The sitemap fallback still holds: with no crawlable sitemap URLs, a reused page's links are discovered as they are on the fetch path
- A crawl with
disableLinkDiscovery: falsereuses pages and discovers their links exactly as it does today - A test covers the reuse path specifically, not only the fetch path
Activity
docs(dashboard): say what sitemap scope gives up, not what it keeps
docs: cloud crawl scope, include/exclude patterns and authorised craw…