refactor: Centralize the permalink scheme in a domain permalinks module #42
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
rosa/vernier!42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/permalinks-module"
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?
Closes #35.
The
/u/{username}/{slug}URL layout was shared knowledge across ~15 modules: domain services owned a builder (post_source_url) and a parser (resolve_post_url), while the web crate re-derived the scheme by hand-formatting strings in handlers, pages, components, and layouts.Changes
vernier_domain::permalinksmodule as the scheme's single owner:profile_path,post_path,post_edit_path,post_delete_path,tag_path, absolute-URL variants (profile_url,post_url), andparse_post_url— plus a module doc stating the invariant that makes interpolation safe (UserName/Slug/Tagconstructors admit only unreserved characters).ResolvePostError(the existing shared resolution vocabulary) instead ofMicropubError;resolve_owned_postconverts at the boundary via the existingFromimpl, and the privateresolve_post_urlin services is deleted./u/...site inposts.rs,users.rs,micropub.rs,indieauth.rs,pages.rs,components.rs, andlayouts.rsnow calls the module.post_url/parse_post_url, path shapes, and rejection of off-site, non-post, and unparseable URLs.The only remaining
/u/literals are the Axum route templates inroutes.rs(the issue's stated non-goal — Axum needs its own syntax).Verification
mise run cipasses: clippy-D warnings, fmt, sqlx prepare check, and all tests (34 app + 7 webmention integration tests among them), so the rendered pages, redirects, feed URLs, and IndieAuthmeURLs are covered end to end.The /u/{username}/{slug} URL layout was shared knowledge across ~15 modules: domain services owned a builder and a parser, while the web crate re-derived the scheme by hand-formatting strings in handlers, pages, components, and layouts. Add vernier_domain::permalinks as the scheme's single owner: profile, post, edit, delete, and tag paths, absolute-URL variants, and the parser (now speaking ResolvePostError, the existing shared resolution vocabulary). Convert every hand-formatted site to call it; the only remaining /u/ literals are the Axum route templates in routes.rs. Closes #351ce5b214715d8f3fa323