Add reviewed Windows scope completion and idle certificate renewal; deploy completion API
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-16 10:25:25 +01:00
parent ebcad08731
commit bb4ffe518d
43 changed files with 5146 additions and 50 deletions
+73 -14
View File
@@ -706,6 +706,8 @@ pub enum NativeService {
Agent,
General,
Full,
WindowsAgent,
WindowsHelper,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
@@ -714,6 +716,9 @@ pub enum NativeFileRole {
HelperBinary,
FullConfig,
FullPin,
WindowsSettings,
WindowsPin,
WindowsTimeProfile,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NativeEffectStage {
@@ -747,9 +752,9 @@ impl NativeEffectClaim {
self.claimed_at
}
}
pub struct PreparedReturnClaims {
pub struct PreparedReturnClaims<const N: usize = 3> {
pub return_ledger: NativeEffectClaim,
pub starts: [NativeEffectClaim; 3],
pub starts: [NativeEffectClaim; N],
}
fn native_context(
db: &Connection,
@@ -781,6 +786,9 @@ fn native_role(role: NativeFileRole) -> rmm_updater_handoff::FileRole {
NativeFileRole::HelperBinary => F::HelperBinary,
NativeFileRole::FullConfig => F::LinuxFullConfig,
NativeFileRole::FullPin => F::LinuxFullPin,
NativeFileRole::WindowsSettings => F::WindowsSettings,
NativeFileRole::WindowsPin => F::WindowsPin,
NativeFileRole::WindowsTimeProfile => F::WindowsTimeProfile,
}
}
fn native_service(service: NativeService) -> rmm_updater_handoff::Service {
@@ -789,6 +797,8 @@ fn native_service(service: NativeService) -> rmm_updater_handoff::Service {
NativeService::Agent => S::LinuxAgent,
NativeService::General => S::LinuxGeneralHelper,
NativeService::Full => S::LinuxFullHelper,
NativeService::WindowsAgent => S::WindowsAgent,
NativeService::WindowsHelper => S::WindowsHelper,
}
}
fn native_key(effect: &NativeEffect) -> Result<String> {
@@ -976,6 +986,50 @@ pub fn prepare_return_and_starts(
return_event: &[u8],
now: DateTime<Utc>,
) -> Result<PreparedReturnClaims> {
prepare_return_for(
db,
guard,
grant,
expected_head,
return_event,
now,
[
NativeService::General,
NativeService::Full,
NativeService::Agent,
],
)
}
/// Windows' independently qualified SYSTEM helper returns the SAME retained
/// ledger before exactly Helper -> Agent. No Linux Full/General identity or
/// startup claim is invented. This is evidence, never a restart/resume token.
pub fn prepare_windows_return_and_starts(
db: &mut Connection,
guard: &impl UpdateParticipantGuard,
grant: Uuid,
expected_head: &str,
return_event: &[u8],
now: DateTime<Utc>,
) -> Result<PreparedReturnClaims<2>> {
prepare_return_for(
db,
guard,
grant,
expected_head,
return_event,
now,
[NativeService::WindowsHelper, NativeService::WindowsAgent],
)
}
fn prepare_return_for<const N: usize>(
db: &mut Connection,
guard: &impl UpdateParticipantGuard,
grant: Uuid,
expected_head: &str,
return_event: &[u8],
now: DateTime<Utc>,
sequence: [NativeService; N],
) -> Result<PreparedReturnClaims<N>> {
let tx = db.transaction_with_behavior(TransactionBehavior::Immediate)?;
let (h, d, mut j) = native_context(&tx, guard, grant, now)?;
ensure!(
@@ -985,8 +1039,21 @@ pub fn prepare_return_and_starts(
"UPDATE_NATIVE_RETURN_ROLE"
);
ensure!(
h.stop_set
.contains(&rmm_updater_handoff::Service::LinuxFullHelper),
(sequence.as_slice()
== [
NativeService::General,
NativeService::Full,
NativeService::Agent
]
&& h.stop_set
.contains(&rmm_updater_handoff::Service::LinuxFullHelper))
|| (sequence.as_slice() == [NativeService::WindowsHelper, NativeService::WindowsAgent]
&& h.pin_transition == rmm_updater_handoff::PinTransition::WindowsCodePairClockV1
&& h.stop_set
== [
rmm_updater_handoff::Service::WindowsAgent,
rmm_updater_handoff::Service::WindowsHelper
]),
"UPDATE_NATIVE_FULL_PROFILE_REQUIRED"
);
let missing:u64=tx.query_row("SELECT count(*) FROM agent_update_native_claims c LEFT JOIN agent_update_native_observations o ON c.grant_id=o.grant_id AND c.effect_key=o.effect_key WHERE c.grant_id=?1 AND o.effect_key IS NULL",[grant.to_string()],|r|r.get(0))?;
@@ -1004,11 +1071,7 @@ pub fn prepare_return_and_starts(
&NativeEffect::ReturnLedger,
NativeEffectStage::Claim,
)?;
for service in [
NativeService::General,
NativeService::Full,
NativeService::Agent,
] {
for service in sequence {
guard.verify_native_effect(
&h,
&d,
@@ -1021,11 +1084,7 @@ pub fn prepare_return_and_starts(
let return_ledger =
insert_native_claim(&tx, &h, j.head_sha256(), NativeEffect::ReturnLedger, now)?;
let mut starts = Vec::new();
for service in [
NativeService::General,
NativeService::Full,
NativeService::Agent,
] {
for service in sequence {
starts.push(insert_native_claim(
&tx,
&h,