diff --git a/CHANGELOG.md b/CHANGELOG.md index bec96f4..7bb73c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.6.2] - 2026-11-01 + +### Fixed + +- New notes failed their first Threads crosspost with "Invalid Link Attachment" (Meta rejects an explicit link preview for a page it hasn't fetched yet) and only went out on the retry a minute later. StarPunk no longer sends the explicit link preview; Threads still shows one, built from the note's link in the text + ## [2.6.1] - 2026-11-01 ### Fixed diff --git a/docs/decisions/ADR-069-threads-syndication.md b/docs/decisions/ADR-069-threads-syndication.md index 813c225..b7a3a29 100644 --- a/docs/decisions/ADR-069-threads-syndication.md +++ b/docs/decisions/ADR-069-threads-syndication.md @@ -22,8 +22,11 @@ ADR-065 and ADR-066 crosspost notes to GoToSocial and Bluesky. Threads token replaces the saved one. A file lock stops gunicorn workers from refreshing at the same time. The file avoids a migration for one value. 3. **Posting.** Create a container, poll its status until `FINISHED`, then - `threads_publish`. Text-only notes are `TEXT` posts with the permalink as - `link_attachment`. One image is an `IMAGE` post and 2–4 images are a + `threads_publish`. Text-only notes are `TEXT` posts. Threads previews + the first link in the text (the permalink) by itself. An explicit + `link_attachment` is not sent, because Meta rejects one for a page it + hasn't fetched yet ("Invalid Link Attachment", subcode 4279047), which + is always the case for a new note (v2.6.2). One image is an `IMAGE` post and 2–4 images are a `CAROUSEL`. Meta fetches images from their public `/media/` URL. Only JPEG and PNG up to 8 MB are allowed, so GIF and WebP images are left off. Alt text goes in `alt_text`. diff --git a/starpunk/__init__.py b/starpunk/__init__.py index 62cfbda..ad10fe5 100644 --- a/starpunk/__init__.py +++ b/starpunk/__init__.py @@ -464,5 +464,5 @@ def create_app(config=None): # Package version (Semantic Versioning 2.0.0) # See docs/standards/versioning-strategy.md for details -__version__ = "2.6.1" -__version_info__ = (2, 6, 1) +__version__ = "2.6.2" +__version_info__ = (2, 6, 2) diff --git a/starpunk/syndication.py b/starpunk/syndication.py index 7107733..82fd5bb 100644 --- a/starpunk/syndication.py +++ b/starpunk/syndication.py @@ -606,9 +606,9 @@ class ThreadsClient: def _container(self, uid: str, post: "Post") -> str: if post.kind == "repost": - # No native repost of outside content: post "🔁 title url" with a link preview + # No native repost of outside content: post "🔁 title url" return self._call("POST", f"{uid}/threads", media_type="TEXT", - text=self._repost_text(post), link_attachment=post.target_url)["id"] + text=self._repost_text(post))["id"] common = {"text": self._text(post)} topic = threads_topic(post.tags) if topic: @@ -617,8 +617,10 @@ class ThreadsClient: images = [m for m in post.media if m["mime_type"] in THREADS_IMAGE_TYPES and Path(m["path"]).stat().st_size <= THREADS_IMAGE_LIMIT] if not images: - return self._call("POST", f"{uid}/threads", media_type="TEXT", - link_attachment=post.permalink, **common)["id"] + # No explicit link_attachment: Meta rejects one for a page it hasn't + # seen yet ("Invalid Link Attachment"), but previews the text's + # first link by itself without failing + return self._call("POST", f"{uid}/threads", media_type="TEXT", **common)["id"] if len(images) == 1: return self._image_container(uid, images[0], **common) children = [self._image_container(uid, m, is_carousel_item="true") for m in images] diff --git a/tests/test_syndication_threads.py b/tests/test_syndication_threads.py index 0a55576..4fe9b39 100644 --- a/tests/test_syndication_threads.py +++ b/tests/test_syndication_threads.py @@ -180,7 +180,7 @@ class TestLifecycle: permalink = f"https://blog.example.com/note/{note.slug}" assert post["media_type"] == "TEXT" assert post["text"] == f"Hello Threads\n\n{permalink}" - assert post["link_attachment"] == permalink + assert "link_attachment" not in post # Threads previews the first link itself assert post["topic_tag"] == "IndieWeb" r = row(app, note) assert r["state"] == "synced" @@ -391,7 +391,7 @@ class TestLikesReposts: self._post(app, monkeypatch, repost_of=self.PAGE) post = only_post(api) assert post["text"].startswith("🔁") and self.PAGE in post["text"] - assert post["link_attachment"] == self.PAGE + assert "link_attachment" not in post def test_repost_with_comment_keeps_comment(self, app, api, monkeypatch): note = self._post(app, monkeypatch, content="So **true**", repost_of=self.PAGE)