Display name only: UI, docs, API title, dashboards, hashtag and User-Agent.
Identifiers (package, metrics, env vars, SCROBBLER_CONFIG) are unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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
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