From 2ce4d50eb8b17c751d347865473f9895edecd938 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 21 Sep 2026 18:29:08 +0000 Subject: Pin the reported NPR page shape with a regression test Verified end to end on device against the actual URL from the bug report: npr.org/podcasts/510318/up-first resolves to feeds.npr.org/510318/podcast.xml and subscribes as 'Up First from NPR' with 500 episodes. The page carries two rel="alternate" links: the RSS feed, and an android-app:// deep link with no type attribute at all. Requiring a recognised feed type is what keeps the deep link from being chosen -- it would resolve to something unfetchable. That was already the behaviour; it now has a test naming the case, since "we happen to filter on type" and "we must filter on type" look identical until something changes. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B --- .../java/org/terst/listen/feed/FeedResolverTest.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app') diff --git a/app/src/test/java/org/terst/listen/feed/FeedResolverTest.kt b/app/src/test/java/org/terst/listen/feed/FeedResolverTest.kt index 55e33b2..26d3857 100644 --- a/app/src/test/java/org/terst/listen/feed/FeedResolverTest.kt +++ b/app/src/test/java/org/terst/listen/feed/FeedResolverTest.kt @@ -94,6 +94,24 @@ class FeedResolverTest { !failed.message.contains("START_DOCUMENT") && !failed.message.contains("InputStreamReader")) } + /** + * The page from the bug report, reproduced: NPR declares its feed, but also carries a + * second rel="alternate" with no type at all (an android-app:// deep link). Picking that + * one would resolve to something unfetchable. + */ + @Test + fun `ignores an alternate link with no type`() = runTest { + val html = """ + + + + Up First + """.trimIndent() + server.enqueue(MockResponse().setHeader("Content-Type", "text/html").setBody(html)) + + assertEquals(FeedResolver.Resolution.Feed(url("/rss")), resolve(url("/podcasts/510318/up-first"))) + } + @Test fun `a 404 reports the status rather than a parse error`() = runTest { server.enqueue(MockResponse().setResponseCode(404)) -- cgit v1.2.3