Wire preserved update control, health evidence and record publication
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -394,3 +394,27 @@ pub fn permit_request(offer: &JobOffer, permit: &ExecutionPermit) -> Result<Requ
|
||||
authorization_id: Uuid::parse_str(&offer.authorization_id)?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Read-only control scheduling after an updater intentionally restarted the
|
||||
/// agent. This is NOT a handoff proof, approval, start grant or effect lease.
|
||||
/// A fresh independently authenticated helper snapshot still decides whether
|
||||
/// the exact original is inflight or must become Unknown; existing Unknown is
|
||||
/// never returned as a candidate and no local outcome is changed here.
|
||||
pub fn needs_update_control(
|
||||
db: &Connection,
|
||||
ledger: &Connection,
|
||||
binding: &Binding,
|
||||
) -> Result<bool> {
|
||||
let mut candidates = 0;
|
||||
for (offer, grant) in interrupted(db, ledger, binding)? {
|
||||
let job = binding.job(&offer.payload_bytes)?;
|
||||
if !matches!(job.action, rmm_domain::jobs::Action::UpdateAgent { .. }) || grant.is_empty() {
|
||||
continue;
|
||||
}
|
||||
if recover_interrupted_outcome(ledger, binding, &offer, &grant)?.is_none() {
|
||||
candidates += 1;
|
||||
}
|
||||
}
|
||||
ensure!(candidates <= 1, "UPDATE_MULTIPLE_PENDING_CONTROLS");
|
||||
Ok(candidates == 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user