~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/hydraulophone

An unofficial YouTube Music app for iPhone, iPad, and Mac.

0
0
main
73 lines · 3.8 KB Raw History
# ADR 0002 — Session-scoped catalog state and explicit quality preferences

Date: 2026-09-23

Status: Accepted for the iPhone prototype

## Context

The owner requested a useful Home screen, pagination, refresh/caching, and the
first quality settings after the playback checkpoint. Standard HLS is reliable
in the simulated iPhone. High Opus is experimental: some proof-assisted streams
have played, but subsequent URLs have been rejected by the CDN.

## Decision

- Keep the existing `MusicService` interface compatible. An optional
  `PaginatedCatalogMusicService` refinement adds pages to search, library,
  playlist tracks, album tracks, and Home. Player/session operations are not
  paginated.
- Keep continuation strings opaque and in memory. A view owns its current
  pagination chain; missing, empty, and repeated continuations stop automatic
  loading. Refresh replaces the chain only after the new first page succeeds.
- Cache parsed first pages in a bounded, actor-owned memory decorator rather
  than persisting account catalogs or raw responses. Coalesced callers can
  cancel independently. Session and resource generations reject late results.
- Block catalog views during session changes. The service/cache accepts the
  new session before the UI opens that session's catalog scope. Sign-out hides
  private content immediately and leaves the app on the required sign-in
  screen after underlying invalidation completes.
- Home is a native vertical list of server-provided shelves, with horizontal
  artwork cards, server filter chips, and real song/playlist/album actions.
  Do not manufacture personalized recommendations or infer album browse IDs
  from playlist naming.
- Persist only non-secret quality preferences in `UserDefaults`. `AppModel`
  is the policy owner for Settings; Now Playing has no quality selector, and
  the playback layer remains the owner of media tasks and controls.
- Standard is fixed audio-only HLS, currently approximately 128 kb/s AAC.
  High prefers authenticated Opus at or above 200 kb/s and is labelled
  experimental. Missing sign-in, unknown network state, Low Data Mode, or an
  expensive connection without opt-in use Standard while preserving the saved
  High preference. An authenticated user can select High without runtime proof
  configuration; playback then reports the missing configuration instead of
  silently switching to Standard.
- A rejected High stream reports failure rather than silently claiming High
  while playing Standard. The user can select Standard to recover.
- Adaptive Auto remains a separate future delivery policy. A fixed Standard
  option is not labelled Auto, and a bitrate preference is not represented as
  proof that a stream played successfully.

## Alternatives

Disk caching would improve cold launch/offline browsing but would retain
private catalog data and require expiry, migration, and account deletion
semantics. Memory-only caching is the smaller, safer current feature.

Adding paging requirements to `MusicService` would break all existing fakes
and playback-only implementations. A refinement preserves those contracts.

Automatically downgrading any rejected High request could hide reliability
problems and contradict the explicit quality choice. Until that fallback has
an observable product policy, failure and manual recovery are more honest.

## Consequences and validation

Catalogs are not available offline after process termination. Refresh failures
retain visible content with an error. No credentials, proof tokens, direct
media URLs, or raw account payloads are stored in the catalog cache.

See [catalog protocol](../protocol/catalog-pagination.md),
[cache policy](../catalog-cache.md), and
[session handoff](../SESSION-HANDOFF.md) for request provenance and actual
simulator evidence. Device/background acceptance remains out of scope for
this run by the owner's instruction.