Files
feedBack/.dockerignore
T
ebe59d3f97
ship-ci / ci (push) Waiting to run
refactor(server): extract the audio-effects routes into routers/audio_effects.py (R3) (#834)
The first route module through the appstate seam (#833). Picked BY MEASUREMENT,
not by the plan's guess: a transitive dep-closure scan over every route group
ranked audio-effects at 0 monkeypatch.setattr targets and exactly one exclusive
helper. (The same scan disproved the plan's assumption that artists/aliases was
free -- api_artist_links reaches _mb_http_get and _enrich_network_enabled, both
setattr targets.)

Bodies are verbatim. The only edits are mechanical:
  @app.get(...)            -> @router.get(...)
  audio_effect_mappings.x  -> appstate.audio_effect_mappings.x

The singleton read must stay a module attribute resolved at call time, so a
re-imported server re-publishes a fresh DB into the seam and monkeypatch reaches
this module. `routers/` never imports `server`: server -> routers -> appstate.

`app.include_router(...)` sits exactly where the routes used to be defined --
FastAPI matches in registration order, so the mount site preserves it. Verified
by diffing the FULL route table against origin/main: 143 routes, identical
paths, methods AND order.

server.py: 9,445 -> 9,386 lines. `fastapi.Query` went dead with the move and was
removed (the other four unused imports are pre-existing on main).

Packaging: COPY routers/ /app/routers/ plus `!routers/` + `!routers/**` in
.dockerignore (that file opens with a blanket `*`). Verified against the real
docker daemon: routers/ reaches the build context, __pycache__ does not.

Verified: pyflakes clean on routers/; no new undefined name in server.py;
pytest 2348 passed (75 in the audio-effects + demo-mode suites); eslint 0
errors; boot smoke drives all five routes end-to-end (create -> read back ->
activate -> clear -> delete -> 404 on missing -> 400 on bad body), Query(...)
still 422s on a missing required param, and demo mode still 403s all four
moved write routes while allowing the read.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 15:24:31 +02:00

87 lines
2.2 KiB
Plaintext

*
!.dockerignore
!Dockerfile
!dockerfile
!requirements.txt
!server.py
# The router seam server.py injects its singletons into (R3). Root-level Python
# that ships in the image must be re-allowed explicitly — this file starts with
# a blanket `*` exclusion.
!appstate.py
# Route modules extracted from server.py (R3).
!routers/
!routers/**
!main.py
!VERSION
!tailwind.config.js
!lib/
!lib/**
# Mirror the static/* policy from .gitignore: ship the static tree, but not
# the cached audio/art artifacts a developer's runtime would generate
# (static/*.ogg, *.mp3, *.wav, art/, audio_*/). Those bloat the image and
# make builds non-reproducible across machines.
!static/
!static/**
static/*.ogg
static/*.mp3
static/*.wav
static/art/
static/audio_*/
static/sloppak_cache/
# note-detection tuning flow auto-writes WAVs and JSONL captures here.
# Not in .gitignore yet — see docs/note-detect-tuning.md — but still a
# generated-at-runtime directory that shouldn't bake into the image.
static/note_detect_recordings/
# All in-tree core plugins ship in the image. Each plugin directory must be
# explicitly re-allowed after the blanket `plugins/*/` exclusion below.
!plugins/
plugins/*/
!plugins/__init__.py
!plugins/app_tour_library/
!plugins/app_tour_library/**
!plugins/app_tour_settings/
!plugins/app_tour_settings/**
!plugins/capability_inspector/
!plugins/capability_inspector/**
!plugins/highway_3d/
!plugins/highway_3d/**
!plugins/minigames/
!plugins/minigames/**
!plugins/tuner/
!plugins/tuner/**
!data/
!data/**
# Ship only the built-in diagnostic sloppak artifacts (seeded into
# DLC_DIR/diagnostics-builtin/ at scan time). The builder script + README
# under docs/diagnostics/ are dev-only and stay out of the image.
!docs/
docs/*/
!docs/diagnostics/
docs/diagnostics/*
!docs/diagnostics/*.sloppak
# Exclude common developer artifacts even inside the whitelisted trees so a
# venv / cache / build output never gets baked into the image.
**/__pycache__/
**/*.pyc
**/.pytest_cache/
**/.mypy_cache/
**/.ruff_cache/
**/node_modules/
**/.venv/
**/venv/
**/.env
# (the Dockerfile builder stage rebuilds from source). A contributor
# into the build context.
**/bin/
**/obj/
**/.env.*
**/.DS_Store