Federation module skeleton and its own migration branch (phase 0, steps 3-4)
- 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
This commit is contained in:
1 parent
098eab025f
commit
c79c42ee00
13 files changed
+212
-6
No files matched your search
@@ -97,7 +97,7 @@ Unlike live scrobbles, imports keep plays of any age. They still skip rows with
|
||||
```sh
|
||||
docker compose up -d db # Postgres with a scrobbler_test database
|
||||
uv sync
|
||||
uv run flask --app scrobbler db upgrade
|
||||
uv run flask --app scrobbler db upgrade heads
|
||||
uv run flask --app scrobbler run --port 5050 # API (port 5000 is taken by AirPlay on macOS)
|
||||
python -m http.server 8080 -d frontend # UI
|
||||
uv run flask --app scrobbler worker # background work (imports, …)
|
||||
@@ -105,7 +105,7 @@ uv run pytest # needs TEST_DATABASE_URL (see .env
|
||||
uv run ruff check && uv run ruff format --check
|
||||
```
|
||||
|
||||
- **Migrations**: after changing `models.py`, run `uv run flask --app scrobbler db migrate -m "…"`. CI fails if the models and migrations disagree.
|
||||
- **Migrations** come in two branches, `core` and `federation`. After changing core models, run `uv run flask --app scrobbler db migrate --head core@head -m "…"`; federation tables use `--head federation@head` (see `src/scrobbler/federation/README.md`). Apply them with `db upgrade heads`. CI fails if the models and migrations disagree.
|
||||
- **API docs**: after changing an endpoint, run `uv run flask --app scrobbler openapi write --format=json docs/openapi.json`. A test fails if the committed spec is stale. Every route has to appear in the spec, and every UI route has to declare bearer auth.
|
||||
- **Demo traffic**: `uv run python scripts/generate_traffic.py --minutes 5` sends a realistic mix of scrobbles and errors, so the dashboards have something to show.
|
||||
|
||||
|
||||
Reference in new issue
Block a user