/
/
# What does this implement/fix? When a Sonic Analysis session planned CLAP windows but completed none, it still returned a populated analysis. The base `finalize()` persisted that at the current `analysis_version` and cleared any prior failure row, so the track was permanently done with librosa scalars but no CLAP embedding — the thing `sonic_similarity` needs. Both the session gate and the background-scan query skip anything already at the current version, so nothing ever picked it up again. #6012 and #6024 each removed a trigger for losing windows, and #6012's description names this consequence, but the silent-loss path itself stayed: any remaining transient failure — a one-off torch error killing an inference, a stream that ends short — still lands a track in that permanent state. An incomplete CLAP plan now fails retryably instead of persisting, so the existing failure/re-queue machinery brings the track back. Partially filled windows are flushed at finalize first, so the two windows that can never reach the 7s dispatch gate on their own still complete rather than failing forever. No `analysis_version` change — existing libraries are not forced into a re-analysis. Repairing rows already persisted without CLAP data is out of scope; those sit at the current version and are invisible to both gates, so a separate task covers them. **Related issue (if applicable):** - No tracker issue; follows on from #6012 and #6024 ## Types of changes - [x] 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` - [ ] 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.