Repository navigation
Publish check image cache: trimming and review fixes.
Fixes
- The kept image cache is trimmed to the images a build used. Astro never deletes a cache entry, so the check's cache (1.12.1) grew with every image a site ever had. After a passing check, entries whose file is not in the build output, and their
.jsondetails, are dropped. A failed or timed-out build trims nothing (its output is incomplete), nor does a build whose output matches no entry at all. - One cache folder per site directory (
.git/astroadmin/check-image-cache/root,site-<subdir>). A site in a subdirectory namedassetswas nested inside the root site's cache. The 1.12.1 folder (check-image-cache/assets) is no longer used and can be deleted; the first check after upgrading builds from cold. - Finding the cache can no longer fail a publish: a git error there logs and builds cold.
- A copy left by a crashed check is swept before the next one is written.
Tests
New publish-check tests: trimming (including no trim after a failed build or an output that matches nothing), separate caches for the root and an assets subdirectory, a leftover copy swept, and a checkout with a real node_modules/.astro that the check neither reads nor writes. Each seen red first, the last two under a mutant of their mechanism. On a copy of a 238-image site with Astro itself: all 238 kept and reused, a planted stale entry dropped.