wealth/docs/decisions/0022-post-rules-live-in-the...

1.2 KiB

0022 Post rules live in the API; the composer mirrors them

Status: Proposed · Area: architecture · Date: 2026-10-07 · Decided by: agent

Context

C4 and C5 set the composer's rules, and the API had none of them: any caption length, any number and type of images, edits at any time, and publishing by any creator with a complete profile.

Decision

  • The API enforces them (back POST_LIMITS): text up to 2000 characters, up to four JPG, PNG or WebP images of 5 MB each, a published post's text, images and access level editable for 15 minutes, and publishing only by an approved creator who isn't suspended. A text post becomes an image post when an image is added, and back when the last is removed; a prediction stays a prediction.
  • The front mirrors the same numbers in features/post POST_LIMITS to check before sending, and treats the API's answer as final (a 403 on save means the window closed).

Alternatives

  • Front-only checks: rejected; another client could break the paywall's promise that a post stays as subscribers read it.

Consequences

Changing a limit is a change in both repos. Existing posts longer than 2000 characters stay as they are; only new writes are checked.