Repository navigation
Hand Astro only remote artwork it can load - #129
Merged
Merged
Conversation
A build fails when an episode's artwork URL is dead: getImage only plans the transform, and Astro's later image pass fetches the URL and fails the whole build on a 404 or a page that is not an image. These tests show optimizeImage handing such URLs to Astro instead of falling back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getImage in a build only plans a remote image's transform; Astro fetches it later and fails the build on one it cannot load. So one dead <itunes:image> link failed the whole site under an adapter that resizes at build, such as @astrojs/node. getLoadableImage reads each remote image once per URL with Astro's own inferRemoteSize (same redirect handling, and it confirms an image) under a 10s deadline, and refuses one Astro cannot load, so the existing fallbacks in optimizeImage, cardArt and faceOf apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
RobbieTheWagner
added a commit
that referenced
this pull request
Dec 5, 2026
The back catalogue gains artwork that is gone (404) or a web page, durations as HH:MM:SS and MM:SS, a guid with no attributes and none at all, no itunes:episodeType, an itunes:summary alone, and a title in numeric character references. feed-quirks.spec.ts checks what a listener sees of each: dead artwork stays at its feed address, each duration reads as its length, the plain-guid episode keeps its video, the summary is the description, and the rest are numbered episodes with their own pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RobbieTheWagner
added a commit
that referenced
this pull request
Dec 5, 2026
The back catalogue gains artwork that is gone (404) or a web page, durations as HH:MM:SS and MM:SS, a guid with no attributes and none at all, no itunes:episodeType, an itunes:summary alone, and a title in numeric character references. feed-quirks.spec.ts checks what a listener sees of each: dead artwork stays at its feed address, each duration reads as its length, the plain-guid episode keeps its video, the summary is the description, and the rest are numbered episodes with their own pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RobbieTheWagner
added a commit
that referenced
this pull request
Dec 6, 2026
…base (#130) * Build a fixture site for a made-up show, its URLs answered by MSW tests/fixture-site is a Starpod site for a made-up show, built the way a user's would be. One module (feed/episodes.ts) defines its episodes, people and transcripts, and writes its feed. feed/routes.mjs answers every fixture URL (*.fixture.example), and feed/msw.mjs preloads it into the build, the dev server and the seed, failing them on any other request. The media is generated colour bars and silence; the database is a local SQLite file seeded from db/data. Besides the episodes the suite opens, the back catalogue carries what real feeds send: artwork redirected across hosts, named by a query, as PNG or WebP, unlabeled, very large or over http; an enclosure behind a tracker's redirects; escaped descriptions, markup and emoji in titles; and feed transcripts with no type, the wrong Content-Type, missing, malformed or empty. A unit test reads the feed through the site's own parser with the same routes, and fails while the feed on disk and episodes.ts disagree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Run the e2e suite on the fixture site Playwright builds the fixture site and serves it with the Node adapter (E2E_DEV=1 serves it with the dev server), on port 4400 by default so it never meets the whiskey.fm dev server. Every spec imports test from tests/e2e/fixture.ts, which answers the fixture's media and artwork from the build's own routes and fails a test whose page reaches anywhere else. Slugs, titles, numbers and names come from feed/episodes.ts. Tests that leaned on dev-only image URLs now check the image the page names is resized; the MP3 stand-in route is gone, as the fixture's audio is short. feed-quirks.spec.ts checks what a listener sees of the feed's quirks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Build the fixture site once in CI, for every browser, with no secrets A fixture-site job builds it and uploads dist/, failing if the build holds a database URL or a JWT; the three browser jobs serve it. No job gets the database secrets. whiskey.fm gets a build check of its own from its live feed, with a local database seeded from db/data. The scaffold job builds against the fixture feed, answered by MSW, instead of flightcast.com. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Give the sections episode a real host's captions: short, unvoiced and many Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Skip the dock's audio test in CI's Firefox, which has no audio output Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Let Astro 7 read the fixture's fonts list and artwork through MSW Astro 7's font resolver lists Google's fonts at fonts.google.com, so that host passes through like the font files. Astro 7's image probe cancels a response once it has the image's size, and MSW never settles cancel() on a body it streams itself: every artwork timed out unread and the build kept the feed's URLs. The fixture's answers are now streams that have already ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add the feed quirks #127 and #129 let a build survive The back catalogue gains artwork that is gone (404) or a web page, durations as HH:MM:SS and MM:SS, a guid with no attributes and none at all, no itunes:episodeType, an itunes:summary alone, and a title in numeric character references. feed-quirks.spec.ts checks what a listener sees of each: dead artwork stays at its feed address, each duration reads as its length, the plain-guid episode keeps its video, the summary is the description, and the rest are numbered episodes with their own pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Answer fixture byte ranges as a real host would, and serve artwork by plain id only An oversized suffix range now returns the whole file, a range past the end gets 416, and the image route refuses an id that could leave feed/files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Pass respond's range in the artwork test, as its type asks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep fixture file reads inside feed/files, and write cue times to the millisecond A double-encoded dot segment passed the decoded-path check and resolved outside feed/files; file() now checks where the URL resolved. Caption cues at half seconds were written as whole seconds. CLAUDE.md now says the feed writer also writes the markdown transcripts, and that the build lets Google Fonts through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Say the fixture's episodes keep feed order, and find the oldest year by date Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
Why
Starpod should build a site from whatever a podcast host's feed serves. We're running the e2e suite against a small fixture feed that covers the odd things real feeds do. Building that fixture turned up this bug. When an episode's
<itunes:image>URL answers 404, the whole build fails under an adapter that resizes images at build time. That means Astro's own sharp service, as with@astrojs/node, which #126 makes Starpod's default. One dead artwork link in a real feed takes the whole site down.whiskey.fm never saw this. The Vercel image service fetches nothing at build time.
Root cause
optimizeImage, the explorer'scardArtandfaceOfcallgetImageinside try/catch and expect to fall back when it fails. In a build,getImageonly plans a remote image's transform and never fetches it, so it never throws. Astro fetches the image later, in its image generation pass (assets/build/generate.js, thenloadRemoteImage). It collects that failure and exits 1. The same happens for a URL that answers 200 with something that isn't an image (NoImageMetadata).Fix
lib/remote-image.tsaddsgetLoadableImage, agetImagethat first reads each remote image once per URL. The read uses Astro's owninferRemoteSizefromastro:assets. It follows redirects the way the build does and checks them against the integration'sremotePatterns(flightcast 307s to signed S3 URLs). It also confirms the body is an image, and it stops reading once it knows the dimensions. A 10s deadline keeps a stalled art host from hanging the build. An image Astro cannot load is refused like any othergetImageerror, so each caller's existing fallback applies. That is the raw URL inoptimizeImage, the thumbnail or show art incardArt, and the avatar infaceOf. The three call sites switch to it.In
astro devnothing crashed before or after. Before, the page pointed at an/_imageURL that answered 500. Now it points at the raw URL.Cost
The check runs on every adapter, Vercel included. Against whiskey.fm's feed, 265 distinct
<itunes:image>URLs checked concurrently took 1.4 to 2.1s of wall time over 9 runs. In 1 of those 9 runs one URL failed transiently. That episode would fall back to its raw, unoptimized URL for that build, which still loads in a browser.Verification
@astrojs/node, local feed with one episode whose art 404s), not committed.astro buildexits 1 before and 0 after, and the episode's stage<img>falls back to the raw URL. The same consumer also exits 0 with art that answers 200 HTML, and with an art host that never answers (the build took about 10s longer, and nothing hung).tests/unit/remote-image.test.tsruns Astro's real probe against a stubbedfetch. It covers a loadable image, a 307 redirect to another host, a 404, an HTML page, a stalled host, and one fetch per URL. It lands one commit ahead of the fix: 4 of 5 fail without it.tests/unit/stubs/astro-assets.tslets Vitest resolveastro:assets.pnpm test:unit run(309 passed),pnpm lint,pnpm astro check(0 errors).🤖 Generated with Claude Code