1 ADR 0119 ownership transfer is a db level ownership move with sender scoped satellite cleanup, not a copy
Forgejo Actions edited this page 2026-11-01 19:37:55 +00:00

ADR 0119: Ownership transfer is a DB-level ownership move with sender-scoped satellite cleanup, not a copy

Status: accepted Date: 2026-11-01

Context

Memories is owner-first: media_items and original_assets are owned via media_owner_profiles, sharing flows through contributions to sharing groups, and people/face discovery results are sender-scoped. Users want to hand media permanently to another household user. Alternatives: (B) copy-on-transfer creating new OriginalAsset/MediaItem rows for the recipient, or (C) a co-ownership model with multiple owners. Copying duplicates library objects and orphans discovery/person links; co-ownership is a large domain change with YAGNI cost for a household where group sharing already exists.

Decision

Ownership transfer is a two-phase offer (sender proposes, recipient accepts/rejects). On acceptance, ownership moves at the database level in one transaction: media_items.owner_id and original_assets.owner_id change to the recipient's owner profile. StoredObject bytes do not move (content-addressed, already deduplicated across owners). Sender-scoped satellites are cleaned up: contributions to sharing groups are revoked, album_items memberships are removed (which also removes the items from public album share links), sender-scoped people/face discovery results (domain_key='people'), their class_instance_occurrences and class_occurrence_embeddings are deleted for the transferred items. Sender metadata overrides, sender user markers and sender-scoped worker media access grants are removed. Media carry transferred_from_owner_id/transferred_at provenance and an audit_events entry. Recipient rebuilds their own people model via existing re-run discovery. Rejected/cancelled offers change nothing.

Consequences

['No bytes move and backup/restore semantics are unchanged; ownership is a single truth column move.', 'Sender loses all access at acceptance; the transfer is irreversible after acceptance by design.', 'Sender people/identities keep their names and other occurrences; they only lose occurrences on transferred media.', 'Trash lifecycle state and derived assets travel with the item; derived assets may need regeneration for recipient policy defaults.', 'In-flight worker jobs referencing transferred media fail gracefully like media deletion.', 'Exports include transfer provenance for fidelity.']