feat: backfeed of responses to crossposts (v2.13.0)

Likes, reposts, quotes and replies to a note's GoToSocial, Bluesky and
Threads copies are read back from the silos and stored as webmentions
(ADR-073): age-based schedule to 90 days, pruning of withdrawn responses,
#nobridge/#nobot opt-outs, admin backfill and Check now, Threads counts,
a Quotes group, local avatar copies, and delete tombstones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-10 12:19:57 -07:00
1 parent 6aaac982d5
commit 55ce6a1fdd
27 files changed
+1763 -40

No files matched your search

+5 -1
View File
@@ -21,7 +21,7 @@ is in `../architecture/`; decisions are in `../decisions/` (ADRs).
## Contents
[v1.0.0](#v100) · [v1.1.1](#v111) · [v1.1.2](#v112) · [v1.2.0](#v120) · [v1.3.0](#v130) · [v1.3.1](#v131) · [v1.4.0](#v140) · [v1.4.1](#v141) · [v1.4.2](#v142) · [v1.5.0](#v150) · [v1.6.0](#v160) · [v2.0.0](#v200) · [v2.0.1](#v201) · [v2.0.2](#v202) · [v2.1.0](#v210) · [v2.2.0](#v220) · [v2.3.0](#v230) · [v2.3.1](#v231) · [v2.3.2](#v232) · [v2.3.3](#v233) · [v2.4.0](#v240) · [v2.5.0](#v250) · [v2.6.0](#v260) · [v2.6.1](#v261) · [v2.6.2](#v262) · [v2.6.3](#v263) · [v2.6.4](#v264) · [v2.6.5](#v265) · [v2.6.6](#v266) · [v2.6.7](#v267) · [v2.6.8](#v268) · [v2.6.9](#v269) · [v2.7.0](#v270) · [v2.7.1](#v271) · [v2.7.2](#v272) · [v2.8.0](#v280) · [v2.8.1](#v281) · [v2.9.0](#v290) · [v2.10.0](#v2100) · [v2.10.1](#v2101) · [v2.10.2](#v2102) · [v2.11.0](#v2110) · [v2.12.0](#v2120) · [v2.12.1](#v2121) · [hotfix](#hotfix)
[v1.0.0](#v100) · [v1.1.1](#v111) · [v1.1.2](#v112) · [v1.2.0](#v120) · [v1.3.0](#v130) · [v1.3.1](#v131) · [v1.4.0](#v140) · [v1.4.1](#v141) · [v1.4.2](#v142) · [v1.5.0](#v150) · [v1.6.0](#v160) · [v2.0.0](#v200) · [v2.0.1](#v201) · [v2.0.2](#v202) · [v2.1.0](#v210) · [v2.2.0](#v220) · [v2.3.0](#v230) · [v2.3.1](#v231) · [v2.3.2](#v232) · [v2.3.3](#v233) · [v2.4.0](#v240) · [v2.5.0](#v250) · [v2.6.0](#v260) · [v2.6.1](#v261) · [v2.6.2](#v262) · [v2.6.3](#v263) · [v2.6.4](#v264) · [v2.6.5](#v265) · [v2.6.6](#v266) · [v2.6.7](#v267) · [v2.6.8](#v268) · [v2.6.9](#v269) · [v2.7.0](#v270) · [v2.7.1](#v271) · [v2.7.2](#v272) · [v2.8.0](#v280) · [v2.8.1](#v281) · [v2.9.0](#v290) · [v2.10.0](#v2100) · [v2.10.1](#v2101) · [v2.10.2](#v2102) · [v2.11.0](#v2110) · [v2.12.0](#v2120) · [v2.12.1](#v2121) · [v2.13.0](#v2130) · [hotfix](#hotfix)
## v1.0.0
@@ -422,6 +422,10 @@ OIDC admin login and built-in IndieAuth server.
- [2026-11-10-category-unused-tags.md](v2.12.1/2026-11-10-category-unused-tags.md) - q=category lists only tags on posts that exist
## v2.13.0
- [2026-11-10-backfeed.md](v2.13.0/2026-11-10-backfeed.md) - Backfeed of responses to crossposts (ADR-073), avatar cache, delete tombstones
## hotfix
Not a release folder.
@@ -0,0 +1,52 @@
# v2.13.0: Backfeed (implementation report)
Implements ADR-073.
## What changed
- `migrations/020_backfeed.sql`: `webmentions` rebuilt with `origin`,
`remote_id` and the `quote` type (rows copied, indexes recreated, plus
`(target_note_id, origin)`); `syndications` gains the `backfeed_*`
columns and Threads counts.
- `starpunk/backfeed.py` (new): `Response`/`Harvest`, schedule, lease,
storing and pruning, opt-outs, backfill, `check_now`, `status`.
- `starpunk/syndication.py`: `responses()` on `MastodonClient`,
`BlueskyClient` and `ThreadsClient`; HTTP status kept on errors
(`exc.status`) so refused credentials can be told apart; Mastodon `_call`
accepts absolute URLs (pagination links); the worker loop runs backfeed
after crossposts; Threads host is `graph.threads.com`.
- `starpunk/avatars.py` (new) and `/avatars/<name>`: local avatar copies
for every response; `local_avatar` template filter.
- Webmentions: Quotes group and "via" label; admin delete is a tombstone
(`moderation_status = 'deleted'`, hidden from the list unless filtered);
origin filter; a webmention can't reset a backfed row, and one whose
source is an already backfed response is rejected ("Already backfed").
- Admin: Backfeed panel with **Backfill responses** on the Webmentions
page; **Check now** and last-checked time per crosspost on the edit page.
- Settings `BACKFEED_ENABLED` (default false), `BACKFEED_MAX_AGE_DAYS` (90).
## Verification
- `tests/test_backfeed.py` (21 tests): schedule; text/facet HTML; storing,
updating and moderation kept; pruning only on complete harvests and
restoring; opt-outs; tombstones; backfill and its pacing; likes/reposts
and drafts skipped; refused credentials; backoff; note page (via label,
quotes, Threads counts, local avatars); avatar save/serve/cleanup;
webmention can't overwrite a backfed row; the three clients against fake
APIs; migration 020 on a pre-020 database keeps rows and foreign keys;
the admin Backfeed panel, backfill and Check now.
- Tests for the touched areas (webmentions, syndication, microformats,
migrations, templates, routes): all pass. The full suite runs in CI.
- `test_microformats_v280` expects response authors' `u-photo`: kept via
`<data class="u-photo">` until the avatar is saved.
## Deploying
1. Issue a new GoToSocial token with `read:statuses read:accounts` added
to the current scopes, and re-authorise the Threads app with
`threads_read_replies` and `threads_manage_insights`. Put both in the
Ansible vault.
2. Set `BACKFEED_ENABLED=true` in the StarPunk environment and deploy
(migration 020 runs at start: back up the database first).
3. Run **Backfill responses** once from Admin → Webmentions. Turn Bridgy
off for the Mastodon and Bluesky accounts.