ADR 0360: A Mastodon announcement is one status with the link written into it, at the deployer's visibility, checked against the instance's own limits
- Status: Accepted
- Date: 2026-10-29
- Parent epic: #382
- Story: #392 (tasks DIST2.2.2 and DIST2.2.3)
Context#
ADR 0359 connects a Mastodon account. The delivery worker calls a provider only through the adapter interface of
social-delivery.mjs (ADRs 0316 to 0319): publish resolves only for a success the provider confirmed and named,
everything else is a typed DeliveryError, and an optional reconcile looks an uncertain attempt up.
What Mastodon documents, checked on 2026-10-29:
- Statuses:
POST /api/v1/statusestakesstatus,media_ids[],visibility(public,unlisted,private,direct),languageandspoiler_text, and answers 200 with the Status (itsidand itsaccount), 401 for a bad token and 422 for a refused one. TheIdempotency-Keyheader "prevent[s] duplicate submissions of the same status"; keys are kept "for up to 1 hour".GET /api/v1/statuses/:id/source(3.5.0+,read:statuses) answers the status's plaintext. - API guidelines: status
contentis sanitized HTML, never the text sent; "URLs in text always count for 23 characters"; ids are strings to be treated as opaque. - Instance: the limits come from
GET /api/v2/instance(max_characters500 by default,characters_reserved_per_url23,description_limit1500,image_size_limit,supported_mime_types). - Media:
POST /api/v2/mediatakes a multipartfileand a plaindescription"for accessibility purposes", answers 200 when processed (small images, 4.0.0+) or 202 while still processing, andGET /api/v1/media/:idanswers 206 until it is ready. - Accounts:
GET /api/v1/accounts/:id/statusestakeslimit(at most 40) andexclude_reblogs. - Rate limits: 300 calls per 5 minutes per account,
POST /api/v1/media30 per 30 minutes;X-RateLimit-Resetis the time the limit resets. - PreviewCard: the card Mastodon makes from a link has an
imagebut no description of it.
Decision#
- One status: the caption, a blank line, the canonical link. Mastodon has no separate link field and makes its
own preview card from a link in the text, so the adapter writes the canonical URL after the caption, unless the
caption already holds that exact link as a word. Hashtags and
@user@instancementions in the caption are Mastodon's to read, as the author wrote them; the composer's preview says a mention notifies that person. Nolanguage,spoiler_textor poll is sent. - Visibility is the deployer's choice.
OPENBLOG_SOCIAL_MASTODON_VISIBILITYispublic(the default),unlistedorprivate(followers only); anything else,directincluded, keeps Mastodon off with the setting named.directwould message the people a caption mentions instead of announcing anything. A choice per announcement would need a new column; it is not made here. - Length as Mastodon counts it, against the instance's own limit. The announcement model gives Mastodon a caption
limit of 475 characters in both halves (
social_schedule.rs,social-schedule.mjs, held totests/fixtures/social-schedule.json): 500, the default status limit, less the blank line and the link counted as 23. Admin's composer counts against 475. Before each post the adapter reads the instance's limits (public, no token; Mastodon's defaults when it does not answer) and counts the status as Mastodon does, every URL ascharacters_reserved_per_url; a status overmax_charactersisrejectedwithout a call. Mentions are counted at full length, which is never short. The manifest declaresmaxTextChars: 475and theoauth2login with the two required scopes, in both halves and the fixture. - An Idempotency-Key per announcement. Every attempt sends
Idempotency-Key: openblog-<48 hex>, a SHA-256 of the announcement's idempotency key (never the key itself), so a repeat within Mastodon's hour returns the status already made instead of a second one. This narrows harm only: the worker still never retries an uncertain attempt blindly (ADR 0318). - The cover image, with its description, only when asked for and only when it has one. With
OPENBLOG_SOCIAL_MASTODON_MEDIA=coverthe adapter reads the canonical page (the post's public page, without a token) forog:imageandog:image:alt, which the engine writes from the post'scoverandcoverAlt. The image is attached only when it ishttpson the page's own origin, has a description of at most the instance'sdescription_limitcharacters with no control characters, is a JPEG, PNG, WebP or GIF the instance takes, and is no larger than itsimage_size_limitor 8 MiB. It is uploaded withPOST /api/v2/mediaand the description, and, if it answers 202, looked at twice more, half a second apart. Anything short of a ready upload leaves the image out and the status goes as text with Mastodon's own card; an image is never posted without its description. A 401 on the upload isauth. The cover gets at most 6 seconds; because the whole delivery shares one provider timeout,coveris refused (the settings are named and media stays off) unlessOPENBLOG_SOCIAL_PROVIDER_TIMEOUT_SECONDSis at least 15. The manifest still saysimage: manual: an announcement cannot ask for an image of its own. - The status id is the provider post id. A 200 counts only when it names an
idof the opaque id shape and the status'saccount.idis the connected account; any other 2xx, a 3xx or a 5xx isuncertain. 401 isauth(the account is flagged for reconnecting, ADR 0319); 429 israte-limited, honouringRetry-Afterand otherwise the ISO 8601X-RateLimit-Reset; 422 and other 4xx arerejected. Mastodon's error text is never read. - Reconcile reads the account's own statuses back as text.
reconcilelists the account's latest 40 statuses (exclude_reblogs) and keeps those created during the attempt, give or take two minutes (up to 15 minutes when the attempt has no recorded end). Each one in the window, at most five, is read back with/source; exactly one whose text is the status this announcement sends ispublished.absentis conclusive only when the window holds no status of the account at all and the page reaches back past it. Anything else (two matches, a status that differs, more than five, a missingread:statuses, any failure) isunknown, which the worker keeps looking at and then hands to a person (ADR 0318).
Consequences#
- A long caption that fits the default 500 can still be refused by an instance with a lower limit; Admin says so when
the account is connected (
instance-limit-low) and the delivery isrejectedwithout a call. - An instance with a higher limit takes no more than 475 characters of caption from open.blog.
- With the cover on, Mastodon shows the image and its description instead of its link card; the link stays in the text. Without it, Mastodon's card shows the cover with no description, which is Mastodon's own behaviour.
- A post whose status was edited on Mastodon after it was sent, or that another app posted with the same text in the window, goes to a person rather than being guessed at.