scripts/interop/run.sh brings up Scrobbler (API, worker, UI behind a
throwaway-TLS Caddy) and GoToSocial 0.22.1 on a private .test network,
creates a GoToSocial user, drives its sign-in/OAuth screens for a token,
and checks: lookup by handle, follow accepted, unfollow, manual approval
and approve, remove, block and unblock, and decline.
Found and fixed along the way:
- Keys whose id is a path serving the actor (GoToSocial's
<actor>/main-key) weren't resolved; now all three publishing styles
are handled
- An Undo of an older Follow arriving after a newer Follow removed the
new follower; an Undo now only removes the Follow it names (and Undo
referencing a Follow by id is understood)
- Rejects embedded the Follow, which some servers (GoToSocial) match by
account pair, so a late Reject could cancel a newer request; Rejects
now reference the Follow by id
- Unblocking didn't tell the other server; it now sends Undo(Block)
- Actors publish an (empty) featured collection, which Mastodon and
GoToSocial fetch
GoToSocial 0.22.1 ignores Reject for already-accepted follows (a TODO
in its code, fixed on its main branch); the removal check on its side
is skipped until a release has it (GTS_REJECT_ENDS_FOLLOWS=1 enables).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- /api/v1/federation: list followers and requests, approve (Accept),
decline or remove (Reject), block (Block, and future follows are
refused), list and remove blocks; settings report follower counts
- The actor now reflects the user's real follow-approval setting and
the followers collection its accepted count
- Turning sharing off sends every follower a Reject and forgets them;
while those are being delivered the actor stays fetchable with just
its key (no name or bio) so other servers can verify them, and
WebFinger already says not found
- Web UI: a Followers page (requests with Approve/Decline, followers
with Remove/Block behind a confirm step, blocked accounts with
Unblock; remote names shown as plain text only), follower counts on
the Sharing page, and a confirmation before turning sharing off
when that would remove followers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
Intake (in the request, no network): size, content type and shape
checks, blocked domains refused (403), duplicates acknowledged once,
then stored and answered 202.
Processing (federation.inbox worker task):
- verify the HTTP signature with either scheme, as of when it arrived,
using the cached key and refreshing the sender once on failure (key
rotation); a deleted account's Delete still verifies from cache
- the signer must be the activity's actor and the activity id must be
on the actor's host
- handlers: Follow (accept, or pending with manual approval; repeat
follows re-accepted; blocked accounts rejected), Undo of a Follow
(only by the same actor), Delete of an actor, Update of an actor;
anything else recorded
- items being processed are marked, retried on transient failures,
re-queued if a worker dies, and pruned after 30 days
Outgoing Accept/Reject/Block activities are stored with stable ids and
queued per inbox for the delivery task (next step). Public activities
are fetchable at /activities/<uuid>. Metrics for inbox activities and
signature checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- /api/v1/federation/settings (GET, PATCH): sharing on/off, visibility
(followers-only default), follow approval, discoverable/indexable,
display name and bio, plus the read-only handle and URLs
- /api/v1/federation/profiles/<name>: public profile for the UI page,
only for users sharing
- ActivityPub endpoints documented under an ActivityPub tag
- docs/openapi.json is now exported with every optional module on
(python -m scrobbler.openapi.export); the drift test and route checks
cover both a federation-off and a federation-on app
- Boundary: federation may use scrobbler.api.get_api to register its
blueprint; the checker proves other scrobbler.api modules stay off
limits
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- /api/v1/imports/options lists the available sources; `lastfm` only
appears when the server has a Last.fm API key
- POST /imports/file (multipart; format detected or forced with
?format=), POST /imports/lastfm, GET /imports, GET /imports/{id},
POST /imports/{id}/cancel
- Upload size limit (IMPORT_MAX_BYTES, default 200 MB) with a 413
- Documented in OpenAPI under the Imports tag
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- API image (uv multi-stage, non-root, gunicorn, migrations on start,
health check) and UI image (nginx, CSP, config.js rendered from
API_BASE_URL); /healthz documented in OpenAPI
- docker compose runs db, api and ui; the "monitoring" profile adds
Prometheus, postgres-exporter and Grafana, all provisioned from files
- Grafana dashboards: API overview (RED), Last.fm API, Usage, Database
- Prometheus alert rules: API down, error rate, latency, auth failure
spike, ignored scrobbles, DB pool saturation, Postgres down
- Pool checkout gauge counts events (the pool's own counters lag the
checkin event); error ratios show 0 instead of "No data"
- Tests check dashboards and alerts only use metrics that exist
- scripts/generate_traffic.py drives realistic traffic for demos
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- /2.0/ and /api/auth/ are described from the Last.fm method registry:
method enum, per-method parameter tables, auth requirements, notes,
request schemas and XML example responses
- Readable tags (Auth, Apps, Sessions, Tokens, Stats, Last.fm)
- docs/openapi.json is exported with `flask openapi write`; tests fail
if it drifts from the code, if any route is undocumented, or if a UI
route is missing its bearer-auth security declaration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW