navidrome/plugins/testdata
Kendall Garner b0c6d2e444
feat(plugins): add scrobbles access to PDK (#5795)
* initial scrobble api

* feat: add scrobble retrieval api

* address feedback (1)

* fix spelling

* be explicit about get

* add primary key field, update index, remove rowid references

* use unix timestamp for input and output

* initial api, some testing

* add tests, add count retrieval

* add docs, test for rejected user

* add permission validation for scrobble retriever

* chore(plugins): fix typos in scrobble retriever

Rename newScrobbleRetreverService, and fix FromTImestamp/nonero in the
ScrobbleRetriever doc comments, which generate into the Go and Rust PDKs.
Also corrects two mislabelled test entries.

* fix(plugins): make scrobble pagination order deterministic

Sorting only by submission_time left the order of equal timestamps up to the
query planner, but the cursor skips ties by offset, so an unstable order can
repeat or drop scrobbles between pages. Break ties on scrobbles.id, which the
existing scrobbles_user_time index already yields for free.

Descending is now honoured for every combination of From/To rather than only
when both or neither is set. This changes the default for a lone ToTimestamp
from newest-first to oldest-first.

* refactor(plugins): return the next page's options from GetScrobbles

Paging previously meant reading NextTimestamp and Cursor off the response and
deciding where each belonged: NextTimestamp into FromTimestamp when ascending
or ToTimestamp when descending, and Cursor copied every time, including when 0.
Both are silent data-loss bugs when a plugin gets them wrong.

GetScrobbles now returns the options for the following page, or nil when the
range is exhausted, so a plugin passes the value straight back and repeats.
ScrobbleCursor and ScrobbleList are gone; the query itself is unchanged.

* docs(plugins): warn against setting ScrobbleOptions.Offset manually

The all-ties carry rule assumes Offset counts already-returned rows at the
boundary timestamp, which only holds for the options GetScrobbles returns.
A hand-built From+Offset combination can silently skip scrobbles, so document
the field as managed pagination state instead of a generic skip.

* docs(plugins): document the ScrobbleRetriever host service in the README

Covers the manifest permissions (including the users requirement), the four
host functions, the options/ref field tables, and the pagination loop with
its two gotchas: the host-managed offset and the adjusted range on the
returned next options.

* chore(plugins): regenerate scrobble retriever stub with nil-safe accessors

---------

Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2026-08-08 22:13:29 -04:00
..
partial-metadata-agent feat(plugins): New Plugin System with multi-language PDK support (#4833) 2026-01-14 19:22:48 -05:00
test-artwork feat(plugins): New Plugin System with multi-language PDK support (#4833) 2026-01-14 19:22:48 -05:00
test-cache-plugin feat(plugins): New Plugin System with multi-language PDK support (#4833) 2026-01-14 19:22:48 -05:00
test-config feat(plugins): add JSONForms-based plugin configuration UI (#4911) 2026-01-19 20:51:00 -05:00
test-kvstore feat(plugins): add TTL support, batch operations, and hardening to kvstore (#5127) 2026-02-28 23:12:17 -05:00
test-library fix(plugins): confine plugin filesystem mounts to their root (#5881) 2026-08-02 12:27:08 -04:00
test-lyrics refactor(lyrics): single ParseLyrics entry point + all-format plugin lyrics (#5632) 2026-06-19 18:25:35 -04:00
test-matcher feat(plugins): expose the song Matcher as a host service (#5643) 2026-07-01 11:19:15 -04:00
test-metadata-agent feat(plugins): share plugin DTOs via a types package (#5655) 2026-06-29 21:20:33 -04:00
test-scheduler feat(plugins): New Plugin System with multi-language PDK support (#4833) 2026-01-14 19:22:48 -05:00
test-scrobble-retriever feat(plugins): add scrobbles access to PDK (#5795) 2026-08-08 22:13:29 -04:00
test-scrobbler feat(plugins): add PlaybackReport to scrobbler capability (#5452) 2026-05-02 16:14:53 -04:00
test-sonic-similarity feat(plugins): share plugin DTOs via a types package (#5655) 2026-06-29 21:20:33 -04:00
test-storage-plugin feat(plugins): implement plugin specific storage (#5839) 2026-08-03 14:23:42 -04:00
test-subsonicapi-plugin feat(plugins): add SubsonicAPI CallRaw, with support for raw=true binary response for host functions (#4982) 2026-02-04 15:48:08 -05:00
test-taskqueue feat(plugins): add TaskQueue host service for persistent background task queues (#5116) 2026-03-03 13:48:49 -05:00
test-users feat(plugins): New Plugin System with multi-language PDK support (#4833) 2026-01-14 19:22:48 -05:00
test-websocket feat(plugins): change websockets Data field type to []byte for binary support 2026-03-02 16:38:00 -05:00
Makefile feat(plugins): New Plugin System with multi-language PDK support (#4833) 2026-01-14 19:22:48 -05:00
test-storage-plugin-2 feat(plugins): implement plugin specific storage (#5839) 2026-08-03 14:23:42 -04:00