web: RSS and Atom feed handlers duplicate their feed-building structure #101
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
rosa/vernier#101
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_rssandget_user_atom(crates/web/src/handlers/users.rs:483-591) share roughly 80% of their structure: resolve the profile with no viewer, loop overprofile.listed, build the post permalink and profile URL, and set the content-type header. Only the feed-object assembly differs.A small shared helper for the profile/permalink plumbing would keep the two feeds from drifting apart. (The missing Atom
id/updatedelements — #94 — is exactly the kind of divergence this duplication produces.)Agent Brief
Category: enhancement
Summary: Extract the shared feed-assembly plumbing from the RSS and Atom handlers so the two feeds can't drift apart.
Current behavior:
The two feed handlers — the one serving
application/rss+xmland the one servingapplication/atom+xmlfor a user's blog — share roughly 80% of their structure. Each independently resolves the profile as seen by no viewer, iterates the profile's listed posts, builds a per-post absolute permalink and the absolute blog/profile URL via the sharedpermalinks::helpers, and sets the content-type header. Only the feed-object assembly differs: one uses thersscrate's channel/item builders, the other theatom_syndicationcrate's feed/entry builders. Because the plumbing is copy-pasted, the two feeds have already diverged once (#94: the Atom feed is missingid/updatedelements).Desired behavior:
The profile-resolution, per-post permalink construction, blog/profile URL construction, and content-type plumbing are computed once in a shared, format-agnostic step. Each handler consumes that shared data and maps it into its own crate's builders. Adding or correcting a field that belongs to "an entry" (title, link, published timestamp, content) or "the feed" (title, blog link) should have one obvious home per concern, not two. Both feeds' rendered output must be unchanged by this refactor (it is a pure restructuring).
Key interfaces:
FeedEntry { title, url, published_at, html }and aFeedData { author/profile, blog_url, entries }, produced once from the resolved profile. Exact names and fields are the implementing agent's call; the contract is that both handlers derive their builder inputs from the same values.permalinks::helpers (post URL + profile/blog URL); do not hand-format paths.Acceptance criteria:
application/rss+xmland the Atom handler still emitsapplication/atom+xml, with output equivalent to today's (no field added or dropped as part of this refactor).format,clippy, andcimise tasks pass.Out of scope:
id/updatedelements — that is #94. This refactor should make that fix land in one place afterward, but does not perform it.