feat(sync): give separate profiles their own encrypted collections

Merged
D3
2d ago
+228-15

OpenTubeX is getting separate profiles (OpenTubeX#3291). A separate profile keeps its own subscriptions, history, playlists and watch statistics, and each device syncs them while that profile is active. Clients need a place on the server for that data that older clients never read, so they can't mix it into their own.

The server now accepts history.<scope>, playlists.<scope>, subscriptions.<scope> and watchStats.<scope>, where <scope> is the profile ID in lowercase hex (up to 128 digits). Each has the size limit of its base collection. A new separateProfiles collection (8 MiB) holds the profiles' names and colors. DELETE /v1/encrypted_sync/{collection} (and its alias) deletes one of these scoped collections with its pending changes after the profile is deleted. It returns 204 even when the collection is already gone, and 400 for any shared collection. /health advertises separate_profiles: 1. The README documents the collections, the endpoint and the capability; prettier rewrapped the two tables it touched.

Proof: new tests check the scoped limits, which names are refused (uppercase, odd length, nested dots, slashes, other bases, too long), the capability, and the DELETE behavior against SQLite. cargo fmt --check, cargo clippy and cargo test (107 tests) pass. I also ran this branch locally and pointed the OpenTubeX network sync E2E tests from the app PR at it: 12 passed, including the new separate profile case, and 1 skipped because the server doesn't advertise playlist_thumbnails.

Reviewed with sol-loop: 3 rounds with gpt-6.1-sol on xhigh.
Sol verdict: approved

Changes made by Claude Opus 5.5 in Claude Code (T3 Code).