break the tests - #305
Conversation
|
🤖 OpenHands is reviewing this PR. Trigger: PR opened at This comment was posted by an AI agent (OpenHands). |
|
🤖 OpenHands is reviewing this PR. Trigger: PR opened at This comment was posted by an AI agent (OpenHands). |
|
🤖 OpenHands is reviewing this PR. Trigger: PR opened at This comment was posted by an AI agent (OpenHands). |
|
🤖 OpenHands is reviewing this PR. Trigger label: This comment was posted by an AI agent (OpenHands). |
|
This comment was posted by an AI agent (OpenHands). |
|
🤖 OpenHands is reviewing this PR. Trigger label: This comment was posted by an AI agent (OpenHands). |
rbren
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Summary
This PR removes 'title' from fields.feed in lib/fields.js. That is the only mapping that copies a feed's plain <title> element into feed.title for RSS 0.9x/1.0/2.0 documents, so this is a functional regression, not a cleanup.
Why it breaks:
buildRSS()(lib/parser.js:227) is the only place feed-level fields are populated for RSS/RDF, viautils.copyFromXML(channel, feed, feedFields)wherefeedFields = fields.feed.concat(customFields.feed). With'title'gone,<channel><title>is never read.- The remaining
['dc:title', 'title']entry only covers feeds that emit a Dublin Coredc:titleat channel level — most real feeds (including thereddit.rssfixture, whose channel uses a plain<title>) do not. - Atom is unaffected because
parseAtomFeed()setsfeed.titleexplicitly (lib/parser.js:143-147). So the breakage is silent and format-specific: Atom keeps working, RSS silently loses its title.
Test impact: test/parser.js deep-equals parsed output against the golden JSON in test/output/. 23 of the 26 golden files containing a feed-level title are RSS/RDF (all except atom-customfields.json, gulp-atom.json, reddit-atom.json), so those cases will fail with feed.title missing.
API impact: feed.title is a documented top-level output field. Since index.d.ts declares it title?: string (optional), TypeScript consumers get no compile-time signal — they just silently receive undefined.
If the intent is only to drop a duplicate, note there is no duplicate to drop here: the ['dc:title', 'title'] tuple and the bare 'title' string read two different XML elements. (The genuinely redundant entry in this list is 'generator', listed twice at lines 15 and 21 — out of scope for this diff.)
🔄 CHANGES REQUESTED
| ['dc:title', 'title'], | ||
| ['dc:type', 'type'], | ||
| 'title', | ||
| 'description', |
There was a problem hiding this comment.
Removing 'title' from fields.feed drops feed-level title parsing for all RSS/RDF feeds.
buildRSS() populates feed fields solely through utils.copyFromXML(channel, feed, feedFields) (lib/parser.js:227), so without this entry <channel><title> is never copied to feed.title. The surviving ['dc:title', 'title'] above reads a different element (dc:title) and does not cover feeds that use a plain <title> — e.g. test/input/reddit.rss.
Atom feeds still work because parseAtomFeed() assigns feed.title directly (lib/parser.js:143-147), which makes this failure silent and asymmetric across formats. 23 RSS/RDF golden files in test/output/ assert a feed-level title and will fail.
Please restore this entry.
|
🤖 OpenHands is reviewing this PR. Trigger label: This comment was posted by an AI agent (OpenHands). |
rbren
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Summary
This PR removes 'title' from fields.feed in lib/fields.js. That single deletion breaks feed-level title parsing for every RSS/RDF feed, which is a core documented output field of this library — not a cosmetic change.
Why this breaks
For RSS 0.9x/2.0 and RDF feeds, feed.title is populated only through utils.copyFromXML(channel, feed, feedFields) (lib/parser.js:227), and feedFields derives from fields.feed (lib/parser.js:209). copyFromXML (lib/utils.js:47) copies a key only when the field is listed. With 'title' gone, the sole remaining mapping to title is ['dc:title', 'title'], which fires only when the channel actually carries a dc:title element — most RSS feeds do not. Atom feeds are unaffected because they take a separate path (lib/parser.js:143-146).
Two concrete consequences:
feed.titlebecomesundefinedfor ordinary RSS feeds. e.g.test/input/guardian.rsscontains nodc:title, yettest/output/guardian.jsonexpectsfeed.title === "The Guardian". 27 of the 29 fixture files intest/output/assert a top-levelfeed.title; the RSS-based ones will now fail.- Silent precedence change where
dc:titledoes exist. Previously'title'was listed after['dc:title', 'title'], so the plain<title>value won. Nowdc:titlewins, so those feeds get a different title value rather than no value — a quieter regression that is easy to miss.
This is also a breaking API change against the published typings (index.d.ts:31, where Output.title is declared) and the README's documented output shape.
Recommendation
Restore the 'title' entry in its original position (after the dc:* mappings, preserving the existing precedence). If the intent was genuinely to change title resolution, it needs the fixtures, typings, and README updated together plus a major-version note — but the PR title ("break the tests") and empty description suggest this is a deliberate test of CI/review tooling rather than an intended change.
🔄 CHANGES REQUESTED
| ['dc:title', 'title'], | ||
| ['dc:type', 'type'], | ||
| 'title', | ||
| 'description', |
There was a problem hiding this comment.
Removing 'title' from fields.feed drops feed-level title parsing for all RSS/RDF feeds.
feed.title for RSS 0.9x/2.0 and RDF is set exclusively by utils.copyFromXML(channel, feed, feedFields) (lib/parser.js:227), and copyFromXML only copies fields that are listed (lib/utils.js:47). The only remaining mapping to title is ['dc:title', 'title'] on line 8, which requires the channel to carry a dc:title element. Most RSS feeds don't, so feed.title will be undefined.
Concretely: test/input/guardian.rss has no dc:title, but test/output/guardian.json expects feed.title === "The Guardian". 27 of 29 fixtures in test/output/ assert a top-level feed.title.
There's a second, subtler effect: 'title' used to be listed after ['dc:title', 'title'], so for feeds that have both, the plain <title> overwrote dc:title. With the plain entry gone, dc:title now wins — those feeds silently get a different title instead of none.
Please restore 'title' in its original position to preserve both behavior and precedence. Atom feeds are unaffected (handled separately at lib/parser.js:143-146).
No description provided.