Repository navigation
fix(crawler): gate link discovery on cached page reuse - #559
Merged
Merged
Conversation
reuseCachedPage enqueued every outlink of a reused page, ignoring disableLinkDiscovery. Share one linkDiscoveryAllowed() check between the fetch path and the reuse path. Signed-off-by: Nik Cubrilovic <[email protected]>
|
Reviewed the diff. I found no blocking issues.
(nit) I haven't run the tests or checked CI. |
|
Reviewed the diff. I found no issues.
I did not run the test suite myself. |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
reuseCachedPageenqueued every outlink of a reused page, ignoringdisableLinkDiscovery. Withincremental: trueanddisableLinkDiscovery: true, one reused homepage put the whole site back in the frontier.The check is now one shared
linkDiscoveryAllowed()inpackages/crawler/src/core/crawler.ts, used by both the fetch path and the reuse path, so they cannot drift. It is read at call time becausesitemapPendingCountchanges as the crawl runs.docs/crawl.mdxnow says a reused page follows the same link rules as a fetched one.Acceptance criteria
disableLinkDiscovery: truedoes not enqueue outlinks from a reused cached page. Test:disableLinkDiscovery: a reused page does not enqueue its outlinks.sitemap fallback: with no crawlable sitemap URLs a reused page's links are discovered.disableLinkDiscovery: falsediscovers links from reused pages as before. Test:negative control: disableLinkDiscovery false discovers a reused page's links.packages/crawler/tests/reuse-link-discovery-gate.test.tsruns a real two-pass incremental crawl where pass 2 makes zero fetches (asserted), so every page goes throughreuseCachedPage. The first test fails without the fix.Verification
bun test packages/crawler/tests/reuse-link-discovery-gate.test.ts: 3 pass (first test fails with the fix reverted)bun teston cache-fresh-skips-delay, incremental-freshness, cache-stats, carried-seed-crawl: 34 passcd packages/crawler && bun run typecheck: cleanbun run lint,bun run format:check: cleancd docs && make validate: all checks passedAgent skill
No skill change needed. No CLI flag, output format or command changed; the skill links to the docs for crawl behaviour.
Risk
Quick audits that reuse cached pages now stay on the seed and sitemap URLs, which is what the mode documents.
Closes #354