Skip to main content

record_attempt

Function record_attempt 

Source
pub fn record_attempt(
    mana_dir: &Path,
    id: &str,
    attempt: AttemptRecord,
) -> Result<Unit, Error>
Expand description

Record a verify attempt result on a unit.

Appends an AttemptRecord to the unit’s attempt_log and persists. Use this when an external orchestrator completes a verify cycle and wants to record the outcome without going through the full close lifecycle.

§Errors

§Example

use mana_core::api::{record_attempt, AttemptRecord, AttemptOutcome};
use std::path::Path;
use chrono::Utc;

let now = Utc::now();
let attempt = AttemptRecord {
    num: 1,
    outcome: AttemptOutcome::Success,
    notes: Some("Passed on first attempt".to_string()),
    agent: Some("imp-agent".to_string()),
    started_at: Some(now),
    finished_at: Some(now),
};
record_attempt(Path::new("/project/.mana"), "1", attempt).unwrap();