Files
mono/federation
giles e65bd41ebe Decouple per-service Alembic migrations and fix cross-DB queries
Each service (blog, market, cart, events, federation, account) now owns
its own database schema with independent Alembic migrations. Removes the
monolithic shared/alembic/ that ran all migrations against a single DB.

- Add per-service alembic.ini, env.py, and 0001_initial.py migrations
- Add shared/db/alembic_env.py helper with table-name filtering
- Fix cross-DB FK in blog/models/snippet.py (users lives in db_account)
- Fix cart_impl.py cross-DB queries: fetch products and market_places
  via internal data endpoints instead of direct SQL joins
- Fix blog ghost_sync to fetch page_configs from cart via data endpoint
- Add products-by-ids and page-config-ensure data endpoints
- Update all entrypoint.sh to create own DB and run own migrations
- Cart now uses db_cart instead of db_market
- Add docker-compose.dev.yml, dev.sh for local development
- CI deploys both rose-ash swarm stack and rose-ash-dev compose stack
- Fix Quart namespace package crash (root_path in factory.py)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 12:07:24 +00:00
..
2026-02-24 20:13:00 +00:00

Federation App

OAuth2 authorization server and ActivityPub social hub for the Rose Ash cooperative. Handles user authentication, fediverse federation, and social features (timeline, compose, follow, notifications).

Structure

app.py                  # Application factory (create_base_app + blueprints)
path_setup.py           # Adds project root + app dir to sys.path
entrypoint.sh           # Container entrypoint (optional migrations, Redis flush, start)
bp/
  auth/                 #   Login, magic link, logout, OAuth2 authorize endpoint
  identity/             #   Actor profile management
  social/               #   Timeline, compose, search, follow/unfollow,
                        #   like/boost, notifications, following/followers lists
  fragments/            #   Fragment endpoints
models/                 # Re-export stubs pointing to shared/models/
services/               # register_domain_services() — wires all domains
templates/              # Federation-specific templates (override shared/)

OAuth2 SSO

Federation is the authorization server for all Rose Ash apps:

  • /oauth/authorize — authorization endpoint (PKCE supported)
  • Magic link login (passwordless email)
  • All client apps auto-get /auth/login, /auth/callback, /auth/logout via shared/infrastructure/oauth.py
  • Per-app first-party session cookies (Safari ITP compatible)

ActivityPub

  • Per-app actors: each app has its own AP actor (virtual projection of the same keypair)
  • Actor endpoints: webfinger, actor profile, inbox, outbox, followers
  • Social features: timeline, compose, search, follow/unfollow, like/boost, notifications
  • Activities emitted to ap_activities table, processed by EventProcessor
  • HTTP signatures + IPFS content addressing

Cross-domain communication

  • services.blog.* — post queries for content federation
  • services.calendar.* — event queries
  • services.market.* — product queries
  • services.cart.* — cart summary for context processor