Skip to content

Fix Atom relation links and add release history - #63

Merged
cardmagic merged 2 commits into
masterfrom
fix/atom-relation-links
Sep 13, 2026
Merged

cardmagic merged 2 commits into
masterfrom
fix/atom-relation-links

Conversation

@cardmagic

@cardmagic cardmagic commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

Atom relation URLs were available only under legacy keys such as :"link+alternate", leaving the documented link_alternate accessor empty. The extractor also lost href attributes placed before rel and could return nested media markup as a URL.

Add the documented method/hash aliases while retaining the legacy keys. Read relation-specific href values from direct child links in the current entry, handling attribute order, whitespace, quote styles, and paired or self-closing elements. Keep nested metadata, content, comments, and CDATA from supplying another relation's URL. Preserve relative URLs, existing case-insensitive matching, custom relation tags, and item.link behavior. Document both keys in hash/JSON serialization.

Add CHANGELOG.md following solid-objects-ruby's dated, user-facing release notes. Backfill version changes through the first Git import in 2006, cite their source boundaries, and distinguish source-history dates and intermediate versions from verified publications. Record #57 and #58 under Unreleased, include the changelog in the gem, and expose its RubyGems metadata URL. Move project guidance to AGENTS.md, add changelog maintenance and release rules, and make CLAUDE.md contain only @AGENTS.md.

Validation: the documented-accessor regression failed with an expected article URL and actual nil before the fix. Eleven regression tests cover accessors, legacy keys, extraction boundaries, serialization, and a reduced fixture based on the archived fork feed; all three entries in the complete archived fixture also return their article URLs through both keys. The full suite passes on Ruby 3.4.8 (123 tests, 275 assertions; 3 existing network-test omissions), along with RuboCop, RBS validation, and Steep. Built the gem and verified changelog inclusion and metadata; checked all 16 historical Git references and the exact CLAUDE.md import.

GitHub CI passes on Ruby 3.2, 3.3, 3.4, and 4.0, including lint and type checking. Hound's style comments conflict with the repository's .rubocop.yml: double quotes are required; the configured line, method, ABC, and cyclomatic limits permit these changes. Those comments were resolved using the repository configuration and passing RuboCop result.

Review follow-up: simplified token filtering to one guard. The reported quoted-trailing-slash nesting case already passed: the captured attribute text ends in its closing quote, so a URL's slash cannot be mistaken for a self-closing element. Extended the nested-source/content test with both quote styles and verified it passed before changing the guard.

Closes #57.

Expose documented relation accessors alongside legacy keys. Extract
relation URLs from direct child links without borrowing neighboring
attributes or returning nested media markup. Preserve legacy link
selection and document the additional hash and JSON keys.

Backfill the changelog from tagged releases and version-changing commits
through the first Git import. Include it in the gem and its metadata.
Move shared guidance to AGENTS.md, import it from CLAUDE.md, and require
changelog updates with behavior changes and releases.

Closes #57
Comment thread lib/simple-rss.rb
Comment thread lib/simple-rss.rb Outdated
Comment thread lib/simple-rss.rb
Comment thread lib/simple-rss.rb
Comment thread lib/simple-rss.rb
Comment thread lib/simple-rss.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
@greptile-apps

greptile-apps Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR corrects Atom relation-link extraction and exposes documented underscore aliases while retaining legacy keys. It also adds release history and consolidates repository guidance.

  • Extracts relation-specific href values from direct child links while excluding nested markup.
  • Adds regression coverage for attribute syntax, nesting boundaries, aliases, serialization, and custom relations.
  • Adds and packages CHANGELOG.md, including RubyGems changelog metadata.
  • Moves shared project and release guidance into AGENTS.md.
  • The follow-up removes the previously reported redundant guard and confirms quoted trailing slashes do not corrupt nesting depth.

Confidence Score: 5/5

The PR appears safe to merge; no remaining actionable correctness, security, or repository-rule violations were identified.

The current implementation preserves direct-child boundaries, relation aliases, legacy keys, and serialization behavior. Both previous threads are resolved, and the follow-up removes the redundant guard while demonstrating that quoted URL-ending slashes remain inside their closing quotes and therefore do not alter nesting depth.

Important Files Changed

Filename Overview
lib/simple-rss.rb Adds direct-child relation-link extraction, robust attribute parsing, and documented relation aliases; the follow-up cleanly removes the redundant token guard.
test/base/relation_links_test.rb Covers relation accessors, legacy compatibility, nesting boundaries, attribute variants, serialization, and custom relations.
CHANGELOG.md Adds sourced, dated release history and unreleased user-facing changes.
simple-rss.gemspec Packages the changelog and publishes its metadata URL.
AGENTS.md Centralizes development, changelog, and release guidance.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Entry content] --> B[Tokenize XML-like markup]
  B --> C{Opening or closing element?}
  C -->|Closing| D[Decrease nesting depth]
  C -->|Opening| E{Direct child link?}
  E -->|Yes| F[Parse rel and href attributes]
  E -->|No| G[Track nesting depth]
  F --> H{Requested relation matches?}
  H -->|Yes| I[Store underscore and legacy keys]
  H -->|No| G
Loading

Reviews (2): Last reviewed commit: "refactor: simplify relation token guards" | Re-trigger Greptile

Comment thread lib/simple-rss.rb
Comment thread lib/simple-rss.rb Outdated
Use the attribute capture to skip non-element tokens with one guard.

Cover paired elements whose quoted URLs end in a slash. The case

already preserves nesting because the captured closing quote follows

the slash.
Comment thread lib/simple-rss.rb
Comment thread lib/simple-rss.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
Comment thread test/base/relation_links_test.rb
@cardmagic

Copy link
Copy Markdown
Owner Author

@greptileai Please review the current head, 8661e42d5810f52cf093170f006457220771c09a, including the follow-up to the previous findings.

The redundant token guard has been removed. The quoted-trailing-slash example was checked before changing the guard: test_relations_ignore_nested_source_content_comments_and_cdata passes with both <source xml:base="https://example.com/"> and a single-quoted content base URL ending in /. The attribute capture retains its closing quote, so attributes.rstrip.end_with?("/") returns false for these paired elements and nested links remain excluded.

Current-head CI passes on Ruby 3.2, 3.3, 3.4, and 4.0, with lint and type checking also passing. Please reassess the changes and report any remaining actionable findings and an updated confidence score.

@cardmagic
cardmagic merged commit c0b7808 into master Sep 13, 2026
7 checks passed
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.

Fix Atom relation link accessors

2 participants