Clarify ref expiry in the collection contract

This commit is contained in:
Archipelago 2026-11-17 10:06:14 +00:00
parent df592257ad
commit 3b172f8ed2

View file

@ -97,7 +97,7 @@ pub(crate) fn preconditions(deployments: &[Deployment]) -> Result<(), String> {
}
/// Create missing keep refs for the complete protected commit graph. Existing
/// refs are never removed here; their retirement must use readiness-bound policy.
/// refs are not removed here; `apply` expires stale ones after computing this set.
pub(crate) fn keep_ref_sync(existing: &[String], protected: &BTreeSet<String>)
-> Vec<(String, String)> {
let mut create = Vec::new();
@ -341,7 +341,8 @@ pub fn apply() -> Result<(), String> {
// Remove only our own keep refs for commits that are no longer a deployment or
// a plan/intent input. Those deployments were already retired by OSTree's own
// finalize-staged retention; keeping the artificial ref would pin their objects
// forever and defeat the collection. Service/history refs remain untouched.
// forever and defeat the collection. Superseded local composition refs go too;
// deployments, `stable/*`, plans and generation history stay.
for (name, _) in stale_keep_refs(&refs, &protected) {
repository(&["refs", "--delete", &name])?;
}