/
/
# What does this implement/fix? The Smart Fades provider's nine model attributes were never declared: they existed only once `_load_models()` had unpacked them, and `_free_models()` set them back to `None`. The models are freed again while idle, so an analysis that outlives its own session can find them gone — and when that happened the guards raised `AssertionError`, which the base class records as a **permanent** analysis failure (`next_retry = NULL`). That track is then never analysed again. The guards were meant to catch exactly this; they just raised the wrong kind of error to be handled properly. Declaring the fields makes the optionality visible to the type checker as well, so a new model field can no longer slip through unguarded. ## Changes - Declare all nine model fields with their real types and a `None` default. - Resolve every model through one `_require_loaded()` helper that logs and raises a *retryable* `AudioAnalysisError`, replacing the `assert`s and the one hand-written `None` check. - Type the `_initialize_models()` return tuple instead of `tuple[Any, ...]`, so the unpack in `_load_models()` is checked. - Add tests for both paths that reach the failure recorder (beat/key inference and the block path that finalize flushes through). ## Types of changes - [ ] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [ ] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [x] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.