Skip to content

Find Feed: prefer a page-specific feed over a site-wide <head> feed (#5299)#5327

Open
bojanstef wants to merge 1 commit into
Ranchero-Software:mainfrom
bojanstef:fix/feedfinder-prefer-onpath-feed-5299
Open

Find Feed: prefer a page-specific feed over a site-wide <head> feed (#5299)#5327
bojanstef wants to merge 1 commit into
Ranchero-Software:mainfrom
bojanstef:fix/feedfinder-prefer-onpath-feed-5299

Conversation

@bojanstef

@bojanstef bojanstef commented Jun 13, 2026

Copy link
Copy Markdown

Fixes #5299. I asked first on Discourse and got the go-ahead: https://discourse.netnewswire.com/t/first-time-contributing-can-i-fix-issue-5299/299

Problem

Find Feed on https://www.relay.fm/blog selects http://relay.fm/master/feed (the all-network feed) instead of the page's own https://www.relay.fm/blog/feed.

Root cause

The page advertises two feeds:

  • http://relay.fm/master/feed — a <link rel="alternate"> in <head> (.HTMLHead)
  • https://www.relay.fm/blog/feed — a body "Subscribe via RSS" link (.HTMLLink)

In FeedFinder.findFeedsInHTMLPage, as soon as any <head> feed is found it sets didFindFeedInHTMLHead = true and returns the <head> feeds, so the body candidate sitting in feedSpecifiersToDownload is discarded. bestFeed then receives a single-element set and returns master/feed without ever scoring — so /blog/feed is dropped before it can be considered. (Confirmed by tracing the discovery at runtime: both feeds were discovered; the body feed was discarded by the early return.) This isn't a relay.fm misconfiguration — both feeds are valid and advertised.

Fix

Before falling back to the <head> feed, validate any body-linked candidate whose URL is on the same host and nested under the requested page's path (e.g. /blog/feed for a /blog request) and prefer it. Host comparison is www- and case-insensitive (via localeForLowercasing). Root-domain requests (no path) keep the existing <head>-feed behavior, so whole-site Find Feed is unchanged.

Testing

  • New unit test testFeedURLIsUnderRequestedPagePath — on-path preference, www/case-insensitive host matching, different-host rejection, root-path exclusion, and the sibling-prefix trap (/blogger is not under /blog).
  • swiftlint lint --strict clean; FeedFinder module build has no new warnings; module tests pass.
  • Verified end to end: Find Feed on relay.fm/blog now resolves to https://www.relay.fm/blog/feed.

Disclosure

Diagnosed and drafted with LLM assistance (Claude Opus 4.8), reviewed to meet the project's quality bar — per CONTRIBUTING.md.

…Ranchero-Software#5299)

findFeedsInHTMLPage returned early with the <head> feed whenever one existed,
discarding every body-discovered feed. For a /blog request on a site whose
<head> advertises a site-wide feed (e.g. relay.fm's all-network feed) while the
page links its own feed in the body ("Subscribe via RSS"), the page-specific
feed was dropped before bestFeed could consider it.

Before falling back to the <head> feed, validate any body-linked candidate
whose URL is on the same host and nested under the requested page's path, and
prefer it. Host comparison is www- and case-insensitive (via
localeForLowercasing); root requests (no path) keep the existing <head>-feed
behavior, so whole-site Find Feed is unchanged. A unit test covers the
path/host matching.

Diagnosed by tracing the discovery path at runtime: both feeds were discovered,
but the body feed was discarded by the didFindFeedInHTMLHead early return before
bestFeed ran. Written with LLM assistance and reviewed to meet the project's
quality bar; clean module build with no new warnings, swiftlint --strict clean,
tests pass.

Generated-by: claude-opus-4-8
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bojanstef bojanstef force-pushed the fix/feedfinder-prefer-onpath-feed-5299 branch from eeeae4b to d6bda7c Compare June 13, 2026 15:10
@bojanstef bojanstef marked this pull request as ready for review June 13, 2026 15:13
@bojanstef bojanstef requested a review from brentsimmons as a code owner June 13, 2026 15:13
@bojanstef

Copy link
Copy Markdown
Author

@brentsimmons There's AI-generated comments, let me know if I should:

  • Leave them
  • Make them more concise
  • Remove them completely

@bojanstef

Copy link
Copy Markdown
Author

@brentsimmons would it help if I sent a screen recording?

@brentsimmons

Copy link
Copy Markdown
Collaborator

I’m not sure this is actually the fix I want — we might just be trading a fix for this one specific site for breaking other sites. Not sure what to do yet. It may be just that it needs a special case for this particular site.

@bojanstef

Copy link
Copy Markdown
Author

@brentsimmons fair enough, let me know if you want to brainstorm
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find feed for Relay blog finds different feed

2 participants