pub fn validate_repository_immutability(
old: &RepositorySpec,
new: &RepositorySpec,
) -> Vec<ValidationError>Expand description
Reject changes to create-time-immutable Repository fields on UPDATE (ADR-0005
§7): create.splitter, create.hash, create.encryption, create.ecc. Returns
every changed field so a user sees them all at once. Empty ⇒ no immutable change.
encryption (the password Secret reference) is intentionally NOT in this set — only
the resolved password value is fixed in the kopia format, and the reference is not a
reliable proxy for it (see [diff_immutable_repo_fields]). Renaming the Secret is fine.
use kopiur_api::repository::RepositorySpec;
use kopiur_api::validate::validate_repository_immutability;
// Unchanged splitter → accepted.
assert!(validate_repository_immutability(&spec(Some("FIXED-4M")), &spec(Some("FIXED-4M"))).is_empty());
// Changed splitter → rejected.
assert!(!validate_repository_immutability(&spec(Some("FIXED-4M")), &spec(Some("DYNAMIC"))).is_empty());