quintodrome/server/subsonic/responses/.snapshots
Deluan Quintão 259c1a9484
feat(subsonic): add sonicSimilarity extension as plugin capability (#5419)
* feat(plugins): add sonicSimilarity capability types

Defines the SonicSimilarity plugin capability interface with
GetSonicSimilarTracks and FindSonicPath methods, along with
their request/response types.

* feat(sonic): add core sonic similarity service

Implements the Sonic service with HasProvider, GetSonicSimilarTracks,
and FindSonicPath, delegating to the PluginLoader and using the
Matcher for index-preserving library resolution.

* test(sonic): add sonic service unit tests

Covers HasProvider, GetSonicSimilarTracks, and FindSonicPath with
mock plugin loader and provider, verifying error propagation and
successful match resolution via the library matcher.

* feat(matcher): add MatchSongsToLibraryMap for index-preserving matching

Adds a new method alongside MatchSongsToLibrary that returns a
map[int]MediaFile keyed by input song index rather than a flat slice,
enabling callers to correlate similarity scores back to the original
position in the results.

* fix(sonic): check provider availability before MediaFile lookup

Avoids unnecessary DB call when no plugin is available, and ensures
the correct error path is tested.

* feat(plugins): add sonic similarity adapter

Adds SonicSimilarityAdapter implementing sonic.Provider, bridging the
plugin system to the core sonic service via Extism plugin functions.
Reuses existing songRefsToAgentSongs helper for SongRef conversion.

* feat(plugins): add LoadSonicSimilarity to plugin manager

Adds Manager.LoadSonicSimilarity method following the pattern of
LoadLyricsProvider, enabling the core sonic service to load a
SonicSimilarityAdapter from a named plugin.

* feat(subsonic): add sonicMatch response type

Add SonicMatch struct with Entry and Similarity fields, and a SonicMatches slice to the Subsonic response struct. These types support the OpenSubsonic sonicSimilarity extension for returning similarity-scored track results.

* feat(subsonic): add getSonicSimilarTracks and findSonicPath handlers

Add two new Subsonic API handlers for the sonicSimilarity OpenSubsonic extension: GetSonicSimilarTracks returns similarity-scored tracks similar to a given song, and FindSonicPath returns a path of tracks connecting two songs. Both handlers delegate to the sonic core service and map results to SonicMatch response types.

* feat(subsonic): advertise sonicSimilarity extension when plugin available

Update GetOpenSubsonicExtensions to conditionally include the sonicSimilarity extension only when a sonic similarity plugin provider is available. The nil guard ensures backward compatibility with tests that pass nil for the sonic field. Also update the existing test to pass the new nil parameter.

* feat(subsonic): wire sonic similarity service into router

Add the sonic.Sonic service to the Router struct and New() constructor, register the getSonicSimilarTracks and findSonicPath routes, and wire sonic.New and its PluginLoader binding into the Wire dependency injection graph. Update all existing test call sites to pass the new nil parameter. Regenerate wire_gen.go.

* fix(e2e): add sonic parameter to subsonic.New call in e2e tests

* test(subsonic): add sonicSimilarity extension advertisement tests

Restructures the GetOpenSubsonicExtensions test into two contexts: one verifying the baseline 5 extensions are returned when no sonic similarity plugin is configured, and one verifying that the sonicSimilarity extension is advertised (making 6 total) when a plugin loader reports an available provider. Adds a mockSonicPluginLoader to satisfy the sonic.PluginLoader interface without requiring a real plugin.

* feat(subsonic): add nil guard and e2e tests for sonic similarity endpoints

Handlers return ErrorDataNotFound when no sonic service is configured,
preventing nil panics. E2e tests verify both endpoints return proper
error responses when no plugin is available.

* fix(subsonic): return HTTP 404 when no sonic similarity plugin available

Endpoints are always registered but return 404 when no provider is
available, rather than a subsonic error code 70.

* refactor: clean up sonic similarity code after review

Extract shared helpers to reduce duplication across the sonic similarity
implementation: loadAllMatches in matcher consolidates the 4-phase
matching pipeline, songRefToAgentSong eliminates per-iteration slice
allocation in the adapter, sonicMatchResponse deduplicates response
building in handlers, and a package-level constant replaces raw
capability name strings in core/sonic.

* fix empty response shapes

Signed-off-by: Deluan <deluan@navidrome.org>

* test(plugins): add testdata plugin and e2e tests for sonic similarity

Add a test-sonic-similarity WASM plugin that implements both
GetSonicSimilarTracks and FindSonicPath via the generated sonicsimilarity
PDK. The plugin returns deterministic test data with decreasing similarity
scores and supports error injection via config. Adapter tests verify the
full round-trip through the WASM plugin including error handling. Also
includes regenerated PDK code from make gen.

* docs: update README to include new capabilities and usage examples for plugins

Signed-off-by: Deluan <deluan@navidrome.org>

* test(e2e): enhance sonic similarity tests with additional scenarios and mock provider

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: address PR review feedback for sonic similarity

Fix incorrect field names in README documentation ({from, to} →
{startSong, endSong}) and remove unnecessary XML serialization test
from e2e suite since OpenSubsonic endpoints only use JSON.

* refactor: rename Matcher methods for conciseness

Rename MatchSongsToLibrary to MatchSongs and MatchSongsToLibraryMap to
MatchSongsIndexed. The Matcher receiver already establishes the "to
library" context, making that suffix redundant, and "Indexed" better
describes the intent (preserving input ordering) than "Map" which
describes the data structure.

* refactor: standardize variable naming for media files in sonic path methods

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: simplify plugin loading by introducing adapter constructors

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2026-04-27 17:50:09 -04:00
..
Responses AlbumInfo with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumInfo with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumInfo without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumInfo without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumList with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses AlbumList with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses AlbumList with OS data should match .JSON fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses AlbumList with OS data should match .XML fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses AlbumList without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumList without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses AlbumWithSongsID3 with data should match .JSON fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 with data should match .XML fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 without data should match .JSON fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 without data should match .XML fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 without data should match OpenSubsonic .JSON fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses AlbumWithSongsID3 without data should match OpenSubsonic .XML fix(subsonic): never omit duration for AlbumID3 (#5217) 2026-03-17 13:20:10 -04:00
Responses Artist with data and MBID and Sort Name should match .JSON feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
Responses Artist with data and MBID and Sort Name should match .XML feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
Responses Artist with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist with OpenSubsonic data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist with OpenSubsonic data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Artist without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ArtistInfo with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ArtistInfo with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ArtistInfo without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ArtistInfo without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Bookmarks with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Bookmarks with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Bookmarks without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Bookmarks without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Child with data should match .JSON fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child with data should match .XML fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child without data should match .JSON fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child without data should match .XML fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child without data should match OpenSubsonic .JSON fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Child without data should match OpenSubsonic .XML fix(subsonic): always include mandatory title field in Child responses 2026-03-15 13:36:26 -04:00
Responses Directory with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Directory with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Directory without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Directory without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses EmptyResponse should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses EmptyResponse should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Genres with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Genres with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Genres without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Genres without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Indexes with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Indexes with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Indexes without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Indexes without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses InternetRadioStations with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses InternetRadioStations with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses InternetRadioStations without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses InternetRadioStations without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses License should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses License should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Lyrics with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Lyrics with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Lyrics without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Lyrics without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses LyricsList with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses LyricsList with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses LyricsList without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses LyricsList without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses MusicFolders with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses MusicFolders with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses MusicFolders without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses MusicFolders without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses OpenSubsonicExtensions with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses OpenSubsonicExtensions with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses OpenSubsonicExtensions without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses OpenSubsonicExtensions without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Playlists with data should match .JSON feat(subsonic): add OS readonly and validUntil properties in playlists (#4993) 2026-02-06 19:35:54 -05:00
Responses Playlists with data should match .XML fix(subsonic): restore public attribute for playlists in XML responses 2026-02-23 18:17:44 -05:00
Responses Playlists without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Playlists without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses PlayQueue with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses PlayQueue with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses PlayQueue without data should match .JSON feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
Responses PlayQueue without data should match .XML feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
Responses PlayQueueByIndex with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses PlayQueueByIndex with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses PlayQueueByIndex without data should match .JSON feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
Responses PlayQueueByIndex without data should match .XML feat(subsonic): implement indexBasedQueue extension (#4244) 2025-11-09 12:52:05 -05:00
Responses ScanStatus with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ScanStatus with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ScanStatus without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses ScanStatus without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Shares with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Shares with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses Shares with only required fields should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Shares with only required fields should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Shares without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Shares without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SimilarSongs with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses SimilarSongs with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses SimilarSongs without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SimilarSongs without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SimilarSongs2 with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses SimilarSongs2 with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses SimilarSongs2 without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SimilarSongs2 without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses SonicMatches with data should match .JSON feat(subsonic): add sonicSimilarity extension as plugin capability (#5419) 2026-04-27 17:50:09 -04:00
Responses SonicMatches with data should match .XML feat(subsonic): add sonicSimilarity extension as plugin capability (#5419) 2026-04-27 17:50:09 -04:00
Responses SonicMatches without data should match .JSON feat(subsonic): add sonicSimilarity extension as plugin capability (#5419) 2026-04-27 17:50:09 -04:00
Responses SonicMatches without data should match .XML feat(subsonic): add sonicSimilarity extension as plugin capability (#5419) 2026-04-27 17:50:09 -04:00
Responses TopSongs with data should match .JSON feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses TopSongs with data should match .XML feat: new "Subsonic Minimal Clients" configuration option (#4850) 2026-01-16 05:55:21 -05:00
Responses TopSongs without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses TopSongs without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses User with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses User with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses User without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses User without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Users with data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Users with data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Users without data should match .JSON chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Responses Users without data should match .XML chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00