Add human WebUI closure of unknown jobs as final closed_unknown state (spec 1.31); bound agent sync restart interval
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-17 11:13:36 +01:00
parent 2660f6a88d
commit d6dfd01a9c
11 changed files with 363 additions and 29 deletions
+31
View File
@@ -34,6 +34,37 @@ pub fn initialize_ledger(db: &rusqlite::Connection) -> Result<()> {
Ok(())
}
/// Before a human WebUI closure replaces the unresolved local outcome, keep the
/// exact original outcome bytes once. A differing second copy fails closed.
pub(crate) fn retain_closure_original(
db: &rusqlite::Connection,
grant: Uuid,
original: &[u8],
closure: &[u8],
) -> Result<()> {
db.execute_batch("CREATE TABLE IF NOT EXISTS unknown_closure_originals(grant_id TEXT PRIMARY KEY, original_outcome BLOB NOT NULL, closure_outcome BLOB NOT NULL);")?;
let existing: Option<(Vec<u8>, Vec<u8>)> = db
.query_row(
"SELECT original_outcome,closure_outcome FROM unknown_closure_originals WHERE grant_id=?1",
[grant.to_string()],
|r| Ok((r.get(0)?, r.get(1)?)),
)
.optional()?;
match existing {
Some((old, done)) => ensure!(
done == closure && (old == original || original == closure),
"CLOSURE_ORIGINAL_CHANGED"
),
None => {
db.execute(
"INSERT INTO unknown_closure_originals VALUES(?1,?2,?3)",
params![grant.to_string(), original, closure],
)?;
}
}
Ok(())
}
/// Legacy split reservation API retained for old fixtures/readers. Production
/// callers use begin_execution so a crash cannot lose the original start witness.
pub fn consume(db: &mut rusqlite::Connection, p: &ExecutionPermitPayload) -> Result<()> {