Repository navigation
fix(rules): exclude news sitemaps from lastmod churn #115 - #116
Merged
Merged
Conversation
crawl/sitemap-lastmod-churn warned on any site publishing a Google News
sitemap, which is the correct thing for a publisher to have. A news sitemap
carries roughly the last 48 hours of articles by specification, so its lastmod
values always collapse onto one or two days: exactly the accusation the rule
makes. The rule pooled lastmod across every discovered sitemap, so a news
sitemap alone satisfied it.
Found in pre-release smoke for v0.0.86, on allrecipes.com:
warn :: 38 sitemap URL(s) with lastmod collapse onto 2 distinct day(s):
2026-08-18, 2026-08-19
That is byte-for-byte the content of its google-news-sitemap.xml. The site's
real sitemap contributed nothing, because its four children are bot-protected
and return an HTML error page, leaving the news sitemap as the entire sample.
Detection is by the xmlns:news namespace, never the filename:
google-news-sitemap.xml is a widespread convention, not part of any spec, and a
news sitemap can be served from any path.
The flag has to survive the DB round trip, and that is where the bug really
lived. Parsing it correctly changed nothing at first: the audit adapter rebuilds
its sitemap list field-by-field from the STORED record, in three separate
places, and the stored record had no such column. So the seam is closed end to
end here:
parse (xmlns:news) -> SitemapData -> SitemapRecord -> sqlite column
-> getSitemaps -> all three adapter reconstructions -> rule
Behaviour:
- news-sitemap URLs are excluded from the count entirely, not merely out-voted
- a sample that is ONLY news URLs reports skipped and says so, so "your sitemap
is fine" is distinguishable from "your sitemap has no lastmod"
- findings now name the sitemap the offending values came from, since "which one
stamps at build time" is the first question on a site with several
Schema v21 adds sitemaps.is_news_sitemap. Local sqlite only, NOT a prod
migration; pre-v21 rows read back false, which is the behaviour they were stored
under. SCHEMA_VERSION is exported so the migration tests assert "reached the
current version" instead of pinning a literal that breaks on every bump.
Verified against the live site: the finding is gone, and the DB shows
is_news_sitemap=1 for the news sitemap and 0 for the regular one.
Signed-off-by: Nik Cubrilovic <[email protected]>
The catalog is at 275 rules; README and the docs claimed 273. The two crawl/sitemap-lastmod-* rules added their pages and nav entries but never updated the counts, so Crawlability read 18 against an actual 20. Counts are recomputed from loadAllRules(), not edited by hand: README.md Crawlability 18 -> 20, total 273 -> 275 docs/index.mdx hero card, prose, category table, total docs/rules/index.mdx frontmatter description and prose crawl/sitemap-lastmod-churn also had a docs page and a nav entry but no card in the Crawlability index, so it was unreachable by browsing. Two pre-existing gaps of the same kind are fixed alongside it: content/mojibake and content/stale-copyright have had pages and no cards. Signed-off-by: Nik Cubrilovic <[email protected]>
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.
Closes #115. Pre-release work for v0.0.86 — the first commit is the blocker, the second is drift the release surfaced.
crawl/sitemap-lastmod-churnaccused every news publisherA Google News sitemap carries roughly the last 48 hours of articles by specification, so its
lastmodvalues always collapse onto one or two days. That is exactly the accusation the rule makes, and it pooledlastmodacross every discovered sitemap, so a news sitemap alone satisfied it.Found in pre-dispatch smoke on allrecipes.com:
Byte-for-byte the content of its
google-news-sitemap.xml. The site's real sitemap contributed nothing — its four children are bot-protected and return an HTML error page — leaving the news sitemap as the entire sample.Detection is by the
xmlns:newsnamespace, never the filename:google-news-sitemap.xmlis a widespread convention, not part of any spec, and a news sitemap can be served from any path. Tested in both directions.The seam is where the bug actually lived
Parsing the flag correctly changed nothing at first. The live site still warned, with the fix in place, because the audit adapter rebuilds its sitemap list field-by-field from the stored record — in three separate places — and the stored record had no such column. A parse-only test passes green while the feature does nothing.
So it is closed end to end:
I asserted the count when patching the adapter, which is how the third reconstruction site turned up — I had expected two.
Behaviour
skippednaming that reason, so "your sitemap is fine" is distinguishable from "your sitemap carries no lastmod"Schema
v21 adds
sitemaps.is_news_sitemap. Local sqlite only, NOT a prod migration. Pre-v21 rows read backfalse, which is the behaviour they were stored under.SCHEMA_VERSIONis now exported so the migration tests assert "reached the current version" rather than pinning a literal — that literal was already costing two unrelated failures per schema bump, including in this PR.Verification
Live, on the site that failed:
Tests: 9 new (3 rule fixtures incl. the exact allrecipes shape, 6 namespace-detection, 3 DB round-trip covering the pre-v21 NULL path).
packages/crawler+packages/rules1563 pass,packages/audit-engine270 pass — the canonical golden tripwire is unmoved, as expected: no news sitemap in the fixture corpus.Rule counts had drifted
The catalog is at 275; README and docs claimed 273. The two
sitemap-lastmod-*rules added pages and nav entries but never updated the counts, so Crawlability read 18 against an actual 20. Recomputed fromloadAllRules(), not edited by hand.sitemap-lastmod-churnalso had a page and a nav entry but no card in the Crawlability index, so it was unreachable by browsing. Two pre-existing gaps of the same kind are fixed alongside it:content/mojibakeandcontent/stale-copyright.