Add gated agent update planning, preserved handoff and Linux worker ports
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -42,7 +42,7 @@ pub fn consume(db: &mut rusqlite::Connection, p: &ExecutionPermitPayload) -> Res
|
||||
tx.commit()?;
|
||||
Ok(())
|
||||
}
|
||||
fn consume_in(db: &rusqlite::Connection, p: &ExecutionPermitPayload) -> Result<()> {
|
||||
pub(crate) fn consume_in(db: &rusqlite::Connection, p: &ExecutionPermitPayload) -> Result<()> {
|
||||
let unresolved: i64 = db.query_row(
|
||||
"SELECT count(*) FROM consumed WHERE result IS NULL",
|
||||
[],
|
||||
@@ -182,7 +182,7 @@ pub(crate) fn record_no_start_in(
|
||||
persist_outcome_in(db, p, &outcome)?;
|
||||
Ok(outcome)
|
||||
}
|
||||
fn validate_start_request(p: &ExecutionPermitPayload, request: &Request) -> Result<()> {
|
||||
pub(crate) fn validate_start_request(p: &ExecutionPermitPayload, request: &Request) -> Result<()> {
|
||||
ensure!(
|
||||
request.job_bytes.len() <= 65536
|
||||
&& request.permit_bytes.len() <= 8192
|
||||
@@ -227,7 +227,7 @@ pub fn persist_outcome(
|
||||
tx.commit()?;
|
||||
Ok(())
|
||||
}
|
||||
fn persist_outcome_in(
|
||||
pub(crate) fn persist_outcome_in(
|
||||
db: &rusqlite::Connection,
|
||||
p: &ExecutionPermitPayload,
|
||||
outcome: &Outcome,
|
||||
@@ -310,6 +310,22 @@ pub fn save_start(
|
||||
previous_boot_id: Uuid,
|
||||
recorded_at: DateTime<Utc>,
|
||||
) -> Result<()> {
|
||||
let bytes = start_witness_bytes(permit, request, previous_boot_id, recorded_at)?;
|
||||
db.execute(
|
||||
"INSERT INTO execution_evidence(grant_id,start) VALUES(?1,?2)",
|
||||
rusqlite::params![permit.grant_id.to_string(), bytes],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Exact existing start codec, also used to bind the immutable update handoff
|
||||
/// before atomic consumption. This does not persist or authorize anything.
|
||||
pub fn start_witness_bytes(
|
||||
_permit: &ExecutionPermitPayload,
|
||||
request: &Request,
|
||||
previous_boot_id: Uuid,
|
||||
recorded_at: DateTime<Utc>,
|
||||
) -> Result<Vec<u8>> {
|
||||
let job: JobPayload = serde_json::from_slice(&request.job_bytes)?;
|
||||
ensure!(!previous_boot_id.is_nil(), "ORIGINAL_BOOT_MISSING");
|
||||
let deadline = match job.action {
|
||||
@@ -322,9 +338,5 @@ pub fn save_start(
|
||||
let evidence = serde_json::json!({"previous_boot_id":previous_boot_id.to_string(),
|
||||
"reserved_at":recorded_at,"reconnect_deadline":deadline,"request":request,
|
||||
"reauthentication_required":true,"postconditions_passed":false});
|
||||
db.execute(
|
||||
"INSERT INTO execution_evidence(grant_id,start) VALUES(?1,?2)",
|
||||
rusqlite::params![permit.grant_id.to_string(), serde_json::to_vec(&evidence)?],
|
||||
)?;
|
||||
Ok(())
|
||||
Ok(serde_json::to_vec(&evidence)?)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user