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
+122 -7
View File
@@ -752,6 +752,12 @@ impl<V: Ed25519Verifier> HelperSync<V> {
validate_decision(row, local, d)?;
if d.unlock {
let bytes = unlock_outcome(row, d, current_boot)?;
let preserve = crate::windows_system_nonstart::preserve_original_unlock(
&tx,
&self.binding,
row.grant_id,
&bytes,
)?;
ensure!(
tx.execute(
"UPDATE consumed SET result=?2 WHERE grant_id=?1",
@@ -759,10 +765,12 @@ impl<V: Ed25519Verifier> HelperSync<V> {
)? == 1,
"ROOT_CONSUMPTION_MISSING"
);
tx.execute(
"UPDATE execution_evidence SET outcome=?2 WHERE grant_id=?1",
params![row.grant_id.to_string(), bytes],
)?;
if !preserve {
tx.execute(
"UPDATE execution_evidence SET outcome=?2 WHERE grant_id=?1",
params![row.grant_id.to_string(), bytes],
)?;
}
unlocked.push(row.grant_id);
} else {
safe &= definitive(row)
@@ -1401,12 +1409,16 @@ fn load_rows(
&& attempt_id == job.attempt_id.to_string(),
"LOCAL_REQUEST_BINDING"
);
if let (Some(a), Some(b)) = (&finished, &last) {
let resolved =
crate::windows_system_nonstart::effective_outcome(db, Some(binding), permit.grant_id)?;
if resolved.is_none()
&& let (Some(a), Some(b)) = (&finished, &last)
{
ensure!(canonical(a)? == canonical(b)?, "LOCAL_OUTCOME_CONFLICT");
}
let mut outcome_bytes = last
let mut outcome_bytes = resolved
.as_deref()
.or(finished.as_deref())
.or(last.as_deref().or(finished.as_deref()))
.map(canonical)
.transpose()?
.unwrap_or_default();
@@ -1890,3 +1902,106 @@ fn unique_summaries(rows: &[AttemptView]) -> Result<BTreeMap<(Uuid, Uuid), &Atte
}
Ok(map)
}
/// Exact closed administrative nonstart221 cache materialization. This does not
/// capture, apply a Sync, advance a checkpoint, or create an execution lease.
pub(crate) fn refresh_closed_nonstart_221(db: &Connection, binding: &Binding) -> Result<()> {
use rmm_domain::windows_system_nonstart as closed;
let expected =
crate::windows_system_nonstart::effective_outcome(db, Some(binding), closed::GRANT)?
.context("NONSTART_REFRESH_AUTHENTICATED_COMPLETION_REQUIRED")?;
let raw: Vec<u8> = db.query_row(
"SELECT snapshot FROM helper_sync_captures WHERE checkpoint=413",
[],
|r| r.get(0),
)?;
let snapshot: Snapshot = serde_json::from_slice(&raw)?;
ensure!(
snapshot.checkpoint == 413
&& snapshot.boot_id == closed::BOOT
&& snapshot.attempts.len() == 1,
"NONSTART_REFRESH_ORIGINAL_CAPTURE"
);
let mut original = snapshot.attempts[0].clone();
ensure!(
original.grant_id == closed::GRANT
&& original.job_id == closed::JOB
&& original.attempt_id == closed::ATTEMPT
&& original.state == "unknown"
&& original.outcome_sha256 == closed::UNKNOWN_SHA256,
"NONSTART_REFRESH_ORIGINAL_ATTEMPT"
);
let prior_revision = original.revision;
original.revision = 0;
let prior_fingerprint = hash(&serde_json::to_vec(&original)?);
let (count,revision,fingerprint):(u64,u64,String)=db.query_row("SELECT (SELECT count(*) FROM helper_sync_rows),revision,fingerprint FROM helper_sync_rows WHERE grant_id=?1",[closed::GRANT.to_string()],|r|Ok((r.get(0)?,r.get(1)?,r.get(2)?)))?;
ensure!(
count == 1 && revision == prior_revision && fingerprint == prior_fingerprint,
"NONSTART_REFRESH_EXACT_OLD_CACHE"
);
let rows = load_rows(
db,
binding,
true,
HelperIdentity::System,
&crate::crypto::DalekVerifier,
None,
)?;
ensure!(
rows.len() == 1
&& rows[0].grant_id == closed::GRANT
&& rows[0].state == "failed"
&& rows[0].outcome_bytes == expected
&& rows[0].outcome_sha256 == hash(&expected)
&& rows[0].revision == revision.checked_add(1).context("REVISION_OVERFLOW")?,
"NONSTART_REFRESH_EXACT_DERIVED_CACHE"
);
let checked = load_rows(
db,
binding,
false,
HelperIdentity::System,
&crate::crypto::DalekVerifier,
None,
)?;
ensure!(
checked.len() == 1
&& checked[0].grant_id == closed::GRANT
&& checked[0].outcome_bytes == expected
&& checked[0].revision == rows[0].revision,
"NONSTART_REFRESH_READ_ONLY_VALIDATOR"
);
Ok(())
}
/// SDK-only no-effect fixture surface: actual materialization/read validation,
/// strictly an in-memory database with the single original incident grant.
pub(crate) fn nonstart221_memory_rows(
db: &Connection,
binding: &Binding,
refresh: bool,
) -> Result<Vec<LocalAttempt>> {
let path: String = db.query_row(
"SELECT file FROM pragma_database_list WHERE name='main'",
[],
|r| r.get(0),
)?;
ensure!(
path.is_empty()
&& db.query_row("SELECT count(*) FROM consumed", [], |r| r.get::<_, u64>(0))? == 1
&& db.query_row(
"SELECT EXISTS(SELECT 1 FROM consumed WHERE grant_id=?1)",
[rmm_domain::windows_system_nonstart::GRANT.to_string()],
|r| r.get::<_, bool>(0)
)?,
"NONSTART_CONTRACT_MEMORY_ONLY"
);
load_rows(
db,
binding,
refresh,
HelperIdentity::System,
&crate::crypto::DalekVerifier,
None,
)
}