audio streaming app plyr.fm
38
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: lexicon validation no-op in Docker — lexicons dir missing from image (#1074)

the `lexicons/` directory was not copied into the Docker image, so
`_load_lexicon` returned None for every lexicon ID and `validate_record`
silently passed all records. this allowed a record with only `title` and
`description` (no audio reference) to be ingested as a valid track.

found during Jetstream smoketest: `pdsx create fm.plyr.stg.track
title="..." description="..."` was accepted and indexed as a track.

fixes:
- copy `lexicons/` into the Docker image
- replace fragile `parents[4]` path with upward search that works in
both the repo checkout and the container layout

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

authored by

nate nowack
Claude Opus 4.6
and committed by
GitHub
b6a9f23c 3a642624

+25 -2
+1
backend/Dockerfile
··· 16 16 17 17 # copy application code 18 18 COPY backend/src ./src 19 + COPY lexicons ./lexicons 19 20 20 21 # copy alembic migration files 21 22 COPY backend/alembic.ini .
+13 -1
backend/src/backend/utilities/lexicon.py
··· 13 13 14 14 logger = logging.getLogger(__name__) 15 15 16 - _LEXICONS_DIR = Path(__file__).resolve().parents[4] / "lexicons" 16 + 17 + def _find_lexicons_dir() -> Path: 18 + """locate the lexicons directory, searching upward from this file.""" 19 + current = Path(__file__).resolve().parent 20 + for _ in range(8): 21 + candidate = current / "lexicons" 22 + if candidate.is_dir(): 23 + return candidate 24 + current = current.parent 25 + return Path("/app/lexicons") 26 + 27 + 28 + _LEXICONS_DIR = _find_lexicons_dir() 17 29 18 30 19 31 @lru_cache(maxsize=32)
+11 -1
backend/tests/test_lexicon_validation.py
··· 1 1 """pure unit tests for lexicon record validation.""" 2 2 3 - from backend.utilities.lexicon import validate_record 3 + from backend.utilities.lexicon import _LEXICONS_DIR, validate_record 4 + 5 + 6 + class TestLexiconDirectory: 7 + def test_lexicons_dir_exists(self) -> None: 8 + """regression: lexicons dir must be found (was missing in Docker).""" 9 + assert _LEXICONS_DIR.is_dir(), f"lexicons dir not found at {_LEXICONS_DIR}" 10 + 11 + def test_track_lexicon_loadable(self) -> None: 12 + """track.json must be present and loadable.""" 13 + assert (_LEXICONS_DIR / "track.json").exists() 4 14 5 15 6 16 class TestValidateTrack: