feat: exclude_paths — skip dynamic areas (RSS feeds, news archives) from scan

Adds crawl.exclude_paths config option (list of URL path prefixes).
Matching URLs are excluded at two levels:
- Crawler: not fetched at all (saves HTTP requests)
- Differ: filtered from both baseline and current before comparison,
  so legacy baseline entries under excluded paths don't appear as
  "missing URLs" after the option is added retroactively

Example config:
  crawl:
    exclude_paths: ["/rss/", "/feed/", "/news/archiv/"]

8 new tests (176 total).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-06-12 13:14:06 +02:00
commit 3a44cfb515
6 changed files with 93 additions and 2 deletions

View file

@ -279,6 +279,47 @@ class TestBrokenLinks:
assert result["level"] == "green"
class TestExcludePaths:
def _page(self, url, status=200):
return {
"url": url, "status": status, "text": "x",
"links": {"a": [], "script": [], "iframe": [], "link_rel": [], "form": [],
"meta_refresh": [], "canonical": None},
"metadata": {"title": "T", "h1": [], "h2": []},
"hidden_content": [], "inline_scripts": [], "jsonld": [], "comment_links": [],
}
def _cfg(self, exclude):
return {**BASE_CFG, "crawl": {"exclude_paths": exclude}}
def test_new_url_under_excluded_path_not_reported(self):
baseline = {"https://b.info/": self._page("https://b.info/")}
current = {
"https://b.info/": self._page("https://b.info/"),
"https://b.info/rss/feed.xml": self._page("https://b.info/rss/feed.xml"),
}
result = compare_snapshots(baseline, current, self._cfg(["/rss/"]))
assert "https://b.info/rss/feed.xml" not in result["new_internal_urls"]
def test_missing_url_under_excluded_path_not_reported(self):
baseline = {
"https://b.info/": self._page("https://b.info/"),
"https://b.info/rss/feed.xml": self._page("https://b.info/rss/feed.xml"),
}
current = {"https://b.info/": self._page("https://b.info/")}
result = compare_snapshots(baseline, current, self._cfg(["/rss/"]))
assert "https://b.info/rss/feed.xml" not in result["missing_internal_urls"]
def test_non_excluded_path_still_reported(self):
baseline = {"https://b.info/": self._page("https://b.info/")}
current = {
"https://b.info/": self._page("https://b.info/"),
"https://b.info/news/artikel": self._page("https://b.info/news/artikel"),
}
result = compare_snapshots(baseline, current, self._cfg(["/rss/"]))
assert "https://b.info/news/artikel" in result["new_internal_urls"]
class TestScoreDiff:
def test_green_for_no_changes(self):
result = score_diff({