You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(backup): restore accounts and profiles, and export your own data - #3399
Related issue: #2313
Validation tasks: changes #1197 C1 (Backups adds a second web admin path that creates accounts); changes #1235 C1 and C2 (profile import can replace notification preferences, and Your data sits beside Notifications in Account settings)
Accounts and profiles hold most of what people care about: watch history,
progress, ratings, watchlists, personal collections and preferences. After #3398, a backup still can't give one person their history back without
rolling back everyone else's, and a person can't take their own data to
another Silo server. This adds accounts to selective restore and gives every
profile an export and import of its own data.
Users section of the restore set: account login and policy fields and
profile fields, plus seven data types per profile, each owned by its
package (watch history and progress, ratings, favorites and watchlist,
personal collections, dismissals, preferences, notification preferences).
Credentials, sessions, API keys, devices and logs are never carried.
Matching: on the same server, by id. On another server, by username and
email with exactly one candidate. Profiles match only inside their account.
Access never widens: an existing account's password, role, permissions,
group, PIN and access fields are never changed. A new account is
selectable only if its access here, computed by the existing resolver, is
no wider than in the backup, field by field. Library access is remapped,
and restricted profiles never gain libraries.
Merge, never delete: newer progress wins, plays are combined, ratings
and favorites fill gaps, collections gain missing items. A read-only
comparison counts what a restore would change, so an account a restore
wouldn't change shows as "same". On shared development that comparison
takes about 4 s across 184 accounts and 246 profiles.
Locks: imports take account locks, then each type's locks, then write
rows, in the same order the app's own writers use.
Profile export and import:GET /api/v2/profile/export and POST /api/v2/profile/import, on a new Settings → Your data page. They act
only on the signed-in, PIN-verified profile and never carry account or
access fields.
Validation
Go: gofmt, build, go vet, and changed-line golangci-lint against the previous pull request: pass.
Web: tsc -b, eslint and prettier on changed files, and vitest: pass.
verify-route-inventory, verify-v1-route-freeze, verify-bidi and verify-case-collisions: pass.
Database tests against PostgreSQL 18: this pull request's contract tests pass (37 for the stack so far), covering matching, access never widening, merge rules, lock order and profile import scope.
On a development server, a preview of a backup taken earlier compared all 184 accounts as unchanged in about 4 s; restoring 4 accounts into a fresh sandbox and previewing again showed them unchanged.
In a sandbox built from this branch, an account and a profile deleted after a backup came back from the web restore: the profile under its original account, and the account with its backup-time password. An existing account kept the password and stream limit set after the backup, and newer local progress won. A profile export imported into another account's profile added its history, rating and favorite once; importing it a second time changed nothing, and importing it into a PG-limited child profile added nothing.
Migration: a table recording which accounts and profiles a restore
created, so repeating a restore finds them. Additive.
Restored passwords: a restored new account keeps its password hash from
the backup. This includes administrators, which the preview marks.
Behavior change: a restore no longer rewrites preference values that
differ only in form, such as three-letter versus two-letter language codes,
or hidden-library lists naming deleted libraries.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or says there is none.
AI Disclosure
Harness: T3 Code with Claude Code
Tool(s): Claude Code with subagents; OpenAI Codex CLI for independent review
Model(s): claude-opus-5-5; gpt-6.1-sol (review)
Involvement: Fully AI-generated. The maintainer tested the backups work it came from on a development server; the diff awaits human review.
Adversarial review: gpt-6.1-sol reviewed the backups work read-only in repeated rounds; every finding was fixed or answered before this branch was cut.
Add account and profile restore to backups, plus profile self-export/import
Adds a users section to backup restore sets. Admins can preview, select, and restore whole accounts and profiles, with account matching, policy and library mapping, profile limits, and per-data-type results. The web restore chooser and report views support account/profile rows, data-type selection, and caveats. New backup_restored_accounts and backup_restored_profiles tables map source accounts and profiles to local IDs (migration).
Adds a per-profile export/import API (GET /api/v2/profile/export, POST import, capability endpoint) with a 64 MiB import limit, strict document validation, and a new Your Data settings page (profile_transfer.go, YourDataSettings.tsx).
Registers profile data types (watch state, ratings, watchlist, collections, dismissals, preferences, notifications) behind a shared userdata contract, with bounded concurrency for pending decode previews and advisory-lock ordering for imports.
Backups now record items omitted from the restore set; such manifests get warning status, and the UI groups omitted accounts by reason (warningDetails.ts).
Behavioral Change: restore-set format version 2 adds the users section; version 1 archives without it remain readable. startAdminBackupRestore responses gain new enum values and user-selection fields per breaking-approvals.json (feat(backup): restore accounts and profiles, and export your own data #3399). Profile transfer is disabled on the SQLite user-store backend (newProfileTransfer returns nil).
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The change adds account and profile data to backup and selective restore, including profile-data merging, preview, and reporting. It adds profile-scoped export and import endpoints and a settings page. Backup listings and restore interfaces now report items omitted from restore sets.
Changes: Account, profile, and backup data transfer
Layer / File(s)
Summary
Profile-data contracts and registration internal/backup/userdata/*, internal/backup/users_registry.go, internal/historyimport/repo.go, internal/userstore/history_lock.go, internal/userstore/types.go
Shared contracts and registration define profile-data export, validation, import, pending comparisons, preparation, and reference mapping.
Data types export and validate profile data, merge it into profiles, and compare pending changes. Implementations cover ratings, notifications, collections, preferences, dismissals, favorites, watchlists, and watch history.
Restore-set user documents and omissions internal/backup/restoreset*.go, internal/backup/restoreset_users.go, internal/backup/manifest.go, internal/backup/listing.go, internal/backup/service.go
Restore sets carry account and profile documents. Failed or oversized account exports are reported as omissions in backup summaries and can produce a warning status.
Restore previews match accounts and profiles and check policy and capacity. Restore applies selected profile data and reports per-account outcomes.
Profile export and import service internal/backup/profile_transfer.go, internal/apiv2/profile_transfer.go, internal/apiv2/router.go, internal/api/router.go, cmd/silo/*
The service exports profile data and validates and imports profile documents. API endpoints provide capability discovery, export, and import with profile verification and size limits.
API contracts and documentation contracts/api/v2/*, internal/apiv2/admin_backup_restore.go, internal/apiv2/admin_backups.go, web/src/api/v2/*, docs/backups-api.md, docs/architecture/backups.md
Schemas and documentation describe account/profile restore, profile transfer, and omitted restore-set items.
Admin restore and omission interfaces web/src/pages/AdminBackupRestore.tsx, web/src/pages/admin-backups/*, web/src/lib/profileDataTypes.ts, web/src/lib/documentTitle.ts, web/src/lib/userSettingsNav.ts
The admin interface selects accounts, profiles, and data types. It displays restore outcomes and groups omission warnings. The settings navigation adds a Your Data entry.
Your Data settings page web/src/App.tsx, web/src/pages/settings/YourDataSettings.tsx, web/src/api/v2/profileExport.ts
The settings page checks transfer availability, downloads exports, and imports JSON files into the active profile. PIN verification supports retries for protected operations.
The restore-set readability problems from earlier rounds are fixed, and the profile-limit mismatch is gone. What remains is a documentation gap about replaced credentials, a possible memory spike on very large profile imports, and a small test-hardening item. None of these should block merge.
Security architecture risk: Low · up to 0474f
The new restore and transfer paths handle sensitive account and profile data, but the inspected controls preserve destination ownership, restrict administrative restoration, and contain database changes within transactions. No introduced security defect was established. Some processing and recovery behavior remains only partially verified.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
observed — Ordinary transfer requests operate within an authenticated account's selected profile. Administrative restore has broader server-wide identity impact because it can recreate multiple accounts, credentials, roles, and profiles, but its routes retain the acting-admin gate. Transfer admission also limits concurrent use of shared processing resources.
Trust Boundaries and Controls
observed — Authentication precedes profile resolution, and resolution loads the requested profile through the authenticated user's store. Import additionally refuses skipped PIN verification. Scoped API keys are denied routes outside their explicit allowlist, which contains no transfer endpoints; unscoped keys retain their existing broader authority and PIN exemption.
observed — Restore application locks and replans the compared account or access group before applying selections. New-account effective policy is checked field by field for widening, changed targets are refused, and existing account security fields are not overwritten. Durable profile mappings include the local account owner.
Resilience and Maintainability Implications
observed — Restore failure containment is per account item rather than all-or-nothing across the entire restore. Transactional mappings support repeat execution without selecting a newly created owner again, while previously committed accounts remain independently reportable. Blob writes are outside database atomicity and may leave unreachable blobs after failure; the inspected evidence does not show those blobs becoming cross-account references.
Pre-merge checks: 4 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 68.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly summarizes the main changes: restoring accounts and profiles and adding personal data export.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description states the problem, approach, validation, evidence, and risks for adding account and profile restore to backups and adding profile export/import. It matches the changeset, which includ…
Full details: Description check
Explanation
The description states the problem, approach, validation, evidence, and risks for adding account and profile restore to backups and adding profile export/import. It matches the changeset, which includes restore-set users sections, profile transfer endpoints, migrations, and the Your Data settings page. The description also includes checklist and AI disclosure content, which is not required for this check but does not make it off-topic.
Full details: Docstring Coverage
Explanation
Docstring coverage is 68.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 208 functions across 63 files. (5 skipped: 4 unsupported, 1 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Selective restore adds a second Web admin path for creating accounts under Admin Backups. That entry point was not present in the build-807 validation record for #1197 C1; the existing user-management form is unchanged, but the new path needs a re-check after merge. Please update the line to Validation tasks: changes #1197 C1.
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.
Your Data adds a visible entry beside Notifications in the Account settings navigation, and profile import can replace notification preferences. The existing controls and delivery path are unchanged, but #1235 C1 and C2 were validated before this entry point existed; please re-check them after merge. Extend the line to Validation tasks: changes #1197 C1; changes #1235 C1 and C2.
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.
A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Correct the type comment: collection groups are carried.
The comment says that restored collections are ungrouped and that collection groups are not carried. The code does the opposite:
personalCollection.Group exports the group.
ensureGroup creates or finds the group on import.
regroup puts an existing ungrouped collection into the group.
Tables() claims user_collection_groups.
docs/architecture/backups.md also documents group restore. A maintainer who trusts this comment will misread the merge contract.
Proposed fix
-// exactly one gains the items it lacks, several leave it out. Restored-// collections are ungrouped; collection groups are account-wide shelf layout-// and are not carried. Audiobookshelf rows that share the table are not-// carried either.+// exactly one gains the items it lacks, its shares, and its group when it+// is ungrouped here; several leave it out. A collection's shelf group is+// carried and found by slug or label, or created. Audiobookshelf rows that+// share the table are not carried.
Correct the type comment: section overrides are carried.
The comment says home section overrides (user_settings) are never carried. However, preferencesDocument.SectionOverrides is exported, imported, and compared. Tables() also claims user_settings. The architecture doc lists the page layout as part of preferences. Update the comment to match the contract.
Proposed fix
-// Never carried: device-scoped values (they belong to device registrations),-// account-scoped values, and home section overrides (user_settings), which-// name this server's sections. A value that names a library is remapped-// through the library map; navigation documents that name libraries,-// sections, and collections are kept only on the same server.+// Never carried: device-scoped values (they belong to device registrations)+// and account-scoped values. The home and library page layouts+// (user_settings section overrides) are carried, with sections, libraries,+// and collections mapped here. A value that names a library is remapped+// through the library map; navigation documents that name libraries,+// sections, and collections are kept only on the same server.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: ad825b21-ee75-45f0-94af-2ee5b56dafa1
Commits
Reviewing files that changed from the base of the PR and between f6781ae and a2c16f9.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
The three pg_locks queries match advisory locks on classid and objid only. The account locks and the history lock use the two-int form, pg_advisory_lock(int, int), which sets objsubid = 2. The single-bigint form splits its key into classid and objid and sets objsubid = 1. Without the objsubid filter, a bigint-key lock held by another session could match and give a false pass or a wrong pid. This is a test-only risk, but it weakens the lock-order assertion.
Add AND objsubid = 2 to the pg_locks predicates at Lines 47, 66, 67, and 248. Add it to the w subquery at Line 48 as well.
Proposed fix for `blockedImporter`
- WHERE l.locktype = 'advisory' AND l.granted AND l.classid = $1 AND l.objid = $2+ WHERE l.locktype = 'advisory' AND l.objsubid = 2 AND l.granted AND l.classid = $1 AND l.objid = $2
Based on learnings: to verify that advisory locks are held, query pg_locks with locktype='advisory', matching classid/objid AND objsubid=2.
Also applies to: 66-68, 248-248
Source: Learnings
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 240a6e7f-4d54-481c-a5ba-51dd37a64b5e
Commits
Reviewing files that changed from the base of the PR and between 9fa0628 and 0474f15.
Files selected for processing: 34
cmd/silo/backup_wiring.go
contracts/api/v2/openapi.json
docs/architecture/backups.md
docs/backups-api.md
internal/apiv2/admin_backup_restore.go
internal/apiv2/admin_backups.go
internal/backup/listing.go
internal/backup/manifest.go
internal/backup/restoreset_decode.go
internal/backup/restoreset_read.go
internal/backup/restoreset_read_test.go
internal/backup/restoreset_users.go
internal/backup/restoreset_write.go
internal/backup/selective.go
internal/backup/selective_apply.go
internal/backup/selective_blobs.go
internal/backup/selective_plan.go
internal/backup/selective_postgres_test.go
internal/backup/service.go
internal/backup/tables.go
internal/backup/userdata/userdata.go
internal/backup/users_apply.go
internal/backup/users_locks_postgres_test.go
internal/backup/users_pending.go
internal/backup/users_postgres_test.go
internal/usercollections/backup_userdata.go
scripts/ci/db-contracts.txt
web/src/api/v2/schema.ts
web/src/pages/AdminBackupRestore.tsx
web/src/pages/admin-backups/RestoreReview.tsx
web/src/pages/admin-backups/RestoreRows.tsx
web/src/pages/admin-backups/restoreGroups.ts
web/src/pages/admin-backups/restoreModel.test.ts
web/src/pages/admin-backups/restoreModel.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Adds accounts and profiles to the selective restore: the preview pairs
each backed-up account with this server's, and the restore writes the
chosen ones with their profiles, watch state, preferences and personal
collections, keeping each household's primary profile and the stricter of
the access settings. Profiles can be exported and imported by their
owners, with bounded documents and set-based imports.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ofile may see
A profile's own import mapped a library collection sort preference to any
admin collection still on the server, hidden or outside the profile's
libraries, so an import could probe which hidden collections exist. It
now applies catalog.CanAccessLibraryCollection, the check the sort
editor's save makes, and leaves out a collection the profile may not see
exactly as one that is gone.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Import discards legacy collection sort modes
Legacy configurations such as manual_pins are replaced with {}, changing restored collection behavior. Preserve supported legacy modes when cfg.Field is blank, as the collection editor does.
Prompt for LLM
File internal/usercollections/backup_canonical.go, lines 63-65:
Import discards legacy collection sort modes
A legacy sort configuration such as `{"mode":"manual_pins"}` is replaced with `{}` during import, although the collection editor explicitly preserves that independent mode. Preserve supported legacy mode configurations so restored collections retain their original behavior.
A restore can attach a sort preference to another profile's private collection. Apply the fallback mapping's ownership or sharing check before returning ids[0].
Prompt for LLM
File internal/usercollections/backup_map.go, lines 73-77:
Carried collection mappings bypass profile visibility checks
A carried collection mapped to another profile is returned without checking whether the target profile can see it, unlike the fallback mapping. A restore can consequently attach a sort preference to another profile's private collection; apply the same ownership or sharing check before returning the mapped ID.
The reason will be displayed to describe this comment to others. Learn more.
Rejected collections consume slots needed by later valid collections
A rejected collection consumes a quota slot, potentially leaving out later valid collections. Restore the slot when createCollection returns a problem, or consume it only after successful creation.
Prompt for LLM
File internal/usercollections/backup_userdata.go, lines 303-307:
Rejected collections consume slots needed by later valid collections
A collection that fails validation or exceeds the definition-byte quota still consumes a collection quota slot, leaving later valid collections out even when the profile has room. Restore the slot when `createCollection` returns a problem, or consume it only after successful creation.
The reason will be displayed to describe this comment to others. Learn more.
Section override export issues database queries for each override
Large layouts can require thousands of sequential database round trips per export because overrideEntry queries each override's references. Batch-load the referenced sections and collections before constructing the entries.
Prompt for LLM
File internal/userstore/pgstore/backup_section_overrides.go, lines 89-90:
Section override export issues database queries for each override
Each exported override invokes `overrideEntry`, which queries its section and can query up to four referenced collections separately. A layout with thousands of overrides therefore requires thousands of sequential database round trips per export; batch-load the referenced sections and collections before constructing the entries.
Suggested code:
// Batch-load referenced sections and collections before processing overrides.
The reason will be displayed to describe this comment to others. Learn more.
Untrusted watchlist preview reports titles as added when they are omitted
The preview reports missing titles as added even though importTitles omits them. Count them as LeftOut when target.Untrusted is set.
Prompt for LLM
File internal/watchlist/backup_userdata.go, line 327:
Untrusted watchlist preview reports titles as added when they are omitted
For an untrusted import, the preview counts missing watchlist titles as additions even though `importTitles` always leaves them out. Classify missing titles as `LeftOut` when `target.Untrusted` is set so the preview matches the actual restore.
Suggested code:
if target.Untrusted {
res.LeftOut += missing
} else {
res.Added += missing
}
res.Unchanged += len(types) - missing
The reason will be displayed to describe this comment to others. Learn more.
Merging mapped history hides can incorrectly advance the removal cutoff
Using the merged prev.HiddenBefore to resolve a null removed_before can hide history that neither source removed. Resolve both original removal cutoffs before updating prev.HiddenBefore.
Prompt for LLM
File internal/watchstate/backup_userdata.go, lines 506-507:
Merging mapped history hides can incorrectly advance the removal cutoff
When two source items map to one local item, a null `removed_before` is interpreted using the already-merged `hidden_before`, rather than the original cutoff. This can advance the removal cutoff and hide history that neither source hide removed; resolve both original removal cutoffs before updating `prev.HiddenBefore`.
Suggested code:
removed := laterCutoff(prev.removedBefore(), e.removedBefore())
prev.HiddenBefore = laterCutoff(prev.HiddenBefore, e.HiddenBefore)
prev.RemovedBefore = removed
The reason will be displayed to describe this comment to others. Learn more.
PIN retry can import a file into a different profile
Switching profiles while the PIN dialog is open can import the file into the wrong profile and overwrite its preferences. Preserve the original target and cancel the retry if the active profile no longer matches it.
Prompt for LLM
File web/src/pages/settings/YourDataSettings.tsx, lines 171-174:
PIN retry can import a file into a different profile
The PIN retry captures the current profile rather than the profile that selected the file, so switching profiles while the PIN dialog is open can import the file into the wrong profile and overwrite its preferences. Preserve the original target and cancel the retry if the active profile no longer matches it.
The reason will be displayed to describe this comment to others. Learn more.
PIN verification is unreachable when the capability request requires it
A locked profile receiving profile_verification_required cannot reach the PIN dialog and sees only a reload message. Prompt for PIN verification on this capability error, then refetch the capability.
Prompt for LLM
File web/src/pages/settings/YourDataSettings.tsx, lines 193-200:
PIN verification is unreachable when the capability request requires it
A PIN-locked profile without a verified session receives `profile_verification_required` from the capability request, but the error branch only displays a reload message, so the user cannot reach either button that opens the PIN dialog. Handle this capability error by prompting for PIN verification and refetching the capability afterward.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enhancementNew feature or requestpriority: P2Limited scope, workaround exists, or polishsize/XXXL3000+ added + deleted lines (all files); change volume, not priority.stackedBase is another open PR; merge in stack order named in the body
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: #2313
Validation tasks: changes #1197 C1 (Backups adds a second web admin path that creates accounts); changes #1235 C1 and C2 (profile import can replace notification preferences, and Your data sits beside Notifications in Account settings)
Accounts and profiles hold most of what people care about: watch history,
progress, ratings, watchlists, personal collections and preferences. After
#3398, a backup still can't give one person their history back without
rolling back everyone else's, and a person can't take their own data to
another Silo server. This adds accounts to selective restore and gives every
profile an export and import of its own data.
Stacked on #3398.
Approach
profile fields, plus seven data types per profile, each owned by its
package (watch history and progress, ratings, favorites and watchlist,
personal collections, dismissals, preferences, notification preferences).
Credentials, sessions, API keys, devices and logs are never carried.
email with exactly one candidate. Profiles match only inside their account.
group, PIN and access fields are never changed. A new account is
selectable only if its access here, computed by the existing resolver, is
no wider than in the backup, field by field. Library access is remapped,
and restricted profiles never gain libraries.
and favorites fill gaps, collections gain missing items. A read-only
comparison counts what a restore would change, so an account a restore
wouldn't change shows as "same". On shared development that comparison
takes about 4 s across 184 accounts and 246 profiles.
rows, in the same order the app's own writers use.
GET /api/v2/profile/exportandPOST /api/v2/profile/import, on a new Settings → Your data page. They actonly on the signed-in, PIN-verified profile and never carry account or
access fields.
Validation
go vet, and changed-line golangci-lint against the previous pull request: pass.verify-apiv2-openapi,-web-types,-fixtures,-contract(additive only),verify-migrations,verify-migration-ledger,verify-size-ratchet,verify-local-paths,verify-settings-bindings: pass.tsc -b, eslint and prettier on changed files, and vitest: pass.verify-route-inventory,verify-v1-route-freeze,verify-bidiandverify-case-collisions: pass.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3399/
Risks
created, so repeating a restore finds them. Additive.
the backup. This includes administrators, which the preview marks.
differ only in form, such as three-letter versus two-letter language codes,
or hidden-library lists naming deleted libraries.
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Add account and profile restore to backups, plus profile self-export/import
backup_restored_accountsandbackup_restored_profilestables map source accounts and profiles to local IDs (migration).GET /api/v2/profile/export,POSTimport, capability endpoint) with a 64 MiB import limit, strict document validation, and a new Your Data settings page (profile_transfer.go, YourDataSettings.tsx).userdatacontract, with bounded concurrency for pending decode previews and advisory-lock ordering for imports.startAdminBackupRestoreresponses gain new enum values and user-selection fields per breaking-approvals.json (feat(backup): restore accounts and profiles, and export your own data #3399). Profile transfer is disabled on the SQLite user-store backend (newProfileTransferreturns nil).Macroscope summarized 17b9879.