trails/apps/journal/app/jobs
Ullrich Schäfer bc233e03e5 feat(journal): federation outbox + push delivery to remote followers
social-federation tasks 5.1–5.6. Completes the inbound-federation
story: a Mastodon follower now receives a trails user's new public
activities in their home timeline.

Outbox (5.1/5.2):
- /users/:username/outbox — paginated OrderedCollection of public
  activities as Create(Note), newest first; unlisted/private never
  federate. Private-user 404 enforced at the route layer because
  Fedify builds collection-level responses from counter/cursors
  without consulting the page dispatcher.
- Note shape: HTML content (escaped name/description/stats + link to
  the activity page) with structured PropertyValue attachments
  (distance-m, elevation-gain-m, duration-s) — Mastodon renders the
  text, trails consumers read the structured fields. Resolves the
  design open question toward Create(Note).
- Authorized Fetch: signed and unsigned outbox fetches deliberately
  see the same (public-only) content until locked accounts exist.

Push delivery (5.3–5.6):
- createActivity / updateActivityVisibility(→public) enqueue one
  deliver-activity job per accepted remote follower; flips away from
  public and hard deletes enqueue Delete(Tombstone) retractions
  (enqueued before the row disappears).
- deliver-activity job: re-reads the row at delivery time (skips if
  gone or no longer public), resolves the recipient inbox via the
  remote_actors cache with actor-document fetch fallback (priming the
  cache), HTTP-signs via the owner's key, and POSTs. retryLimit 8 +
  exponential backoff at enqueue time; outbound paced at 1 req/s per
  remote host.
- Actor objects now advertise the outbox IRI.
- @js-temporal/polyfill added (same range Fedify uses) for published
  timestamps; Fedify's types want the global esnext.temporal namespace,
  bridged with a documented cast.

Tests: 9 unit tests for the AS mapping (escaping, stats, attachments,
published fallback, stable ids, tombstones), 4 outbox integration
tests (collection count, page shape/visibility filtering, private-404,
delivery audience query).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 15:32:52 +02:00
..
backfill-user-keypairs.ts feat(journal): federation schema + per-user signing keypairs 2026-06-06 14:15:51 +02:00
consumed-jti-sweep.ts fix(journal): single-use JWT enforcement for route callback tokens (#2 Phase B) 2026-05-26 00:38:08 +02:00
deliver-activity.ts feat(journal): federation outbox + push delivery to remote followers 2026-06-06 15:32:52 +02:00
demo-bot-generate.ts Upgrade pg-boss from 10 to 12 2026-04-19 23:01:11 +02:00
demo-bot-prune.ts Upgrade pg-boss from 10 to 12 2026-04-19 23:01:11 +02:00
federation-kv-sweep.ts feat(journal): federation inbox — Mastodon follows land here 2026-06-06 14:33:43 +02:00
import-batches-sweep.ts Simplify: typed status, skip-write guard, remove redundant comment 2026-05-23 20:49:09 +02:00
komoot-bulk-import.ts chore(ts): eliminate the remaining 4 \as any\ casts in production code 2026-05-26 07:11:02 +02:00
notifications-fanout.integration.test.ts Cursor-based pagination for /notifications 2026-04-26 01:42:32 +02:00
notifications-fanout.ts feat(journal): federation inbox — Mastodon follows land here 2026-06-06 14:33:43 +02:00
notifications-purge.ts Implement notifications + supporting fixes 2026-04-26 01:28:55 +02:00
send-welcome-email.ts fix(journal): architectural audit omnibus 2026-05-24 10:28:33 +02:00