You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Re-audits reuse stored pages for up to 24 h: crawler honours s-maxage and treats stale-while-revalidate as reuse without a request #2229
Re-audits can grade an old copy of a page for up to 24 hours after the site changes, because the crawler reuses stored pages using freshness rules meant for shared caches.
What happens. A site sends Cache-Control: public, max-age=300, s-maxage=3600, stale-while-revalidate=86400 (common on modern hosting and CDNs). After an audit stores a page, a re-audit made minutes after a deploy:
treats the page as fresh for 3600 s, because s-maxage wins over max-age, and reuses the stored body with no request;
after that, treats stale-while-revalidate as permission to reuse the stored body with no request again, for up to the 24 h staleness cap. The background revalidation that SWR assumes never happens.
The audit then reports findings the live page no longer has, and can flag the previous deploy's removed hashed assets as broken resources.
Where.packages/crawler/src/incremental.tscalculateFreshness (the s-maxage precedence and the revalidate state), used by core/crawler.ts (around the freshness short-circuit).
Expected. The crawler is a private client:
s-maxage (a shared-cache directive) is ignored; max-age, then Expires, set the lifetime.
A stale entry inside a stale-while-revalidate window is revalidated with a conditional GET (If-None-Match / If-Modified-Since), never reused without a request. A 304 keeps the stored body; a 200 replaces it.
Found from cloud feedback (private tracking issue 5096 in the squirrelscan monorepo).
Acceptance Criteria
calculateFreshness ignores s-maxage: for max-age=300, s-maxage=3600, a 301-second-old entry is NOT fresh.
An entry past max-age but inside stale-while-revalidate is revalidated with a conditional GET; the crawler never reuses its body without a request.
A crawl test: run 1 stores a page with max-age=300, s-maxage=3600, stale-while-revalidate=86400; the origin body changes; run 2 at +301 s sends a conditional request and reports the NEW body. A 304 from an unchanged origin keeps the stored body.
immutable, no-cache, no-store and the staleness cap behave as before (existing tests green).
A changelog.d entry describes the fix in user terms.
Activity
fix(crawler): ignore s-maxage and revalidate stale-while-revalidate e…