Docs for phase 3: what gets posted, the publishing plug-ins (step 11)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 16s
CI / federation-interop (push) Successful in 1m8s
CI / test (push) Successful in 2m55s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 16s
CI / federation-interop (push) Successful in 1m8s
CI / test (push) Successful in 2m55s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
README: the fediverse section now describes what's actually posted (weekly summaries, milestones) and their settings, instead of pointing at "still being built"; notes now playing is the one piece left. federation/README.md: a new Publishing section explains the plug-in shape (base.py owns idempotent publish/delete/fan-out; each kind - weekly.py, milestones.py - only decides when to post and what to say), so adding a third kind later means adding a module, not touching base.py. Worker tasks and layout tables updated for federation.weekly, federation.milestones and cli.py. Interop section covers the new post check. docs/design/activitypub-phase3.md marked done, following the precedent from phases 1-2's own docs, with the three points where implementation diverged from the written plan (the top-10-needs-a-real-top-10 fix, post_now() as a separate window computation, and post_page_url() needing the username). docs/openapi.json unchanged - still current from step 8. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
1 parent
860d4d0f93
commit
e0423d04bc
3 files changed
+60
-5
No files matched your search
@@ -60,18 +60,58 @@ Every ActivityPub ID is built from `FEDERATION_BASE_URL`, never from the incomin
|
||||
| `keys.py` | Key pairs, created once and encrypted at rest |
|
||||
| `sharing.py` | Per-user settings, and who is sharing |
|
||||
| `ids.py` | Our ActivityPub ids, all from `FEDERATION_BASE_URL` |
|
||||
| `web.py` | The endpoints other servers call |
|
||||
| `web.py` | The endpoints other servers call, including a paged outbox and individual posts |
|
||||
| `api.py` and `schemas.py` | `/api/v1/federation/*` for the web UI |
|
||||
| `openapi.py` | OpenAPI descriptions of `web.py`'s endpoints |
|
||||
| `metrics.py` | Federation's own Prometheus metrics |
|
||||
| `cli.py` | `flask federation ...` admin commands |
|
||||
| `publishing/` | Posts: shared publish/delete machinery, and one module per kind (see below) |
|
||||
|
||||
## Publishing
|
||||
|
||||
`publishing/base.py` is the only place that knows how to actually post: build the
|
||||
`Note`/`Create`, store it, address it from the user's current visibility, and fan it out
|
||||
to accepted followers' inboxes. It's idempotent (one row per `(user, kind:key)`, via
|
||||
`federation_posts`' unique constraint) and used for both publishing and deleting.
|
||||
|
||||
Each *kind* of post is its own small module that only decides **when** to post and what
|
||||
the text says, then calls into `base.py`:
|
||||
|
||||
- `publishing/weekly.py`: once a week (`check_and_post`/`check_all`, the
|
||||
`federation.weekly` worker task), for the Monday–Sunday week whose posting gate has
|
||||
passed. `post_now()` instead posts the week still in progress immediately, ignoring the
|
||||
gate — used by `flask federation post-weekly --user <name> --now` and `preview()` (a
|
||||
read-only variant for the Sharing page's live preview, never stored).
|
||||
- `publishing/milestones.py`: scrobble-count, artist-plays and top-10-entry thresholds,
|
||||
each posted once. A live scrobble queues a `FederationPendingCheck` row (collapsing
|
||||
repeats), drained by the `federation.milestones` worker task. `set_baseline()` marks
|
||||
every threshold already passed without posting, called when a user turns sharing on
|
||||
and after an import finishes, so old history never produces a burst of "milestone"
|
||||
posts.
|
||||
|
||||
Adding a third kind (e.g. now playing) means adding another module here with the same
|
||||
shape — decide when, build the text, call `publishing.publish()` — not touching
|
||||
`base.py`.
|
||||
|
||||
## Worker tasks
|
||||
|
||||
`federation.inbox` (process received activities), `federation.deliver` (send queued ones), `federation.inbox.maintenance` (re-queue stalled, prune after 30 days) and `federation.gauges` (queue and follower gauges). All are registered only when federation is on.
|
||||
`federation.inbox` (process received activities), `federation.deliver` (send queued
|
||||
ones), `federation.inbox.maintenance` (re-queue stalled, prune after 30 days),
|
||||
`federation.gauges` (queue and follower gauges), `federation.milestones` (drain pending
|
||||
milestone checks) and `federation.weekly` (check every sharing user for a due weekly
|
||||
summary, every 15 minutes). All are registered only when federation is on.
|
||||
|
||||
## Interop
|
||||
|
||||
`scripts/interop/run.sh` runs Scrobbler against a real GoToSocial server on a private `.test` network and checks the whole follow life cycle. CI runs it on every push. GoToSocial 0.22.1 ignores a Reject of an already-accepted follow (a TODO in its code, fixed on its main branch), so that one check on its side is skipped until a release includes the fix.
|
||||
`scripts/interop/run.sh` runs Scrobbler against a real GoToSocial server on a private
|
||||
`.test` network. `scripts/interop/gotosocial_interop.py` checks the whole follow life
|
||||
cycle, then `run.sh` seeds a scrobble, runs `flask federation post-weekly --now` directly
|
||||
in the `api` container, and runs the driver a second time (`--check-posts`) to confirm
|
||||
the post reaches GoToSocial's home timeline with the right content and `private`
|
||||
(followers-only) visibility, and disappears from it once deleted. CI runs the whole
|
||||
thing on every push. GoToSocial 0.22.1 ignores a Reject of an already-accepted follow (a
|
||||
TODO in its code, fixed on its main branch), so that one check on its side is skipped
|
||||
until a release includes the fix.
|
||||
|
||||
## Migrations
|
||||
|
||||
|
||||
Reference in new issue
Block a user