Freeze minimal SYSTEM nonstart 221 closure and reproducible Windows source
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-16 21:07:24 +01:00
parent 510c069838
commit 559c4cb292
16 changed files with 2222 additions and 37 deletions
+67 -21
View File
@@ -40,10 +40,10 @@ pub trait SyncClock {
}
/// Full trusted UTC interval for crypto validity. Existing point-clock
/// providers retain their contract; interval providers override atomically.
fn bounds(&self) -> Result<(DateTime<Utc>,DateTime<Utc>)> {
let reading=self.reading()?;
ensure!(reading.own_wall<=reading.upper,"CLOCK_INTERVAL_ORDER");
Ok((reading.own_wall,reading.upper))
fn bounds(&self) -> Result<(DateTime<Utc>, DateTime<Utc>)> {
let reading = self.reading()?;
ensure!(reading.own_wall <= reading.upper, "CLOCK_INTERVAL_ORDER");
Ok((reading.own_wall, reading.upper))
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -80,8 +80,12 @@ pub struct Applied {
pub reason: String,
}
/// Diagnostics only; never accepted as an authorization or reusable lease.
#[derive(Clone,Copy)]
pub struct GateObservation {pub signed_ready:bool,pub local_applied:bool,pub helper_ack_pending:bool}
#[derive(Clone, Copy)]
pub struct GateObservation {
pub signed_ready: bool,
pub local_applied: bool,
pub helper_ack_pending: bool,
}
struct Gate {
channel: Channel,
until: DateTime<Utc>,
@@ -129,8 +133,12 @@ impl<V: Ed25519Verifier> ClientSync<V> {
self.channel = None;
self.pending = None;
}
pub fn gate_observation(&self)->Option<GateObservation> {
self.gate.as_ref().map(|g|GateObservation{signed_ready:g.ready,local_applied:g.local_applied,helper_ack_pending:g.helper.is_some()})
pub fn gate_observation(&self) -> Option<GateObservation> {
self.gate.as_ref().map(|g| GateObservation {
signed_ready: g.ready,
local_applied: g.local_applied,
helper_ack_pending: g.helper.is_some(),
})
}
pub fn validity_deadline(&self) -> Option<DateTime<Utc>> {
self.gate.as_ref().map(|gate| gate.until)
@@ -696,7 +704,14 @@ impl<V: Ed25519Verifier> ClientSync<V> {
&& attempt == d.attempt_id.to_string(),
"LOCAL_UNLOCK_CONSUMPTION_BINDING"
);
let previous = previous.context("LOCAL_UNLOCK_PREVIOUS_OUTCOME_MISSING")?;
let resolved = crate::windows_system_nonstart::effective_outcome(
&tx,
Some(&self.binding),
grant,
)?;
let previous = resolved
.or(previous)
.context("LOCAL_UNLOCK_PREVIOUS_OUTCOME_MISSING")?;
let prior = canonical_outcome_bytes(&serde_json::from_slice::<ReconciledOutcome>(
&previous,
)?)?;
@@ -717,14 +732,22 @@ impl<V: Ed25519Verifier> ClientSync<V> {
&& d.outcome_sha256.as_deref() == Some(hash(&bytes).as_str()),
"LOCAL_UNLOCK_CANONICAL_OUTCOME"
);
let preserve = crate::windows_system_nonstart::preserve_original_unlock(
&tx,
&self.binding,
grant,
&bytes,
)?;
tx.execute(
"UPDATE consumed SET result=?2 WHERE grant_id=?1",
params![grant.to_string(), bytes],
)?;
tx.execute(
"UPDATE execution_evidence SET outcome=?2 WHERE grant_id=?1",
params![grant.to_string(), bytes],
)?;
if !preserve {
tx.execute(
"UPDATE execution_evidence SET outcome=?2 WHERE grant_id=?1",
params![grant.to_string(), bytes],
)?;
}
}
tx.execute(
"INSERT INTO reconcile_consumption(decision_id,response) VALUES(?1,?2)",
@@ -820,16 +843,27 @@ pub fn archive_events(db: &Connection) -> Result<()> {
Ok(())
}
fn pending_ids(db: &Connection) -> Result<Vec<String>> {
let mut statement = db.prepare("SELECT id FROM job_events ORDER BY id")?;
let ids = statement
.query_map([], |r| r.get::<_, String>(0))?
let mut statement = db.prepare("SELECT id,payload FROM job_events ORDER BY id")?;
let rows = statement
.query_map([], |r| {
Ok((r.get::<_, String>(0)?, r.get::<_, Vec<u8>>(1)?))
})?
.collect::<rusqlite::Result<Vec<_>>>()?;
for id in &ids {
ensure!(!Uuid::parse_str(id)?.is_nil(), "INVALID_DURABLE_MESSAGE_ID");
let mut ids = vec![];
for (id, bytes) in rows {
ensure!(
!Uuid::parse_str(&id)?.is_nil(),
"INVALID_DURABLE_MESSAGE_ID"
);
let envelope = Envelope::decode(bytes.as_slice())?;
ensure!(envelope.message_id == id, "EVENT_IDENTITY_CONFLICT");
if !crate::windows_system_nonstart::retired_event(db, &envelope)? {
ids.push(id);
}
}
Ok(ids)
}
fn outcome(r: &JobResult) -> Result<ReconciledOutcome> {
pub(crate) fn outcome(r: &JobResult) -> Result<ReconciledOutcome> {
Ok(ReconciledOutcome {
state: r.state.clone(),
stdout: r.stdout.clone(),
@@ -950,7 +984,13 @@ fn attempts(db: &Connection, ledger: &Connection, binding: &Binding) -> Result<V
&& request.authorization_id.to_string() == offer.authorization_id,
"START_EVIDENCE_BINDING"
);
if last.is_some() {
if let Some(resolved) = crate::windows_system_nonstart::effective_outcome(
ledger,
Some(binding),
Uuid::parse_str(&grant_id)?,
)? {
stored = Some(resolved);
} else if last.is_some() {
stored = last;
}
}
@@ -1163,8 +1203,14 @@ fn ingest_helper(
)
.optional()?
.flatten();
let same = existing
let resolved = crate::windows_system_nonstart::effective_outcome(
ledger,
Some(binding),
Uuid::parse_str(&h.grant_id)?,
)?;
let same = resolved
.as_ref()
.or(existing.as_ref())
.map(|b| {
serde_json::from_slice::<ReconciledOutcome>(b)
.and_then(|o| canonical_outcome_bytes(&o))