2.6 KiB
2.6 KiB
Quality gates: youtube-provider
Criteria beyond the automatic tests (ytdy/src/lib.rs,
ytdy/src/engine.rs, plus orchestrator wiring). Each gate is pass/fail
by reading the code.
Engine (subprocess discipline)
- Every invocation is an argument list (
tokio::process::Command) — never a shell string; user input (terms, ids) can contain anything. - Every call is bounded: per-call timeout (
kill_on_dropso a timed out process dies), and captured stdout capped atMAX_STDOUT_BYTES. - All failures are typed
EngineErrors mapped toProviderErrorat the trait boundary; no subprocess condition panics. - Error/log output carries the binary path, exit status, and a bounded stderr summary — never full stderr, never stream URLs, never cookie file contents (the path alone is loggable).
- The cookies flag is appended to every call when configured; nothing else about login is stored or invented.
Provider semantics
- Search terms mirror tidal's: in-memory, deduplicated, implicit
recreation on stale paths, rename re-searches, delete idempotent —
and only
/youtube/searchchildren are creatable/editable/deletable. - Path parsing rejects foreign roots and malformed shapes with
MalformedPath; track paths are exactly<node>/<videoid>. - Downloadability follows the central rule (queueable or lists
tracks; children mirror
is_queable) applied in one place, not per-arm. durationfloats are truncated to whole seconds; missing title/uploader degrade to empty strings, never errors.- The playlists subtree exists only when logged in: absent from the
root listing and
MalformedPathwhen addressed directly.
Orchestrator wiring
ytdy::Client::initfailure (missing/broken binary) disables the provider with a warning — the server and every other provider keep running;get_lib_rootlistsyoutubeonly when enabled./youtubeis routed in everyProviderClientmethod (same completeness as/tidal), includingresolve_tracks_into, create/rename/delete.ytdy.tomlis written back after init like the other providers' configs.extension_formapsaudio/webm → webmso captures of YouTube audio get a sensible extension.
Hygiene
yt-dlpis declared indevenv.nix, never assumed installed.- New public items are documented; docs state error/edge behavior.
clippy -D warnings,fmt,taplo,markdownlintclean; all tests green; notodo!()left.architecture/youtube-provider.mdreconciled where the implementation diverged (esp. the playlists-feed invocation after the live probe).