Commit Graph
76 Commits
Author SHA1 Message Date
mattandClaude Sonnet 5 f3d2b5d578 Dashboard panel for profile updates (phase 4, step 6)
CI / validate-monitoring (push) Successful in 8s
CI / federation-interop (push) Successful in 1m8s
CI / test (push) Successful in 3m33s
CI / python-package (push) Skipped
CI / notify (push) Successful in 1m20s
CI / lint (push) Failing after 2m10s
CI / images (push) Skipped
CI / assets (push) Skipped
One new panel on the Federation dashboard's existing Posts row:
profile updates/min by result (sent/throttled). now_playing posts
already show up in the Posts / min by kind panel from phase 3, under
kind="now_playing" - no changes needed there.

No new alert: unlike weekly summaries, now playing is opt-in and most
instances will have nobody using it, so there's no "should always be
producing something" baseline to alert on the way
FederationWeeklySummariesMissing does.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 17:24:17 +01:00
mattandClaude Sonnet 5 f04e53a972 Web UI for now playing (phase 4, step 5)
CI / lint (push) Successful in 21s
CI / federation-interop (push) Successful in 1m21s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 14s
CI / test (push) Successful in 4m2s
CI / assets (push) Skipped
CI / notify (push) Successful in 6s
Sharing page gets a "Now playing" section: off / show on profile /
show on profile and post, as a single choice matching the settings
column - generalised sharing.js's visibility-only radio-group handling
to a small RADIO_GROUPS list so now_playing_mode reuses the same fill/
save logic rather than adding a second special case.

