Context
Soft delete now retains source files and generated variants instead of deleting external storage after the database transaction. This is intentional: immutable versions and duplicated documents can share stored-file paths, so deleting an object merely because one document was soft-deleted is unsafe.
This design follow-up was split from #69 and the implementation plan in PR #71. Until this work is designed and approved, generated variants have the same retention behavior as their source files. There is no supported purge operation.
Problem
Byline cannot safely reclaim or regenerate generated media variants without first defining their identity, reproducibility, compatibility, and reference model across immutable document history and external storage.
IStorageProvider currently supports upload and delete, but has no provider-neutral read/download primitive. Persisted variant metadata records output name, path, dimensions, and format, but not the full recipe that produced the bytes. A source or variant path may also be retained by multiple immutable versions or duplicated documents.
Decisions required
- Decide whether variant storage paths remain persisted immutable identities or are derived dynamically from current rules.
- Define migration and compatibility behavior when variant path or naming rules change.
- Decide whether regenerated output must be byte-identical or only contract-equivalent.
- Define the generation recipe that must be persisted, including requested dimensions, fit, format, quality, and processor/version.
- Design a provider-neutral way to read retained source bytes.
- Define reference safety when immutable versions or duplicated documents share stored-file paths.
- Define behavior for legacy variants whose complete generation recipe is unavailable.
- Define retry and idempotency behavior across external storage and database state.
- Decide whether cleanup applies only to current-version variants or every immutable version.
Constraints
- Do not infer exclusive ownership of an object from a single document or version.
- Do not make external-storage deletion part of ordinary soft delete.
- Preserve adapter and storage-provider neutrality.
- A partial failure must not leave database metadata pointing at missing objects or delete paths still referenced by retained history.
- Existing retained variants must remain readable while any migration or regeneration is in progress.
Design deliverables
- An explicit object identity and reference model for source files and generated variants.
- A persisted recipe/versioning contract, including a legacy-data policy.
- Provider-neutral read, regenerate, write, and cleanup interfaces.
- Transaction/compensation and idempotency rules spanning database state and external storage.
- A rollout and compatibility plan for existing installations.
- Test scenarios covering shared references, immutable history, duplicates, retries, collisions, partial failures, and legacy variants.
- A decision on whether purge and regeneration are one operation family or separate workflows.
Relationship to #69
#69 releases the live path namespace on soft delete and deliberately retains stored assets. This issue owns the follow-on design needed before any irreversible source or generated-variant cleanup can be supported.
Context
Soft delete now retains source files and generated variants instead of deleting external storage after the database transaction. This is intentional: immutable versions and duplicated documents can share stored-file paths, so deleting an object merely because one document was soft-deleted is unsafe.
This design follow-up was split from #69 and the implementation plan in PR #71. Until this work is designed and approved, generated variants have the same retention behavior as their source files. There is no supported purge operation.
Problem
Byline cannot safely reclaim or regenerate generated media variants without first defining their identity, reproducibility, compatibility, and reference model across immutable document history and external storage.
IStorageProvidercurrently supports upload and delete, but has no provider-neutral read/download primitive. Persisted variant metadata records output name, path, dimensions, and format, but not the full recipe that produced the bytes. A source or variant path may also be retained by multiple immutable versions or duplicated documents.Decisions required
Constraints
Design deliverables
Relationship to #69
#69 releases the live path namespace on soft delete and deliberately retains stored assets. This issue owns the follow-on design needed before any irreversible source or generated-variant cleanup can be supported.