Implement exact bootstrap recovery and artifact GC

This commit is contained in:
ms2k 2026-07-17 05:38:43 +09:00
commit d25942596f

View file

@ -514,6 +514,51 @@ fn prepared_lower_release_changes_only_the_lease_phase() {
.unwrap();
assert_eq!(active.validate_transition_to(&release), Ok(()));
let ParticipantOwnership::PreparedLower(mut with_anchor_evidence) =
release_ownership(ParticipantRole::PreparedLower)
else {
unreachable!()
};
with_anchor_evidence.released_state_anchor = Some(StateAnchorReleaseEvidence {
daemon: process(120),
user_namespace: namespace(),
mount_namespace: NamespaceIdentity {
device: DeviceId::new(121),
inode: InodeId::new(122),
},
mount: mount(),
});
let release_with_anchor_evidence = Participant::snapshot(
generation_id(),
ParticipantRole::PreparedLower,
ParticipantState::ReleaseIntent,
Some(ParticipantOwnership::PreparedLower(
with_anchor_evidence.clone(),
)),
)
.unwrap();
assert_eq!(
active.validate_transition_to(&release_with_anchor_evidence),
Ok(())
);
with_anchor_evidence
.released_state_anchor
.as_mut()
.unwrap()
.mount
.mount_id = MountId::new(123);
let changed_release_evidence = Participant::snapshot(
generation_id(),
ParticipantRole::PreparedLower,
ParticipantState::ReleaseIntent,
Some(ParticipantOwnership::PreparedLower(with_anchor_evidence)),
)
.unwrap();
assert_eq!(
release_with_anchor_evidence.validate_transition_to(&changed_release_evidence),
Err(RecordTransitionError::EvidenceChanged)
);
let ParticipantOwnership::PreparedLower(mut changed) =
release_ownership(ParticipantRole::PreparedLower)
else {