Commit Graph
55 Commits
Author SHA1 Message Date
mattandClaude Opus 5.5 fefdeb90ec Document following on the fediverse; mark phase 2 done (phase 2, step 9)
CI / lint (push) Successful in 11s
CI / federation-interop (push) Successful in 1m3s
CI / test (push) Successful in 2m4s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 9s
CI / notify (push) Successful in 1m20s
CI / images (push) Skipped
README: following works, the Followers page, optional federation
settings and the worker requirement. Federation README: settings,
module layout, worker tasks and the interop test. Design doc: what
interop testing changed. Phase 2 plan marked done with its deviations
(httpcore, no in-process two-instance test, Undo of Block), leaving
only the manual Mastodon check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 22:17:02 +01:00
mattandClaude Opus 5.5 fe95f59fc8 CI: run the GoToSocial interop test
CI / lint (push) Successful in 13s
CI / images (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 8s
CI / federation-interop (push) Successful in 1m9s
CI / test (push) Successful in 2m11s
CI / assets (push) Skipped
CI / python-package (push) Skipped
A federation-interop job runs scripts/interop/run.sh on every push
(not for pull requests from forks), with a per-run compose project and
subnet so concurrent runs can't collide. Publishing waits for it too.

The driver is now an image with the script baked in, and the interop
overlay avoids bind mounts, since CI jobs drive the host's Docker from
inside a container.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 22:13:12 +01:00
mattandClaude Opus 5.5 b93cfea5b3 Interop with a real GoToSocial server, and the fixes it found (phase 2, step 8)
CI / validate-monitoring (push) Successful in 7s
CI / test (push) Successful in 2m16s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / lint (push) Successful in 10s
CI / images (push) Skipped
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
2026-09-25 22:11:39 +01:00
mattandClaude Opus 5.5 ec658a7751 Federation monitoring: followers, inbox and delivery panels, alerts (phase 2, step 7)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 2m2s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
Federation dashboard gains follower and request counts, inbox and
delivery queue depths, activities received by type and result,
incoming signature results by scheme and reason, deliveries by result,
delivery latency and outgoing signature schemes. Every query was run
against a live Prometheus.

Alerts: FederationDeliveryBacklog (>100 waiting for 30m),
FederationInboxBacklog (unprocessed for 15m) and
FederationSignatureFailures (>20% failing for 15m).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 21:44:34 +01:00
mattandClaude Opus 5.5 a90cd14f59 Manage followers from the API and web UI (phase 2, step 6)
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 11s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Successful in 6s
CI / test (push) Successful in 2m4s
CI / python-package (push) Skipped
- /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
2026-09-25 21:42:29 +01:00
mattandClaude Opus 5.5 142dc13fea Deliver outgoing activities with retries (phase 2, step 5)
CI / lint (push) Successful in 9s
CI / test (push) Successful in 1m57s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 8s
The federation.deliver worker task sends queued activities:
- signed POSTs as the user, draft-cavage first and RFC 9421 after a
  401 (double-knocking), several at once (FEDERATION_DELIVERY_
  CONCURRENCY), up to 50 per pass
- 2xx delivered; 410 removes whoever that inbox belongs to as a
  follower and marks them gone; other 4xx (except 401/408/429) are
  abandoned; everything else retries at 1m, 5m, 30m, 2h, 6h, then
  every 12h, abandoned after 2 days
- claiming leases a delivery (pushes its next attempt forward), so a
  crashed worker's sends become due again on their own; claiming
  skips the eager join Postgres can't lock through
- metrics: deliveries by result, delivery time, outgoing signatures,
  queue depths and follower totals (gauges set every 30s)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 21:36:05 +01:00
mattandClaude Opus 5.5 5897e8217f Tests: reuse a pool of RSA keys
CI / lint (push) Successful in 14s
CI / images (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 8s
CI / test (push) Successful in 1m51s
CI / assets (push) Skipped
CI / python-package (push) Skipped
Generating 2048-bit keys for every sharing user and scripted remote
account dominated federation test time. Tests only need distinct valid
keys, so an autouse fixture hands out a pool of 16 generated once per
run (50s -> 40s for the suite).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 21:31:52 +01:00
mattandClaude Opus 5.5 f312c4b577 Inbox: intake and verified processing of follows (phase 2, step 4)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 14s
CI / test (push) Successful in 1m57s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Successful in 6s
CI / python-package (push) Skipped
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
2026-09-25 21:29:55 +01:00
mattandClaude Opus 5.5 c1a7dd0877 Worker tasks are registered per app
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 10s
CI / test (push) Successful in 1m46s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / images (push) Skipped
The task registry was module-global, so tasks registered by an app with
federation enabled would also run under an app without it (and break
the "federation off registers nothing" guarantee depending on order).
Tasks now live on each app (app.extensions["worker_tasks"]);
register_task/register_periodic take the app, and the worker runs the
current app's tasks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 21:24:41 +01:00
mattandClaude Opus 5.5 d49aa72be1 Federation tables for followers, inbox and deliveries (phase 2, step 3)
CI / lint (push) Successful in 11s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / test (push) Successful in 1m42s
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 7s
New tables on the federation migration branch: followers (pending or
accepted, with the Follow activity), per-user blocks, the inbox queue
(raw deliveries awaiting verification, deduplicated by activity id),
our outgoing activities, and deliveries (per inbox, with retry state).

Inbox URLs are capped at 1024 characters (remote actors are validated
against it) so the delivery unique index stays within Postgres's btree
limit; the remote actor inbox columns shrink to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 21:23:15 +01:00
mattandClaude Opus 5.5 52b9f0b27b Safe outbound HTTP and remote actors (phase 2, step 2)
CI / lint (push) Successful in 10s
CI / images (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 7s
CI / test (push) Successful in 1m22s
CI / assets (push) Skipped
CI / python-package (push) Skipped
- net.py: the only client federation uses, on httpcore (BSD-3-Clause)
  with a guarded network backend: https only, every resolved address
  must be public (private, loopback, link-local, CGNAT, multicast and
  IPv4-mapped forms refused), and the connection goes to the checked
  address; 3 redirects max (GET only), 1 MB cap, 10s/20s timeouts
- outbound.py: signed GETs (instance actor, so authorized-fetch servers
  answer) and signed POSTs (as the user), trying the configured
  signature schemes in order and the next only on a 401
- remote.py + federation_remote_actors: fetch, validate (id matches
  URL and host, actor type, inbox on its host, key owned by the actor),
  cache for 24h, refresh on demand, 410 marks an actor gone; resolve a
  key id to its actor, including standalone key documents
- Config: FEDERATION_SIGNATURE_SCHEMES, FEDERATION_BLOCKED_DOMAINS,
  FEDERATION_DELIVERY_CONCURRENCY, and FEDERATION_INSECURE_TESTING
  (http and private addresses; only allowed for .test domains)
- Tests against a real local HTTP server, including verifying that our
  fetches carry a valid signature

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 21:21:00 +01:00
mattandClaude Opus 5.5 a6d3fb6c93 HTTP signatures: draft-cavage and RFC 9421 (phase 2, step 1)
CI / validate-monitoring (push) Successful in 7s
CI / test (push) Successful in 1m6s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / lint (push) Successful in 12s
CI / assets (push) Skipped
Pure code in federation/protocol/signatures, one module per scheme and
a registry to pick them by name:
- draft-cavage: sign (request-target) host date digest with rsa-sha256;
  verify rsa-sha256/hs2019, require the ActivityPub minimum, check
  Digest and a ±12h Date window
- RFC 9421: sign @method @target-uri content-digest with
  rsa-v1_5-sha256 and created/keyid/alg; verify with a generic
  signature-base builder, created/expires checks and Content-Digest
  (sha-256/sha-512); includes the RFC 8941 subset these headers use
- Failures carry a reason (missing, malformed, expired,
  digest_mismatch, bad_signature, unsupported, unknown_key,
  insufficient) for metrics

Tested against the published vectors (draft-cavage-12 C.1 and C.2,
RFC 9421's rsa-v1_5-sha256 example; test keys extracted from the
specs into tests/data), round trips, and tampering with body, URL,
method, date, key, coverage and clock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 21:15:36 +01:00
mattandClaude Opus 5.5 044f25e2fd Plan for ActivityPub phase 2 (followers)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 12s
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / test (push) Successful in 1m3s
CI / images (push) Skipped
CI / assets (push) Skipped
Step-by-step plan: both HTTP signature schemes with test vectors, an
SSRF-safe outbound client and remote-actor cache, follower/inbox/
delivery tables, network-free inbox intake with worker processing,
signed Accept/Reject/Block delivery with retries, follower management
API and UI, metrics/alerts, in-process two-instance tests and a
GoToSocial interop job in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:56:59 +01:00
mattandClaude Opus 5.5 6b09e041b8 Document fediverse sharing; mark phase 1 done (phase 1, step 9)
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 1m7s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / images (push) Skipped
README: what sharing does today, how an operator enables it (settings,
UI forwarding, HTTPS), and the permanence of handles and the key
secret. Federation README: key secret, forwarded paths and module
layout. The phase 1 plan is marked done, with the real-Mastodon check
still outstanding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:37:30 +01:00
mattandClaude Opus 5.5 913ef67aca Federation dashboard (phase 1, step 7)
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 10s
CI / test (push) Successful in 1m5s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Successful in 5s
A fifth provisioned Grafana dashboard: fediverse lookups by kind and
result, sharing switched on/off, federation endpoint rates and p95
latency, and inbox deliveries. Dashboard tests now know federation's
own metrics, and a new test rejects PromQL string escapes Prometheus
can't parse (the endpoint filter first used \. and failed live).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:36:42 +01:00
mattandClaude Opus 5.5 f21ce173b8 Tests don't inherit optional features from the local environment
CI / validate-monitoring (push) Successful in 7s
CI / test (push) Successful in 1m2s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 13s
TestConfig pins FEDERATION_ENABLED off and LASTFM_API_KEY empty, so a
developer's .env (e.g. federation switched on to try it locally) can't
change what the "feature off" tests see. Tests that need a feature turn
it on explicitly (FederatedTestConfig, lastfm_config).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:34:23 +01:00
mattandClaude Opus 5.5 8d12922f6a Serve fediverse paths on the UI's domain (phase 1, step 6)
CI / validate-monitoring (push) Successful in 8s
CI / test (push) Successful in 1m6s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / lint (push) Successful in 12s
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
- The UI container forwards /.well-known/{webfinger,nodeinfo,host-meta},
  /nodeinfo/, /users/, /inbox and /actor to API_INTERNAL_URL (compose:
  http://api:8000), passing Host and X-Forwarded-*; unset means no
  forwarding
- The API's name is resolved per request via the container's resolver,
  so the UI starts before the API and survives API restarts
- Compose passes the FEDERATION_* settings to api and worker;
  .env.example documents them, including FEDERATION_KEY_SECRET
- gunicorn: disable the 26.x control socket (the container user has no
  home directory)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:32:40 +01:00
mattandClaude Opus 5.5 c0b9e85519 Sharing settings and public profile pages (phase 1, step 5)
- sharing.html: switch sharing on/off, see the handle (with the
  "permanent once followed" warning and a note that following comes
  later), choose who sees posts (followers only by default; help text
  on why approval matters), follower approval, directory and search
  opt-ins, display name and bio; save status shown by the button
- profile.html?u=<name>: the public page browsers land on from an actor
  URL: name, handle (with copy), bio and how to follow; never asks the
  visitor to sign in
- "Sharing" appears in the nav only when the server federates
  (remembered per tab)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:32:40 +01:00
mattandClaude Opus 5.5 0b10469514 Sharing settings API, public profiles and ActivityPub docs (phase 1, step 4)
CI / test (push) Successful in 1m5s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 12s
CI / assets (push) Skipped
CI / notify (push) Successful in 5s
- /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
2026-09-25 20:26:33 +01:00
mattandClaude Opus 5.5 ce39e8f865 ActivityPub discovery endpoints (phase 1, step 3)
CI / test (push) Successful in 59s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 11s
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 7s
Registered only when federation is enabled:
- WebFinger (acct: and actor-URL resources, the instance actor, CORS *)
- host-meta, NodeInfo discovery and 2.1 (counts users sharing)
- /users/<name>: the Person actor for ActivityPub clients, a redirect to
  the UI profile page for browsers (for any name, so redirects don't
  reveal accounts); outbox/followers/following collections
- /actor: the instance Application actor
- Inboxes accept (202) and count deliveries; size-limited; processing
  arrives in phase 2. Actors advertise manual approval until then.
- Unknown and non-sharing users get byte-identical 404s; all IDs come
  from FEDERATION_BASE_URL, never the request
- Federation metrics: lookups, sharing changes, inbox deliveries
- scrobbler.__version__ joins the core's public surface for NodeInfo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:23:02 +01:00
mattandClaude Opus 5.5 e890568c54 Federation protocol building blocks (phase 1, step 2)
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 57s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / assets (push) Skipped
Pure, framework-free code in federation/protocol:
- media: ActivityPub content types and Accept negotiation
- vocab: actor URLs, Person and Application actors (Mastodon's extension
  terms), public keys, collections, plain text to safe HTML
- webfinger: acct:/actor-URL resource parsing (other domains and bad
  usernames rejected) and JRD documents
- nodeinfo: discovery and NodeInfo 2.1; hostmeta: XRD pointing at
  WebFinger

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:20:24 +01:00
mattandClaude Opus 5.5 98c65547f3 Federation data and actor keys (phase 1, step 1)
CI / validate-monitoring (push) Successful in 7s
CI / test (push) Successful in 57s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 11s
- federation_settings (per user; off, followers-only, not discoverable
  by default) and federation_keys (RSA-2048; NULL user = instance
  actor), on the federation migration branch
- Private keys encrypted at rest with Fernet, keyed by HKDF-SHA256 from
  FEDERATION_KEY_SECRET (now required, 32+ chars, never printed)
- Keys are created when a user first enables sharing and never
  regenerated; sharing.shared_user() treats unknown and non-sharing
  users identically
- One flask-smorest Api per app (get_api(app)), so apps with and
  without federation never share an OpenAPI spec
- Test fixtures for a second, federation-enabled app on the same DB

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:19:14 +01:00
mattandClaude Opus 5.5 00ad8e9e6d ActivityPub decisions: UI domain, followers-only posts; phase 1 plan
CI / validate-monitoring (push) Successful in 8s
CI / test (push) Successful in 48s
CI / assets (push) Skipped
CI / lint (push) Successful in 13s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
- Handles and actor URLs live on the web UI's domain; the UI's nginx
  forwards the ActivityPub paths to the API
- Posts default to followers only, settable per user, with the privacy
  caveat about automatic follow approval spelled out
- docs/design/activitypub-phase1.md: the discoverable-profile phase,
  step by step

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:10:08 +01:00
mattandClaude Opus 5.5 cae97380fc Mark ActivityPub phase 0 as done
CI / validate-monitoring (push) Successful in 7s
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 11s
CI / test (push) Successful in 47s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:02:09 +01:00
mattandClaude Opus 5.5 eb5802f420 Federation boundary tests (phase 0, step 5)
CI / lint (push) Successful in 12s
CI / test (push) Successful in 48s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 7s
CI / assets (push) Skipped
Static checks (ast, so imports inside functions and relative imports
count): nothing outside scrobbler.federation imports it except
create_app; federation.protocol imports no framework or scrobbler code;
the rest of federation uses only the core's public surface (events,
extensions, worker, services, api.decorators, schemas). The checker is
itself tested against deliberate violations and permitted imports.

Runtime checks: with federation off no federation views, event
receivers or worker tasks exist; enabling it needs a bare domain and
an https base URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:00:56 +01:00
mattandClaude Opus 5.5 c79c42ee00 Federation module skeleton and its own migration branch (phase 0, steps 3-4)
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 12s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / test (push) Successful in 50s
- scrobbler.federation with init_app() as its only entry point, called
  from create_app(); does nothing unless FEDERATION_ENABLED
- FederationConfig validates FEDERATION_DOMAIN (bare host) and
  FEDERATION_BASE_URL (https) when enabled, with clear errors
- federation/protocol/ package for pure, framework-free protocol code
- Package README with the boundary rules, configuration and migration
  workflow; .env.example lists the settings (off)
- Alembic: existing history labelled `core`; new empty `federation`
  branch root (depends on the core users table). Everything upgrades
  `heads` (entrypoint, CI, tests); tests check both branches apply and
  that federation can be removed without touching core

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 19:59:47 +01:00
mattandClaude Opus 5.5 098eab025f Generic background worker (phase 0, step 2)
CI / lint (push) Failing after 38s
CI / images (push) Skipped
CI / validate-monitoring (push) Successful in 8s
CI / notify (push) Successful in 5s
CI / test (push) Successful in 46s
CI / assets (push) Skipped
CI / python-package (push) Skipped
scrobbler/worker.py runs tasks that modules register: queue tasks
(called while they report work) and periodic tasks. A failing task is
logged, counted, rolled back and doesn't stop the others. Imports are
now just a registered task plus a periodic stall check.

- `flask worker` replaces `flask imports worker` (kept as an alias);
  compose uses the new command
- scrobbler_worker_tasks_total{task,outcome} and a Worker tasks panel
  on the Usage dashboard
- WORKER_METRICS_PORT (IMPORT_WORKER_METRICS_PORT still honoured)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 19:57:25 +01:00
mattandClaude Opus 5.5 59ff1bdfa0 Domain events for optional modules (phase 0, step 1)
CI / test (push) Successful in 48s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 9s
CI / images (push) Skipped
CI / notify (push) Successful in 5s
scrobbler/events.py defines blinker signals sent after commit:
scrobbles_stored (newly stored plays only, source scrobble/import),
now_playing_changed (track or None) and import_finished. A receiver
that raises is logged and skipped, so optional modules can't break
scrobbling or imports. store_chunk now reports which plays it stored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 19:54:27 +01:00
mattandClaude Opus 5.5 247c94a79c Plan for ActivityPub phase 0 (groundwork)
CI / test (push) Successful in 44s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / lint (push) Successful in 10s
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 7s
CI / notify (push) Successful in 5s
Step-by-step plan: domain events, a generic worker with imports moved
onto it, the empty federation module and config, separate Alembic
branches, and boundary tests enforcing the module rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 19:52:39 +01:00
mattandClaude Opus 5.5 5d71116613 ActivityPub design: build in-house as one replaceable module
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 9s
CI / lint (push) Successful in 14s
CI / test (push) Successful in 49s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / images (push) Skipped
- Settles build vs buy: write it ourselves (Scrobbler is BSD-3-Clause;
  the Python library option is AGPL)
- New "Module structure" section: everything in scrobbler.federation,
  a pure protocol/ subpackage for spec-dependent code, pluggable
  signature schemes/inbox handlers/post kinds, core → federation only
  via blinker domain events, own federation_* tables in a separate
  Alembic branch, generic task worker, and boundary tests enforcing it
- Adds a groundwork phase 0 and updates the open decisions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 19:48:04 +01:00
matt caf1d3c2f8 Merge branch 'main' into feature/activitypub 2026-09-25 19:47:16 +01:00
mattandClaude Opus 5.5 373efbcb2d License under BSD 3-Clause
CI / lint (push) Successful in 11s
CI / assets (push) Successful in 10s
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 8s
CI / test (push) Successful in 44s
CI / python-package (push) Skipped
CI / images (push) Successful in 1m31s
Adds LICENSE, the licence expression and file in the package metadata,
an OCI licence label on both images, and a Licence section in the README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 19:47:06 +01:00
mattandClaude Opus 5.5 d2c71d50f1 Design proposal: ActivityPub federation
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 11s
CI / test (push) Successful in 44s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 7s
CI / assets (push) Skipped
Research write-up for making Scrobbler users followable from the
fediverse: protocol pieces (WebFinger, actor, inbox, signatures in both
draft-cavage and RFC 9421, delivery), what gets posted (weekly summary,
milestones, now playing), build-vs-library, data model, security,
testing against GoToSocial, phased plan and open decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 19:36:45 +01:00
mattandClaude Opus 5.5 e40a074a64 Import page in the web UI, worker service and import monitoring
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 11s
CI / test (push) Successful in 43s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
- New Import page: upload an export (with upload progress) or, when the
  server has a Last.fm API key, import straight from a Last.fm username;
  jobs list with live progress, counts, errors and cancelling
- docker compose runs the import worker from the API image; the API
  image no longer sets PROMETHEUS_MULTIPROC_DIR (gunicorn.conf.py does,
  and other commands must not inherit multiprocess mode)
- Prometheus scrapes the worker; Usage dashboard gains an Imports row;
  ImportWorkerDown and ImportJobsWaiting alerts
- README and .env.example document imports and LASTFM_API_KEY

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
v0.2.0
2026-09-25 15:10:15 +01:00
mattandClaude Opus 5.5 eebd7b8730 Imports API: upload exports, pull from Last.fm, follow progress
CI / assets (push) Successful in 8s
CI / test (push) Successful in 47s
CI / python-package (push) Skipped
CI / images (push) Successful in 31s
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 9s
CI / lint (push) Successful in 13s
- /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
2026-09-25 15:04:15 +01:00
mattandClaude Opus 5.5 6fc9d91fa2 History imports: parsers, import jobs and the import worker
CI / test (push) Successful in 41s
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 10s
CI / notify (push) Successful in 7s
CI / assets (push) Successful in 8s
CI / python-package (push) Skipped
CI / images (push) Successful in 28s
- Import jobs (import_jobs table): uploaded exports stored gzipped,
  processed by `flask imports worker`, which claims jobs with
  SKIP LOCKED, inserts in chunks with progress, supports cancelling and
  re-queues jobs whose worker died
- CSV: lastfm-to-csv (no header) or any header-labelled CSV/TSV with
  comma, semicolon or tab delimiters; several date formats and Unix
  seconds/milliseconds
- JSON: pages of user.getRecentTracks (e.g. lastfm.ghan.nl), a single
  recenttracks response, or a flat list; gzipped files accepted
- Last.fm API pull (only when LASTFM_API_KEY is set): pages through
  user.getRecentTracks up to the job's creation time, rate limited,
  with retries and resume
- Imports keep plays older than 14 days, skip empty/future ones and
  dedupe against existing history
- Import metrics and pending/running job gauges

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 15:02:31 +01:00
mattandClaude Opus 5.5 e29abe05dd Rename the Python distribution to scrobby
CI / assets (push) Successful in 8s
CI / images (push) Successful in 31s
CI / notify (push) Successful in 5s
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 36s
`scrobbler` on public PyPI is an unrelated project, so installing with
PyPI as an extra index could pick up the wrong package. The import name
stays `scrobbler`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:58:29 +01:00
mattandClaude Opus 5.5 40f1974f3d CI: upload assets with POST (overwrites) and correct content types
CI / images (push) Successful in 27s
CI / validate-monitoring (push) Successful in 7s
CI / assets (push) Successful in 6s
CI / notify (push) Successful in 5s
CI / python-package (push) Successful in 11s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
v0.1.0
2026-09-25 14:33:49 +01:00
mattandClaude Opus 5.5 a461fcdcef Include README in the API image build (it is now the package readme)
CI / validate-monitoring (push) Successful in 7s
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / assets (push) Failing after 4s
CI / images (push) Successful in 39s
CI / lint (push) Successful in 11s
CI / test (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:31:37 +01:00
mattandClaude Opus 5.5 c44f7ec722 Publish images, assets and the Python package from CI
CI / test (push) Successful in 37s
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 10s
CI / assets (push) Successful in 8s
CI / images (push) Failing after 21s
- Pushes to main and v* tags publish only after every check passes:
  API and UI images to the ProGet Docker feed, the OpenAPI spec,
  dashboards and Prometheus config to the asset feed
- v* tags also publish the wheel/sdist to the ProGet PyPI feed
- The version comes from the tag (main builds: <version>+g<sha>) and
  __version__ reads it from package metadata
- One ntfy notification per run summarising every job that ran and
  the image tags published

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:29:49 +01:00
mattandClaude Opus 5.5 d7c6830cf7 pylast end-to-end compatibility test and README
CI / validate-monitoring (push) Successful in 6s
CI / lint (push) Successful in 10s
CI / test (push) Successful in 39s
CI / notify (push) Successful in 5s
- Serves the app over HTTPS with a throwaway certificate and drives it
  with pylast: web-auth sign-in, now playing, single and batch
  scrobbles (non-ASCII too), recent tracks, top artists, play count,
  and Last.fm error codes surfacing as pylast WSError
- README: architecture, running with compose, configuration, connecting
  players, development workflow, monitoring and CI/CD

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:28:17 +01:00
mattandClaude Opus 5.5 0a1685e80e CI: validate Prometheus config, alert rules and dashboards
CI / lint (push) Successful in 11s
CI / test (push) Successful in 35s
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 8s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:26:36 +01:00
mattandClaude Opus 5.5 ea705589f1 Monitoring stack, containers and dashboards
CI / lint (push) Successful in 9s
CI / test (push) Successful in 36s
CI / notify (push) Successful in 5s
- 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
2026-09-25 14:26:19 +01:00
mattandClaude Opus 5.5 faa74871a5 Metrics: database timing, pool state, DB-backed gauges, gunicorn
CI / test (push) Successful in 39s
CI / lint (push) Successful in 11s
CI / notify (push) Successful in 5s
- Statement latency by operation and connection-pool gauges via
  SQLAlchemy events
- Users, active users (1h/24h/7d) and now-playing gauges computed at
  scrape time, cached for 60s, from a NullPool engine that is safe in
  the gunicorn master; exports nothing (not an error) if the DB is down
- gunicorn.conf.py: multiprocess metrics aggregated across workers and
  served by the master on METRICS_PORT, stale files cleared at start,
  dead workers marked
- Tests cover labels, in-flight gauge, DB metrics, the collector and a
  real two-worker gunicorn aggregation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:15:30 +01:00
mattandClaude Opus 5.5 89f8589424 OpenAPI: document the Last.fm API and commit the exported spec
CI / test (push) Successful in 30s
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 10s
- /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
2026-09-25 14:13:47 +01:00
mattandClaude Opus 5.5 b509cd2b60 Web UI: static HTML/CSS/JS frontend, hosted separately from the API
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 9s
CI / test (push) Successful in 31s
- Plain HTML + vanilla JS modules, no build step; talks to /api/v1 with
  a bearer token and only ever inserts server data as text
- Overview: now-playing dot-matrix display with live progress, totals,
  30-day plays meter, top artists/tracks by period, recent plays
- History (paged, grouped by day), Apps (create/delete, reveal/copy
  keys, player setup details), Sessions (revoke), sign-in approval page
  for the Last.fm desktop auth flow, sign in and registration
- Light and dark themes, responsive to phone widths, vendored fonts
  (SIL OFL) so the UI has no third-party requests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:11:37 +01:00
mattandClaude Opus 5.5 0d49311848 Listening stats: Last.fm user.* methods and /api/v1/me
CI / test (push) Successful in 30s
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 12s
- Stats service shared by both APIs: recent scrobbles, top artists,
  albums and tracks over Last.fm periods, per-day/week/month counts
  (with empty days filled) and totals
- Case-insensitive grouping that displays the most common spelling
- user.getInfo, user.getRecentTracks (now playing first, from/to),
  user.getTopArtists/Albums/Tracks with Last.fm paging attributes
- /api/v1/me: now-playing, recent, top/{artists,albums,tracks},
  counts and summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:05:20 +01:00
mattandClaude Opus 5.5 2702815a1e Scrobbling and now-playing
CI / lint (push) Successful in 12s
CI / notify (push) Successful in 5s
CI / test (push) Successful in 27s
- track.scrobble: batches of up to 50 (array params or a single track),
  Last.fm ignore rules (empty artist/track, too old, too new), duplicate
  submissions accepted but stored once
- track.updateNowPlaying: upserted per user, expiring after the track's
  duration; cleared when the same track is scrobbled
- Scrobble result, ignore reason, batch size, lag and now-playing metrics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 14:02:42 +01:00
mattandClaude Opus 5.5 7622f7433a Last.fm auth: mobile sessions and the desktop token flow
CI / test (push) Successful in 25s
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 9s
- auth.getMobileSession (username + password), auth.getToken and
  auth.getSession with Last.fm error codes 4/14/15
- /api/auth/ redirects clients' approval links to the web UI's
  approve page; /api/v1/tokens lets the UI show and approve a token
- Tokens expire after an hour, are single use and bound to their app
- The legacy md5 authToken form is deliberately unsupported (it needs
  unsalted password hashes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 14:01:12 +01:00
mattandClaude Opus 5.5 e026e56ee3 UI REST API: accounts, bearer auth, API apps, sessions, OpenAPI docs
CI / lint (push) Successful in 14s
CI / test (push) Successful in 28s
CI / notify (push) Successful in 5s
- flask-smorest API under /api/v1 with a uniform JSON error shape;
  spec at /api/openapi.json, Swagger UI at /api/docs, ReDoc at /api/redoc
- Register/login/logout/me with hashed, expiring bearer tokens,
  documented as an OpenAPI bearer security scheme
- API application and client-session management endpoints
- CORS restricted to the configured UI origin(s)
- Flask no longer serves static files: it is API-only
- Login and registration metrics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 13:59:59 +01:00