Public profile API and profile.html gain a live "now playing" field,
sourced from the same actors.now_playing_text() the actor document
uses and gated the same way (now_playing_mode off means never showing
it, whatever's actually playing).

Refactored actors.py along the way: now_playing_field() takes settings
directly and does its own off-mode gating, rather than build_document()
doing it externally - one place decides whether the field is shown,
reused by the actor document, the push Update, and now the public
profile API.

Verified by hand in a real browser: settings round-trip through the
Sharing page's new radio group, the public profile page shows "Now
playing: Reckoner by Radiohead" once now_playing_mode is on, and the
raw actor document (curl, Accept: application/activity+json) carries
the same PropertyValue attachment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 17:22:02 +01:00
mattandClaude Sonnet 5 515acae233 Settings API and schema for now_playing_mode (phase 4, step 4)
CI / test (push) Successful in 3m39s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / lint (push) Successful in 13s
CI / validate-monitoring (push) Successful in 40s
CI / federation-interop (push) Successful in 1m8s
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
now_playing_mode was already in sharing.EDITABLE (step 1), so
_settings_body() was already returning it - but SharingSettingsSchema
never declared the field, so marshmallow was silently dropping it from
every response. Same class of gap phase 3 hit with timezone/
post_weekly_summary/post_milestones.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 17:15:51 +01:00
mattandClaude Sonnet 5 ba30d5cb15 Now-playing publisher and worker task (phase 4, step 3)
CI / lint (push) Successful in 11s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 8s
CI / federation-interop (push) Successful in 1m7s
CI / test (push) Successful in 3m15s
CI / assets (push) Skipped
publishing/now_playing.py: a periodic scan (federation.now_playing,
every 30s) that pushes a throttled Update(Person) for the profile
field (5 minutes) and, for users opted into posts, publishes a Note
after a track's been playing 30+ seconds (throttled to 30 minutes),
deleting the previous now-playing post once the new one is confirmed
published - not before, so a failed publish never leaves a user with
none showing. Reuses publishing.publish()/delete_post() unchanged;
now_playing is just another post kind.

Fixed a real bug before it ever ran against Postgres: the key
(artist/track/started_at) was going straight into federation_posts.key
(VARCHAR(64)), which routinely overflows for real track and artist
names. Hashed instead - it's an idempotency token, not something
anyone needs to read.

New metric scrobbler_federation_profile_updates_total{result}; posts
already get scrobbler_federation_posts_total{kind="now_playing",...}
for free from the existing publish() instrumentation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 17:13:10 +01:00
mattandClaude Sonnet 5 9ab8bd8e03 Fix: never show now-playing when now_playing_mode is off
CI / validate-monitoring (push) Successful in 9s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m7s
CI / test (push) Successful in 3m3s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
now_playing_field() read core's now_playing table unconditionally, so
a user who never turned federation's now-playing feature on at all
would still leak what they're currently listening to on their public
actor document, since core's now_playing table is populated for every
user regardless of federation settings.

Found while designing step 3 (the periodic push task): querying only
sharing users with now_playing_mode != "off" made me notice
build_document() itself had no equivalent guard, and the existing
tests happened not to catch it (they only combined "nothing playing"
with "mode off", and "something playing" with "mode on"). Added the
missing combination - something playing, mode off - to both the
actors.py unit tests and the web-level actor route test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 17:06:55 +01:00
mattandClaude Sonnet 5 c38e2e392a Update(Person) vocabulary and the live now-playing actor field (phase 4, step 2)
CI / federation-interop (push) Successful in 1m47s
CI / lint (push) Successful in 16s
CI / images (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 15s
CI / test (push) Successful in 3m51s
CI / assets (push) Skipped
CI / python-package (push) Skipped
vocab.update() wraps a document as an Update, addressed explicitly
(unlike undo(), which derives `to` from the undone activity - an actor
document has no `to` of its own).

New actors.py builds the actor document body, shared by GET /users/<u>
(live) and the coming Update(Person) push (throttled) so both render
the same shape without web.py depending on the worker-side module or
vice versa. now_playing_field() reads core's get_now_playing()
directly - never federation's own throttled push state - so a fetch
always shows the truth, whatever the last proactive push said.

GET /users/<u> now includes a "Now playing" PropertyValue attachment
whenever something unexpired is playing, and omits it otherwise.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 17:03:04 +01:00
mattandClaude Sonnet 5 cb8f9c997e Settings column and now-playing state table (phase 4, step 1)
CI / validate-monitoring (push) Successful in 7s
CI / federation-interop (push) Successful in 1m9s
CI / test (push) Successful in 3m5s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / lint (push) Successful in 13s
CI / notify (push) Successful in 6s
federation_settings gains now_playing_mode (off/profile/posts,
default off), validated in sharing.update() the same way visibility
is. New federation_now_playing table: one row per user, tracking what
we've last told the fediverse (profile_key/profile_updated_at,
post_key/post_posted_at) - separate from core's now_playing table,
which is what's actually playing right now.

Verified the migration both ways against the local dev database: full
downgrade to base and back up to heads on both branches, not just a
single-step round trip.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 16:57:34 +01:00
mattandClaude Sonnet 5 7d86bad929 Plan for ActivityPub phase 4 (now playing)
CI / lint (push) Successful in 13s
CI / test (push) Successful in 2m57s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 9s
CI / federation-interop (push) Successful in 1m6s
CI / images (push) Skipped
Resolves the overview doc's last open decision: now playing builds
both options it described, not one or the other - the profile field
(recommended default, live on every GET, throttled Update(Person) push
every 5 minutes) plus a separate opt-in for actual posts (min 30s
played, throttled to one every 30 minutes, previous post deleted when
the next goes out).

No event receiver or pending-checks queue like milestones needed: a
plain periodic scan (federation.now_playing, every 30s) is simplest
here, since the throttle windows are minutes-long and there's no
history to react to retroactively - unlike milestones, now playing
only ever reflects what's playing right now.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 16:54:00 +01:00
mattandClaude Sonnet 5 e0423d04bc Docs for phase 3: what gets posted, the publishing plug-ins (step 11)
CI / lint (push) Successful in 16s
CI / federation-interop (push) Successful in 1m8s
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 / test (push) Successful in 2m55s
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
2026-09-26 16:44:32 +01:00
mattandClaude Sonnet 5 860d4d0f93 Admin post-weekly command and GoToSocial post interop checks (phase 3, step 10)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m8s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Successful in 6s
CI / test (push) Successful in 2m56s
CI / python-package (push) Skipped
`flask federation post-weekly --user <name> --now` posts a user's
summary for the week still in progress immediately, ignoring the
Monday-09:00 gate - for operators, and so the interop test can produce
a real post without waiting on calendar time. Backed by a new
weekly.post_now(), sharing _post_for_window() with the normal
check_and_post() path so both go through the same has_post/empty-week/
publish logic; only the window (this week so far, vs. the last gated
one) differs.

Extends the GoToSocial interop driver to a second phase: run.sh seeds
one scrobble directly (the driver container has no way to sign a
Last.fm-API request, and doesn't need one just to seed data), triggers
the CLI command via `docker compose exec api`, then re-runs the driver
with --check-posts to confirm the post reaches the already-following
GoToSocial account's home timeline as `private` (followers-only, our
default) with the expected content, deletes it via the existing
DELETE /posts/{id} API, and confirms it disappears from GoToSocial's
timeline too. The main flow now ends by re-following instead of the
previous test's decline, so the post-check phase has a follower to
check against.

Verified end to end against a real GoToSocial 0.22.1 container locally
before pushing (scripts/interop/run.sh), not just left to CI:
    private post: '<p><strong>My week in music: 1 play</strong></p>...'
    All post interop checks passed

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 16:40:34 +01:00
mattandClaude Sonnet 5 de1519a066 Metrics, dashboard and alert for posts (phase 3, step 9)
CI / lint (push) Successful in 13s
CI / images (push) Skipped
CI / federation-interop (push) Successful in 59s
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 8s
CI / test (push) Successful in 2m53s
CI / assets (push) Skipped
New counters: scrobbler_federation_posts_total{kind,visibility},
post_deletions_total{reason} (manual vs sharing_off), and
milestone_checks_total / weekly_total{result}, each incremented at a
single point (publish()/_delete(), and a thin public wrapper around
each module's check_and_post()) rather than at every call site.

Federation dashboard gains a "Posts" row: posts/min by kind and
visibility, deletions/min by reason, and weekly/milestone checks by
result - the same shape as the existing rows, so a stalled worker (all
zero) looks the same as one with nothing to do (all "disabled"/"none").

New alert FederationWeeklySummariesMissing, on scrobbler_worker_tasks_total
rather than the new weekly_total metric: weekly_total only increments
once check_all() reaches a real sharing user, so on a quiet instance
with nobody sharing yet it would sit at zero forever and false-alarm
immediately. worker_tasks_total counts every periodic run regardless of
whether there was anyone to check, matching the same pattern already
used by ImportWorkerDown and FederationInboxBacklog.

Verified deploy/prometheus/alerts.yml and prometheus.yml with promtool
(via the prom/prometheus image, matching CI's validate-monitoring job).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 16:31:16 +01:00
mattandClaude Sonnet 5 0acce9b948 API and web UI for posts, previews and post settings (phase 3, step 8)
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m0s
CI / test (push) Successful in 2m53s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 8s
CI / notify (push) Successful in 5s
/api/v1/federation gains:
  - GET /posts, DELETE /posts/{id}: manage your own posts from the UI.
  - GET /preview/weekly: what the weekly summary would say right now, for
    the week still in progress - never posted or stored. Backed by a new
    weekly.preview() and schedule.current_week_start().
  - GET /profiles/{username}/posts/{post_uuid} (public, unauthenticated):
    backs the UI's post page, which can't itself speak ActivityPub.

Settings gain timezone/post_weekly_summary/post_milestones, already
present in sharing.EDITABLE since phase 3 step 2 but never added to
SharingSettingsSchema, so the API was silently dropping them from
responses. timezone validates against the same is_valid_timezone() the
service layer uses, with a dedicated marshmallow validator.

Fixed a real gap found while wiring the post page: ids.post_page_url()
took a username but never put it in the URL, so post.html would have
had no way to know whose post to look up. It's now ?u=<username>&id=<uuid>.

Sharing page gets a "What to post" section (weekly summary and
milestones toggles, a timezone field with a browser-supplied IANA
datalist where Intl.supportedValuesOf exists, and a live preview).
New posts.html lists a user's posts with delete (mirroring followers.js's
confirm-before-destructive-action pattern); new post.html is the public
landing page for a post's `url`, reached by browsers redirected from the
raw ActivityPub endpoint.

Verified by hand against a local dev server and a real browser: sign in,
enable sharing, preview and publish, list and delete a post, and follow
the ActivityPub redirect through to the public post page and its 404
after deletion - fixed one bug found this way (the preview box was
collapsing the summary's line breaks).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 16:24:35 +01:00
mattandClaude Sonnet 5 d4f3607eef Page the outbox and serve individual posts (phase 3, step 7)
CI / federation-interop (push) Successful in 1m1s
CI / validate-monitoring (push) Successful in 8s
CI / test (push) Successful in 2m47s
CI / assets (push) Skipped
CI / lint (push) Successful in 1m10s
CI / images (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
GET /users/<u>/outbox is now a real OrderedCollection pointing at
paged OrderedCollectionPages of 20 Creates, newest first - public and
unlisted posts only, since it's unauthenticated. Adds
publishing.outbox_page() for the query and publishing.find_by_note_id()
to look a post up by its Note's id (the two ActivityPub ids a post has
- the wrapping Create's and the embedded Note's - were already
generated independently in publish(); finding by the Note's id reuses
the existing JSONB-path query pattern already established by
activities.undo_block(), rather than adding a new column just for this
lookup).

GET /users/<u>/posts/<uuid> serves that Note for public and unlisted
posts; followers-only and deleted posts 404 (they reach followers by
delivery instead); a browser without an ActivityPub Accept is
redirected to the UI post page unconditionally, before any lookup,
matching actor()'s existing reasoning that a 404-vs-302 difference
must never be usable to probe which posts exist.

Documents both endpoints in federation/openapi.py and regenerates
docs/openapi.json (test_every_api_route_is_documented already enforces
this on every new federation route, so it can't wait for the docs
step at the end of the phase).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 13:37:38 +01:00
mattandClaude Sonnet 5 6fd028d108 Trim artist-plays milestone thresholds to match the phase 3 plan
CI / test (push) Successful in 3m6s
CI / images (push) Skipped
CI / notify (push) Successful in 1m3s
CI / lint (push) Successful in 14s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 8s
CI / federation-interop (push) Successful in 1m2s
The plan specifies 100/500/1k for an artist's plays; 2500 and 5000 had
crept in beyond that.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 12:25:26 +01:00
mattandClaude Sonnet 5 c3a8233e73 Add federation milestones: scrobble-count, artist-plays, top-10 entries
CI / validate-monitoring (push) Successful in 9s
CI / lint (push) Successful in 15s
CI / test (push) Successful in 3m7s
CI / python-package (push) Skipped
CI / federation-interop (push) Successful in 1m1s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Failing after 2m31s
Adds publishing/milestones.py: one post per check, in priority order
(scrobble count > top-10 entry > artist plays), each threshold marked
done the first time it's reached so it's never posted twice. A live
scrobble queues a per-user FederationPendingCheck row (collapsing
repeats so the event receiver stays fast); the new federation.milestones
worker task drains it, requeuing to the back of the queue on failure
rather than retrying immediately, since a milestone check is a pure DB
read with no external server to fail against.

Enabling sharing, and finishing an import, call set_baseline() instead
of a live check: every threshold already passed is marked done without
posting, so history already on file never produces a burst of
retroactive "milestone" posts. Wired into sharing.update()'s
enable-toggle branch with a local import, mirroring farewell_user()'s
existing precedent for the same sharing<->federation-internals
circularity.

A top-10 entry now requires the user to actually have TOP_N distinct
artists first - caught by a test with unpatched thresholds, where every
first play of a new artist was trivially "entering an empty top 10".

Fixes test_federation_boundary.py's off-means-off check: blinker
signals are process-wide, so once any app in the test process enables
federation the milestone receivers stay connected for the rest of the
run regardless of which app is "current" - there's no per-app scoping
to introspect. Replaced the receiver-absence assertion with a
behavioural one (firing an event through the off app's own context is
a no-op), and kept the existing per-app-scoped view/worker checks as
they were.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 12:24:04 +01:00
mattandClaude Sonnet 5 0766c09fb3 Weekly summary task (phase 3, step 5)
CI / lint (push) Successful in 16s
CI / federation-interop (push) Successful in 1m2s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 10s
CI / notify (push) Successful in 6s
CI / test (push) Successful in 2m40s
CI / images (push) Skipped
protocol/schedule.py (pure): target_week(now_utc, tz) resolves to
exactly one Monday-Sunday week — the most recent one whose Monday
09:00-local posting gate has passed — computed via wall-clock
arithmetic in the user's own zone so it's correct across a DST change
(a week can be 6h23/7h01 of real time, never silently 7 flat days).
Because it's a pure function of "now", a worker that was down for
weeks naturally catches up with one post, not a backlog. Also
resolve_timezone()/is_valid_timezone() for a settings field that can
otherwise crash a task or silently do nothing forever.

protocol/content.py (pure): the small HTML subset shared by every post
kind (p, strong, em, ol, li), with escaping split from formatting so a
hostile artist/track name can't inject markup.

publishing/weekly.py: build_content() (the template) and
check_and_post()/check_all() (the federation.weekly periodic task,
every 15 minutes). An empty week is simply never posted, and — since
the target week only ever advances — never reconsidered either, with
no separate marker needed. has_post() lets the common "already posted
this week" pass skip the stats queries entirely.

Core: accounts.get_user(id) (federation needs it and can't import the
User model directly); sharing.EDITABLE and update() gain
timezone/post_weekly_summary/post_milestones, with the same
now-not-later validation visibility already had.

Tested: the DST week and gate boundaries against real computed
reference dates (not guessed ones — one guess was wrong and the test
caught it before it shipped), hostile/emoji/RTL names in the template,
and the full task against a real database (empty vs non-empty weeks,
posting twice, disabled settings, a worker down for weeks, a bad
stored timezone not stopping other users).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 12:02:02 +01:00
mattandClaude Sonnet 5 b16ba116c4 Publishing core: post, fan out, delete (phase 3, step 4)
CI / federation-interop (push) Successful in 1m1s
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 13s
CI / test (push) Successful in 2m26s
federation/publishing/base.py:
- publish(user_id, username, kind, key, text=, html=): idempotent —
  refuses (returns None, doesn't post) if the user has stopped sharing
  or a post with that key already exists, including when two worker
  passes race (caught as a duplicate-key error at commit, not raised).
  Builds Note + Create addressed from the user's current visibility,
  stores both, and fans out one delivery per distinct accepted
  follower's inbox (shared inbox preferred).
- delete_post(user_id, username, post): sends Delete(Tombstone) to the
  same followers and tombstones the row; a no-op if already deleted.
  Addressed by the post's own visibility at the time it was posted,
  not the user's current setting.
- delete_all_for(user_id, username): deletes every live post, for
  turning sharing off.

Wired into PATCH /settings: turning sharing off now deletes every live
post *before* rejecting followers (reject_all removes the followers
that accepted_inboxes() needs). The phase 2 farewell-actor mechanism
already covers these deliveries with no changes, since it just checks
for any pending delivery on the user's activities.

Small supporting changes: activities.store() made public (used from
publishing now, not just activities.py's own narrow helpers);
followers.accepted_inboxes() for fan-out; ids.py gains
followers_url/note_url/post_page_url; sharing.settings_for()'s unsaved
default object now sets every field a caller might read, not just the
ones the old callers happened to need.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 11:51:06 +01:00
mattandClaude Sonnet 5 dce90400e6 Post vocabulary and visibility addressing (phase 3, step 3)
CI / images (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Successful in 6s
CI / lint (push) Successful in 12s
CI / federation-interop (push) Successful in 1m1s
CI / test (push) Successful in 2m19s
CI / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 8s
Pure additions to federation/protocol:
- vocab: note() (a Note, no @context of its own — always embedded in
  a Create), create() (wraps an object with the post's addressing),
  delete() (a Tombstone, the shape Mastodon sends), hashtag() (name
  only; we don't serve tag pages), ordered_collection_page() for
  outbox paging, and ordered_collection() gains an optional `first`
  link
- addressing.py: one function turning a visibility (followers/
  unlisted/public) into (to, cc), unit-tested for each value

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 11:39:59 +01:00
mattandClaude Sonnet 5 ed74a78625 Settings, posts, milestone marks and pending-checks tables (phase 3, step 2)
CI / lint (push) Successful in 13s
CI / test (push) Successful in 2m19s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 7s
CI / federation-interop (push) Successful in 58s
CI / python-package (push) Skipped
federation_settings gains timezone (IANA name, default UTC),
post_weekly_summary and post_milestones (both on by default), with a
server_default backfilling any existing rows.

New tables on the federation branch:
- federation_posts: one row per (user, key) — e.g. weekly:2026-W39 or
  milestone:scrobbles:10000 — which is what makes posting idempotent;
  wraps the Create activity, keeps its own content and visibility, and
  a deleted_at tombstone
- federation_milestone_marks: thresholds a user has passed, with
  posted=false for ones passed silently (enabling sharing, or an
  import finishing) so they're never reconsidered
- federation_pending_checks: a one-row-per-user queue filled by the
  scrobbles_stored receiver and drained by the worker, so a scrobble
  request never does milestone-checking work itself

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 11:36:34 +01:00
mattandClaude Sonnet 5 ea6b10637e Core: listening stats over an explicit date window (phase 3, step 1)
CI / federation-interop (push) Successful in 1m1s
CI / test (push) Successful in 2m5s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 9s
CI / lint (push) Successful in 13s
CI / images (push) Skipped
scrobbler.services.stats gains scrobble_count_between, top_artists_between
and top_tracks_between, over [start, end) (start inclusive, end
exclusive) rather than a rolling period. The existing period-based
functions are re-expressed on the same _between() primitive instead of
duplicating the windowing logic.

These are for federation's weekly summaries (phase 3), which need a
fixed Monday-to-Sunday window rather than "N days back". No public API
changes; the Last.fm and /api/v1/me endpoints are unaffected (pinned by
a regression test).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 11:34:08 +01:00
mattandClaude Opus 5.5 bc717c2a06 Plan for ActivityPub phase 3 (posts)
CI / validate-monitoring (push) Successful in 8s
CI / federation-interop (push) Successful in 1m0s
CI / test (push) Successful in 2m1s
CI / images (push) Skipped
CI / lint (push) Successful in 13s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 7s
Weekly summaries (Monday 09:00 in each user's time zone) and
milestones, followers-only by default: a core stats-window addition,
idempotent posts keyed per week/threshold, Note/Create/Delete with
visibility addressing, fan-out to followers' shared inboxes, no
retroactive posts (baselines on enabling sharing and after imports),
deletable posts and deletion when sharing is switched off, a paged
outbox, API/UI, metrics and an alert, and interop checks with
GoToSocial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 10:58:48 +01:00
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 / 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
CI / notify (push) Successful in 6s
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 / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / lint (push) Successful in 10s
CI / test (push) Successful in 2m16s
CI / images (push) Skipped
CI / assets (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 / test (push) Successful in 2m2s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 12s
CI / python-package (push) Skipped
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 / test (push) Successful in 1m57s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 9s
CI / images (push) Skipped
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 / images (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 14s
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 / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / test (push) Successful in 1m46s
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 / test (push) Successful in 1m6s
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 12s
CI / images (push) Skipped
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 / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 1m3s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / notify (push) Successful in 5s
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 / python-package (push) Skipped
CI / images (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 / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / lint (push) Successful in 13s
CI / images (push) Skipped
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 / lint (push) Successful in 12s
CI / images (push) Skipped
CI / assets (push) Skipped
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 / lint (push) Successful in 11s
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
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 / images (push) Skipped
CI / python-package (push) Skipped
CI / lint (push) Successful in 12s
CI / test (push) Successful in 57s
CI / assets (push) Skipped
CI / notify (push) Successful in 6s
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 / notify (push) Successful in 5s
CI / lint (push) Successful in 11s
CI / python-package (push) Skipped
- 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 / test (push) Successful in 48s
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 13s
CI / images (push) Skipped
CI / assets (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 / images (push) Skipped
CI / assets (push) Skipped
CI / test (push) Successful in 47s
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 / python-package (push) Skipped
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 9s
CI / images (push) Skipped
CI / assets (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