Skip to content

feat(backup): restore accounts and profiles, and export your own data - #3399

Merged
Quick104 merged 2 commits into
mainfrom
feat/backups-3-accounts
Nov 5, 2026
Merged

Quick104 merged 2 commits into
mainfrom
feat/backups-3-accounts

Conversation

@Quick104

@Quick104 Quick104 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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

  • 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.
  • Contract and repository checks: verify-apiv2-openapi, -web-types, -fixtures, -contract (additive only), verify-migrations, verify-migration-ledger, verify-size-ratchet, verify-local-paths, verify-settings-bindings: 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.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3399/

Risks

  • 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.

🤖 Generated with Claude Code

Note

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).

Macroscope summarized 17b9879.

@silo-triage silo-triage Bot added the size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. label Nov 2, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T16:27:05.563285Z 17b9879 New commits
🔒 Security Review ✅ Completed 2026-11-05T16:31:45.183762Z 17b9879 New commits

Security findings

Advisory findings (23)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

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.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

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.
Profile-data export, import, and comparison
internal/catalog/ratings_backup.go, internal/notifications/backup_userdata.go, internal/usercollections/backup_userdata.go, internal/userstore/pgstore/backup_userdata.go, internal/userstore/pgstore/backup_preferences*.go, internal/userstore/pgstore/backup_section_overrides.go, internal/watchlist/backup_userdata.go, internal/watchstate/backup_userdata.go
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.
Account matching and selective restore
internal/backup/users_*.go, internal/backup/selective*.go, internal/auth/repository.go, internal/access/*, internal/userstore/pgstore/profiles.go, migrations/sql/20261031184936_backup_restored_accounts.sql
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.

Estimated code review effort: 5 (Critical) | ~120 minutes

Change: Feature

Merge Risk: Low · previous review 0474f

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: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive 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 Passed checks: 4 passed

Check name Status Explanation
Title check Passed The title clearly summarizes the main changes: restoring accounts and profiles and adding personal data export.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed 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

@silo-triage silo-triage Bot added enhancement New feature or request priority: P2 Limited scope, workaround exists, or polish stacked Base is another open PR; merge in stack order named in the body labels Nov 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddc0a1bb42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/backup/users_pending.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: ddc0a1bb42

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security 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.

Comment thread internal/backup/profile_transfer.go Resolved
@macroscopeapp

macroscopeapp Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

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.

Posted via Macroscope — v1 validation impact

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79aa22ba58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffcf3f698b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/backup/users_apply.go Resolved
@macroscopeapp

macroscopeapp Bot commented Nov 2, 2026

Copy link
Copy Markdown

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.

Posted via Macroscope — v1 validation impact

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: f6781aef47

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f5b158565

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/backup/users_apply.go Resolved

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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: 0e039e90-6a36-46ca-980b-133627cbaef9
Commits

Reviewing files that changed from the base of the PR and between 112edd2 and f6781ae.

Files selected for processing: 104
  • cmd/silo/backup_wiring.go
  • cmd/silo/main.go
  • contracts/api/v2/breaking-approvals.json
  • contracts/api/v2/openapi.json
  • docs/README.md
  • docs/architecture/backups.md
  • docs/backups-api.md
  • internal/access/group_store.go
  • internal/access/groups.go
  • internal/access/groups_test.go
  • internal/access/resolver.go
  • internal/api/router.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_backup_restore.go
  • internal/apiv2/admin_backups.go
  • internal/apiv2/document.go
  • internal/apiv2/profile_transfer.go
  • internal/apiv2/profile_transfer_test.go
  • internal/apiv2/router.go
  • internal/audiobooks/cred_validator.go
  • internal/auth/api_key_metadata.go
  • internal/auth/owner.go
  • internal/auth/repository.go
  • internal/auth/repository_login_test.go
  • internal/backup/listing.go
  • internal/backup/manifest.go
  • internal/backup/profile_transfer.go
  • internal/backup/profile_transfer_test.go
  • internal/backup/restoreset.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_plan.go
  • internal/backup/selective_postgres_test.go
  • internal/backup/service.go
  • internal/backup/userdata/userdata.go
  • internal/backup/users_apply.go
  • internal/backup/users_collection_map.go
  • internal/backup/users_items.go
  • internal/backup/users_locks.go
  • internal/backup/users_locks_postgres_test.go
  • internal/backup/users_pending.go
  • internal/backup/users_pending_decode.go
  • internal/backup/users_plan.go
  • internal/backup/users_postgres_test.go
  • internal/backup/users_registry.go
  • internal/catalog/ratings_backup.go
  • internal/contractledger/ledger_test.go
  • internal/historyimport/repo.go
  • internal/historyimport/repo_admin.go
  • internal/notifications/backup_userdata.go
  • internal/passwordreset/repository.go
  • internal/passwordreset/service.go
  • internal/passwordreset/service_test.go
  • internal/plugins/user_identity_lookup.go
  • internal/usercollections/backup_map.go
  • internal/usercollections/backup_userdata.go
  • internal/usercollections/backup_userdata_postgres_test.go
  • internal/usercollections/backup_userdata_test.go
  • internal/userstore/history_lock.go
  • internal/userstore/pgstore/backup_preferences.go
  • internal/userstore/pgstore/backup_preferences_pending.go
  • internal/userstore/pgstore/backup_section_overrides.go
  • internal/userstore/pgstore/backup_userdata.go
  • internal/userstore/pgstore/preference_settings_tx.go
  • internal/userstore/pgstore/profiles.go
  • internal/userstore/pgstore/progress.go
  • internal/userstore/types.go
  • internal/watchlist/backup_userdata.go
  • internal/watchlist/backup_userdata_postgres_test.go
  • internal/watchlist/titles.go
  • internal/watchlist/titles_import.go
  • internal/watchlist/titles_repo.go
  • internal/watchstate/backup_userdata.go
  • internal/watchstate/backup_userdata_postgres_test.go
  • migrations/sql/20261031184936_backup_restored_accounts.sql
  • scripts/ci/db-contracts.txt
  • web/src/App.tsx
  • web/src/api/v2/adminBackupRestore.ts
  • web/src/api/v2/adminBackups.ts
  • web/src/api/v2/operations.ts
  • web/src/api/v2/profileExport.ts
  • web/src/api/v2/schema.ts
  • web/src/lib/documentTitle.ts
  • web/src/lib/profileDataTypes.test.ts
  • web/src/lib/profileDataTypes.ts
  • web/src/lib/userSettingsNav.ts
  • web/src/pages/AdminBackupRestore.tsx
  • web/src/pages/admin-backups/BackupTable.tsx
  • web/src/pages/admin-backups/BackupWarningDetails.tsx
  • web/src/pages/admin-backups/RestoreChoose.tsx
  • web/src/pages/admin-backups/RestoreReview.tsx
  • web/src/pages/admin-backups/RestoreRows.tsx
  • web/src/pages/admin-backups/RestoreRun.tsx
  • web/src/pages/admin-backups/RestoreUsers.tsx
  • web/src/pages/admin-backups/restoreGroups.ts
  • web/src/pages/admin-backups/restoreModel.test.ts
  • web/src/pages/admin-backups/restoreModel.ts
  • web/src/pages/admin-backups/warningDetails.test.ts
  • web/src/pages/admin-backups/warningDetails.ts
  • web/src/pages/settings/YourDataSettings.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Comment thread internal/backup/restoreset_users.go Resolved
Comment thread internal/backup/restoreset_users.go Resolved
Comment thread internal/backup/users_plan.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 1f5b158565

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security 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.

Comment thread internal/watchlist/backup_userdata.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 1e8341e17b

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security 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.

Comment thread internal/backup/profile_transfer.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e8341e17b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/backup/users_pending.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49bfa1b597

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f1202e4d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/backup/users_plan.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a2c16f9ffb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/watchlist/backup_userdata.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: a2c16f9ffb

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security 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.

Comment thread internal/backup/profile_transfer.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick comments: 2
internal/usercollections/backup_userdata.go: 1

21-26: Trivial · Maintainability & Code Quality · Quick win

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.
internal/userstore/pgstore/backup_preferences.go: 1

27-31: Trivial · Maintainability & Code Quality · Quick win

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.

Files selected for processing: 32
  • contracts/api/v2/openapi.json
  • docs/architecture/backups.md
  • docs/backups-api.md
  • internal/apiv2/profile_transfer.go
  • internal/apiv2/profile_transfer_test.go
  • internal/backup/profile_transfer.go
  • internal/backup/profile_transfer_test.go
  • internal/backup/restoreset_read_test.go
  • internal/backup/restoreset_users.go
  • internal/backup/selective.go
  • internal/backup/selective_apply.go
  • internal/backup/selective_postgres_test.go
  • internal/backup/userdata/userdata.go
  • internal/backup/users_apply.go
  • internal/backup/users_collection_map.go
  • internal/backup/users_locks_postgres_test.go
  • internal/backup/users_pending.go
  • internal/backup/users_plan.go
  • internal/backup/users_postgres_test.go
  • internal/catalog/ratings_backup.go
  • internal/notifications/backup_userdata.go
  • internal/usercollections/backup_userdata.go
  • internal/usercollections/backup_userdata_test.go
  • internal/userstore/pgstore/backup_preferences.go
  • internal/userstore/pgstore/backup_preferences_pending.go
  • internal/userstore/pgstore/backup_userdata.go
  • internal/watchlist/backup_userdata.go
  • internal/watchlist/backup_userdata_postgres_test.go
  • internal/watchlist/titles_import.go
  • internal/watchstate/backup_userdata.go
  • internal/watchstate/backup_userdata_postgres_test.go
  • web/src/api/v2/schema.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6801d1458a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/backup/users_pending.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 6801d1458a

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security 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.

Comment thread internal/backup/profile_transfer.go Resolved
Comment thread internal/backup/profile_transfer.go Resolved
Comment thread internal/backup/restoreset_users.go Resolved
Comment thread docs/architecture/backups.md Resolved
Comment thread internal/apiv2/profile_transfer.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0474f15820

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/backup/profile_transfer.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick comments: 1
internal/backup/users_locks_postgres_test.go: 1

47-47: Trivial · Functional Correctness · Quick win

Filter the pg_locks checks on objsubid = 2.

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.

@Quick104
Quick104 force-pushed the feat/backups-3-accounts branch from 4b0cdf8 to 9294db8 Compare November 4, 2026 17:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9294db881c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/backup/profile_transfer.go Resolved
@Quick104
Quick104 force-pushed the feat/backups-2-selective-restore branch from 0f6b67c to 4dd1d69 Compare November 4, 2026 20:56
@Quick104
Quick104 force-pushed the feat/backups-3-accounts branch from 9294db8 to 07eed10 Compare November 4, 2026 20:56
@Quick104
Quick104 force-pushed the feat/backups-2-selective-restore branch from 4dd1d69 to 59908fa Compare November 5, 2026 05:11
@Quick104
Quick104 force-pushed the feat/backups-3-accounts branch 2 times, most recently from 2286fc2 to 5f186af Compare November 5, 2026 06:26
@Quick104
Quick104 force-pushed the feat/backups-2-selective-restore branch from 1694f84 to d8bceb0 Compare November 5, 2026 15:19
@Quick104
Quick104 force-pushed the feat/backups-3-accounts branch from 5f186af to e1b64ae Compare November 5, 2026 15:19
@Quick104
Quick104 force-pushed the feat/backups-2-selective-restore branch from d8bceb0 to cc385e7 Compare November 5, 2026 16:16
Base automatically changed from feat/backups-2-selective-restore to main November 5, 2026 16:16
Quick104 and others added 2 commits November 5, 2026 11:16
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]>
@Quick104
Quick104 force-pushed the feat/backups-3-accounts branch from e1b64ae to 17b9879 Compare November 5, 2026 16:17
@Quick104
Quick104 merged commit 1cfd740 into main Nov 5, 2026
10 checks passed
@silo-kody

silo-kody Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104
Quick104 deleted the feat/backups-3-accounts branch November 5, 2026 16:18
Comment on lines +63 to +65
if strings.TrimSpace(cfg.Field) == "" {
return json.RawMessage("{}"), nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Comment on lines +73 to +77
ids, err := collectionsNamed(ctx, tx, userdata.Owner{UserID: target.UserID, ProfileID: creator}, c.Name)
if err != nil || len(ids) != 1 {
return "", false, err
}
return ids[0], true, nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Security high

Carried collection mappings bypass profile visibility checks

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.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Comment on lines +303 to +307
if !quota.take() {
res.LeftOut++
continue
}
problem, err := createCollection(ctx, tx, target, c, items, &missingPosters, &droppedSchedules, quota)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Comment on lines +89 to +90
for _, o := range mine {
e, ok, err := overrideEntry(ctx, tx, o)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Performance medium

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.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

target.UserID, target.ProfileID, types, ids).Scan(&missing); err != nil {
return res, fmt.Errorf("comparing watchlist titles: %w", err)
}
res.Added, res.Unchanged = res.Added+missing, res.Unchanged+len(types)-missing

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Comment on lines +506 to +507
prev.HiddenBefore = laterCutoff(prev.HiddenBefore, e.HiddenBefore)
prev.RemovedBefore = laterCutoff(prev.removedBefore(), e.removedBefore())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

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

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Comment on lines +171 to +174
onError: (error, { file }) => {
if (needsPin(error))
setAfterPin(() => () => importData.mutate({ file, target: requireContext() }));
else setImportError(failureMessage(error));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug critical

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.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Comment on lines +193 to +200
if (capability.isError || capability.data?.state !== "available") {
return (
<div className="space-y-6">
{header}
<p className="text-muted-foreground text-sm">
{capability.isError
? "Couldn't check whether this server can export profile data. Reload the page to try again."
: "This server can't export or import profile data."}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

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.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: P2 Limited scope, workaround exists, or polish size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. stacked Base is another open PR; merge in stack order named in the body

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant