Collaborative Playlist · Scope
Requirements and Invariants
The public interview report defines playlist management and reordering. Spotify documents ordered items, collaboration, pagination, item provenance, and version snapshots. The concurrency contract below makes those behaviors implementable.
Source-backed behavior
- Create and update playlists.
- View ordered playlist contents.
- Add, remove, replace, and reorder entries.
- Paginate large playlists.
- Record who added an item and when.
- Support public, private, and collaborative status.
- Return a version identifier and apply mutations to create a new snapshot.
Interview contract
- Authorized collaborators can edit the same playlist concurrently.
- Clients receive accepted mutations in playlist order.
- Retries preserve idempotency.
- Reconnect retrieves mutations after a known version.
- Duplicate tracks remain valid, distinct entries.
- Every accepted mutation is durable before acknowledgement.
Hard invariants
- One
operation_idproduces at most one accepted mutation. - Every accepted mutation receives exactly one playlist version.
- Versions increase monotonically within a playlist.
- A removed entry stays removed when a delayed move arrives.
- Every materialized playlist equals its snapshot plus subsequent mutations.
Quality targets to clarify
| Dimension | Interview question |
|---|---|
| Playlist size | Typical and maximum entries? |
| Editors | How many simultaneous collaborators? |
| Latency | Target for local feedback and remote propagation? |
| Offline mode | Read-only cache or queued offline mutations? |
| History | Audit only, or user-visible undo and restore? |
| Permissions | Owner, editor, viewer, and link-sharing rules? |
Variable sizing
mutation QPS = active editors × edits/editor/secondfanout events/s = accepted mutations/s × connected collaboratorshistory bytes/day = mutations/day × average event bytesSource material provides behavior and version semantics while leaving traffic figures open. State assumptions aloud and size from the chosen interview numbers.
Scope boundaries
- Audio delivery, licensing, recommendations, and playback queue behavior form separate systems.
- The playlist stores media references and ordered metadata.
- Presence, selections, and drag previews remain ephemeral.
- Mutation history can power audit, repair, and optional undo.