Operations & robustness — robots.txt, crawl-delay, hardening#28
Merged
Conversation
- RobotsPolicy interface (+ ALLOW_ALL) and HttpRobotsPolicy: per-host robots.txt fetch+cache (TTL, injectable clock), our-UA group selection (falls back to *), longest-prefix match with Allow winning ties, missing robots -> allow-all, Crawl-delay parsing. - SitemapCrawler filters discovered URLs (sitemap + fallback) via RobotsPolicy and only follows same-host child sitemaps (closes the sitemap-index SSRF surface). PageFetcher honors Crawl-delay via HostRateLimiter.acquire(host, minInterval). - Fault tolerance verified via existing tests; IndexReport/robots-skip/task outcomes logged. Micrometer metrics deferred (no metrics backend wired) per the design's open question. - Tests: HttpRobotsPolicyTest, HostRateLimiter crawl-delay, SitemapCrawler robots + off-host guard; existing crawler/fetcher tests use ALLOW_ALL. 142 tests green. @Autowired on HttpRobotsPolicy's public ctor (two ctors). - steps.md; refresh CLAUDE.md (Phase 1 complete). Refs #27
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.
Summary
Hardens the crawler for production and closes out Phase 1: honor each host's
robots.txt, respectCrawl-delay, verify end-to-end fault tolerance, and improve structured logging. Also restricts sitemap-index recursion to the same host (SSRF hardening flagged in earlier specs).Spec
docs/specs/014-ops-robustness/{design,behaviors,steps}.mdChanges
RobotsPolicyinterface (+ALLOW_ALL) andHttpRobotsPolicy(per-host fetch+cache, our-UA group with*fallback, longest-prefix matching, missing → allow-all,Crawl-delay)SitemapCrawlerfilters discovered URLs via robots and only follows same-host child sitemaps;PageFetcherhonorsCrawl-delayviaHostRateLimiter.acquire(host, minInterval)Deferred (documented)
micrometer-observationon the classpath). Structured logging shipped now; add counters/timers when a backend exists.Test coverage
HttpRobotsPolicyTest,HostRateLimiterTest.crawlDelayTightensInterval,SitemapCrawlerTestrobots + off-host guard; fault-tolerance covered by existing spec 007/008/009/010 tests. 142 tests total; spec-review and quality-review clean.Closes #27
🤖 Generated with Claude Code