web: Atom feed omits the required id and updated elements #94
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
rosa/vernier#94
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
get_user_atom(crates/web/src/handlers/users.rs:534-591) builds the feed and each entry without calling.id(...)or.updated(...), soatom_syndication's builders emit empty ones.idandupdatedare mandatory on bothfeedandentryin RFC 4287. Feed validators reject the output, and some readers will refuse or mis-handle the feed (entries without stable ids also break read-state tracking).Suggested fix:
id: the profile URL. Feedupdated: the newest entry's publication instant (or now if empty).id: the post's permalink URL. Entryupdated: the post's publication (or last-modified, if available) timestamp.The RSS counterpart (
get_user_rss) is fine.Agent Brief
Category: bug
Summary: The Atom feed emits an empty
<id>and an epoch-defaulted<updated>on both the feed and every entry, violating RFC 4287.Current behavior:
FeedData::to_atom_stringbuilds the feed and its entries without settingidorupdated.atom_syndication's builders then emit their defaults — an empty<id></id>and<updated>1970-01-01T00:00:00+00:00</updated>— on both the feed element and each entry.idandupdatedare mandatory onfeedandentryper RFC 4287; validators reject the output and some readers mis-handle it. Entries lacking stable ids also break read-state tracking. The RSS renderer (FeedData::to_rss_string) is unaffected.Note: the report cites the old location in the users handler, but the code has since been refactored into
FeedData::to_atom_string— the bug moved with it and is otherwise unchanged.Desired behavior:
The rendered Atom document carries a non-empty
idand a realupdatedtimestamp on the feed and on every entry:id= the blog/profile URL (FeedData::blog_url).updated= the most recent entry's publication instant, falling back to the current time when there are no entries.id= the post's permalink (the entry'surl).updated= the post's publication timestamp.FeedData/FeedEntrycarry no separate last-modified field, so published is the correct source; do not add a new field for this.Key interfaces:
FeedData::to_atom_string— setid/updatedon the entry builder and the feed builder. The data it needs (blog URL, per-entry permalink, per-entrypublished_at) is already present onFeedData/FeedEntry; no new inputs are required.FeedData/FeedEntry— no shape change expected.Acceptance criteria:
idequal to the blog URL and anupdatedequal to the newest entry's publication instant.updatedis a current timestamp (not the Unix epoch).idequal to its permalink and anupdatedequal to its publication timestamp.idandupdatedvalues on both the feed and an entry (the existing round-trip test passes today despite the bug because empty ids parse cleanly — the new assertions must fail against the current code and pass after the fix).Out of scope:
<content>element, which currently uses an out-of-linesrc=<permalink>rather than embedding the post HTML (as RSS does). That is a separate discrepancy, not part of this issue.to_rss_stringor the RSS output.