mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-07-22 04:41:23 +00:00
Routes moving out of server.py need `meta_db` and friends, but must not
`import server` -- that goes circular the moment server imports them back.
server.py keeps CONSTRUCTING its singletons and now injects them once via
`appstate.configure(...)`; routers read them back as module attributes at call
time (`import appstate; appstate.meta_db`). The Python analogue of the frontend
refactor's `configureX({...})` seams and of the plugin `setup(app, context)`
contract: dependencies flow one way, server -> routers -> appstate.
Two properties are load-bearing, both pinned by tests/test_appstate.py:
1. `import appstate` constructs nothing and touches no disk. This is why the
~49 test fixtures that `sys.modules.pop("server")` + re-import (to rebuild
meta_db under a patched CONFIG_DIR) keep working UNTOUCHED. A singleton
owned by appstate would survive that pop and go stale -- verified.
2. Reads must be late-bound. `from appstate import meta_db` freezes the binding
and defeats both a later configure() and monkeypatch.setattr -- the same
read-only-binding trap as ES imports.
configure() raises on an unknown slot instead of silently creating a global
nothing reads, and the suite asserts server ACTUALLY calls it. Negative-checked:
dropping the configure() call fails exactly the two wiring tests while the other
five stay green -- those five are the false-green a seam test must not be.
The new suite imports server through an `isolated_server` fixture that patches
CONFIG_DIR to tmp_path and closes both DB connections on teardown. An unguarded
`import server` constructs MetadataDB + AudioEffectsMappingDB under the real
`~/.local/share/feedback` (reproduced: running the file alone created
web_library.db + audio_effects.db there). The full suite now leaves the real
config dir untouched.
Packaging: `COPY appstate.py /app/` plus a .dockerignore allowlist entry. That
file opens with a blanket `*` exclusion, so root-level Python must be re-allowed
explicitly -- without it the image build fails on the COPY. Verified against the
real docker daemon (build context reaches /app/appstate.py). docker-compose.yml
gains the dev bind-mount; docker-compose.nas.yml runs the baked image, so the
COPY covers it. `routers/` will need the same two entries when it lands.
Verified: pyflakes clean; pytest 2348 passed (2341 + 7 new); eslint 0 errors;
boot smoke serves /api/version, /api/library, /api/audio-effects/mappings, and
all three migrated plugins' src/ graphs, with `appstate.meta_db is server.meta_db`
asserted against the live import.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
YAML
39 lines
1.3 KiB
YAML
services:
|
|
web:
|
|
build: .
|
|
ports:
|
|
- "8000:8000"
|
|
volumes:
|
|
# Mount your song library folder (adjust path for your system)
|
|
- ${LIBRARY_PATH:-./library}:/dlc
|
|
# Persistent config and cache
|
|
- feedBack-config:/config
|
|
# Mount source for live reload during development
|
|
- ./static:/app/static
|
|
- ./server.py:/app/server.py
|
|
- ./appstate.py:/app/appstate.py
|
|
- ./VERSION:/app/VERSION
|
|
- ./ug_browser.py:/app/ug_browser.py
|
|
- ./lib:/app/lib
|
|
- ./plugins:/app/plugins
|
|
- ./.git:/app/.git:ro
|
|
environment:
|
|
- PYTHONPATH=/app/lib:/app
|
|
- DLC_DIR=/dlc
|
|
- CONFIG_DIR=/config
|
|
# Write note_detect recordings to the host-visible bind mount (./static)
|
|
# rather than the /config Docker volume: recorded takes (and training
|
|
# bundles) then land in static/note_detect_recordings/ on the host, where
|
|
# the offline harness can read them directly.
|
|
- STATIC_DIR=/app/static
|
|
# Logging (optional)
|
|
# - LOG_LEVEL=DEBUG # DEBUG | INFO | WARNING | ERROR (default: INFO)
|
|
# - LOG_FORMAT=json # json | text (default: text — coloured console)
|
|
# - LOG_FILE=/config/feedBack.log # also write to a persistent file
|
|
dns:
|
|
- 8.8.8.8
|
|
- 1.1.1.1
|
|
|
|
volumes:
|
|
feedBack-config:
|