Files
ledgrab/plans/processed-audio-sources/phase-7-testing-polish.md
T
alexei.dolgolyov 86a9d344e6 feat(processed-audio-sources): phase 1 - audio filter framework
Add the foundation for audio processing filters, mirroring the existing
picture filter/postprocessing template system:
- AudioFilter base class, AudioFilterRegistry, AudioFilterOptionDef
- AudioProcessingTemplate dataclass + SQLite-backed store
- audio_filter_template meta-filter with recursive resolution
- Full REST API: CRUD templates + filter registry discovery
- Dependency injection wired in dependencies.py and main.py
2026-03-31 17:35:39 +02:00

3.6 KiB

Phase 7: Testing & Polish

Status: Not Started Parent plan: PLAN.md Domain: backend

Objective

Verify the full feature works end-to-end, write tests, fix any remaining issues, and clean up dead code.

Tasks

  • Task 1: Write unit tests for each audio filter
    • Test each filter transforms AudioAnalysis correctly
    • Test stateful filters maintain and reset state
    • Test edge cases: empty spectrum, zero rms, all-zero input
    • Test filter option validation
  • Task 2: Write unit tests for AudioFilterPipeline
    • Test chain of filters produces expected output
    • Test empty pipeline passes through unchanged
    • Test reset() resets all stateful filters
  • Task 3: Write integration tests for AudioProcessingTemplateStore
    • CRUD operations
    • Template composition (audio_filter_template) expansion
    • Cycle detection in template composition
    • Reference validation
  • Task 4: Write integration tests for ProcessedAudioSource in AudioSourceStore
    • CRUD operations
    • Chain resolution (ProcessedAudioSource → ... → CaptureAudioSource)
    • Cycle detection in source chains
    • Reference validation (source + template must exist)
    • Cascade delete checks
  • Task 5: Write API tests for audio processing template endpoints
    • Create, read, update, delete
    • Validation errors (missing fields, invalid filter_ids)
    • Reference check on delete
  • Task 6: Write API tests for updated audio source endpoints
    • Create/update ProcessedAudioSource and CaptureAudioSource
    • Reject old types (mono, band_extract)
    • Validation of source/template references
  • Task 7: Verify backup/restore includes audio processing templates
    • Create templates, backup, restore, verify they survive
  • Task 8: Full build verification
    • ruff check src/ tests/ --fix passes
    • npx tsc --noEmit passes
    • npm run build succeeds
    • py -3.13 -m pytest tests/ --no-cov -q — all tests pass
  • Task 9: Clean up dead code
    • Remove any remaining imports of MonoAudioSource, BandExtractAudioSource
    • Remove old band_filter.py if fully superseded by the band_extract filter (or keep if still used elsewhere)
    • Remove unused schema classes
    • Verify no orphaned i18n keys
  • Task 10: Update system health/info endpoints if they enumerate audio source types

Files to Modify/Create

  • tests/test_audio_filters.pycreate — filter unit tests
  • tests/test_audio_filter_pipeline.pycreate — pipeline tests
  • tests/test_audio_processing_template_store.pycreate — store tests
  • tests/test_audio_source_store.pymodify — updated for new types
  • tests/test_audio_processing_templates_api.pycreate — API tests
  • tests/test_audio_sources_api.pymodify — updated for new types
  • Various files — modify — dead code cleanup

Acceptance Criteria

  • All new tests pass
  • All existing tests pass (no regressions)
  • Full build (Python + TypeScript) succeeds
  • Ruff linting passes
  • No dead code referencing removed types
  • Backup/restore round-trips correctly with audio processing templates

Notes

  • This is the Big Bang verification phase — the first time build + tests are enforced
  • Expect some breakage from Phases 1-6 that needs fixing here
  • Focus on fixing real issues, not cosmetic cleanup
  • band_filter.py may still be used by the band_extract filter — check before removing

Review Checklist

  • All tasks completed
  • Code follows project conventions
  • No unintended side effects
  • Build passes
  • Tests pass (new + existing)

Handoff to Next Phase