Skip to content

web(posts): rename post DTOs/args away from role-suffixes; unify Create/Update result #569

Description

@mdorman

Deferred from #323 (posts vertical convergence). During #323 review we noticed the
post read/result DTOs and the #[server] arg wrappers are named for their role in
the plumbing
(*Result, *Response, args) rather than for what they are — the
FooManager smell. Splitting this out so it gets its own focused review + e2e pass
rather than riding on #323's large convergence PR (which does the reorg; this does the
renaming/remodeling).

Observations

  • create_post/update_post wire arg is named args ({"args": {…}} on the wire,
    from Remove too_many_arguments #[allow] from the create_post/update_post #[server] fns (#94 follow-up) #299's arg-struct fold). Generic — the endpoint already says it's the arguments.
    → name it for the noun: post ({"post": {…}}), create_post(post: CreatePostArgs).
  • PostResponse is the lone read DTO named by transaction-role. Its siblings are
    DraftSummary / TimelinePostSummary (*Summary). Its own doc says "Details of a
    post." → rename to PostDetails (PostView collides with the render-twin struct).
  • CreatePostResult and UpdatePostResult differ by exactly one field
    (CreatePostResult.created_at) — and created_at may not even be read by the create
    client. They're the same thing (the saved post's identity + links: post_id, slug,
    preview/permalink URLs) wearing two names. → collapse into ONE type named for what it
    is (e.g. SavedPost / PostRef / PostLinks); confirm whether created_at is used
    and drop it if not. PublishPostResult is a genuinely narrower shape (publish always
    yields a published post, so published_at/permalink are non-optional) — either
    fold it into the unified type with optionals or keep it as the one real special case.
  • More broadly: audit the posts DTO family and drop *Result/*Response role-suffixes
    in favor of shape/noun names, consistent with *Summary.

Scope

  • Rename the create_post/update_post wire arg argspost (updates the Rust
    dispatch sites, the TS e2e helpers, and the server integration tests that POST directly
    — same set Remove too_many_arguments #[allow] from the create_post/update_post #[server] fns (#94 follow-up) #299 touched).
  • Rename PostResponsePostDetails (also touches the shared render layer:
    PageSeed::Permalink(PostResponse) in render/mod.rs).
  • Unify CreatePostResult + UpdatePostResult (and consider PublishPostResult) into one
    well-named type; drop the *Result/*Response suffixes across the posts DTOs.

Acceptance

  • No posts DTO named by transaction-role (*Result/*Response); no generic args wire key.
  • One saved-post result type for create/update (publish reconciled).
  • cargo xtask validate green incl. the create/edit/publish/draft posts e2e (the wire
    changes are verified end-to-end).

Notes

Purely naming/modeling — no behavior change. Blocked-by #323 (do it on the converged
layout).

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolingAn issue with the workflow tooling.

    Type

    Projects

    Status
    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions