pub struct CommitAttemptLog {
pub attempt_number: usize,
pub agent: String,
pub strategy: String,
pub timestamp: DateTime<Local>,
pub prompt_size_bytes: usize,
pub diff_size_bytes: usize,
pub diff_was_truncated: bool,
pub raw_output: Option<String>,
pub extraction_attempts: Vec<ExtractionAttempt>,
pub validation_checks: Vec<ValidationCheck>,
pub outcome: Option<AttemptOutcome>,
}Expand description
Per-attempt log for commit message generation.
Captures all details about a single attempt to generate a commit message, providing a complete audit trail for debugging.
Fields§
§attempt_number: usizeAttempt number within this session
agent: StringAgent being used (e.g., “claude”, “glm”)
strategy: StringRetry strategy (e.g., “initial”, “strict_json”)
timestamp: DateTime<Local>Timestamp when attempt started
prompt_size_bytes: usizeSize of the prompt in bytes
diff_size_bytes: usizeSize of the diff in bytes
diff_was_truncated: boolWhether the diff was pre-truncated
raw_output: Option<String>Raw output from the agent (truncated if very large)
extraction_attempts: Vec<ExtractionAttempt>Extraction attempts with their results
validation_checks: Vec<ValidationCheck>Validation checks that were run
outcome: Option<AttemptOutcome>Final outcome of this attempt
Implementations§
Source§impl CommitAttemptLog
impl CommitAttemptLog
Sourcepub fn new(attempt_number: usize, agent: &str, strategy: &str) -> Self
pub fn new(attempt_number: usize, agent: &str, strategy: &str) -> Self
Create a new attempt log.
Sourcepub fn with_basics(
attempt_number: usize,
agent: &str,
strategy: &str,
prompt_size: usize,
diff_size: usize,
diff_was_truncated: bool,
) -> Self
pub fn with_basics( attempt_number: usize, agent: &str, strategy: &str, prompt_size: usize, diff_size: usize, diff_was_truncated: bool, ) -> Self
Create a new attempt log with basic info already set.
This is the functional equivalent of calling new() followed by
set_prompt_size() and set_diff_info(), avoiding let mut.
Sourcepub fn with_prompt_size(self, size: usize) -> Self
pub fn with_prompt_size(self, size: usize) -> Self
Set the prompt size (consuming builder).
Sourcepub fn with_diff_info(self, size: usize, was_truncated: bool) -> Self
pub fn with_diff_info(self, size: usize, was_truncated: bool) -> Self
Set the diff information (consuming builder).
Sourcepub fn with_raw_output(self, output: &str) -> Self
pub fn with_raw_output(self, output: &str) -> Self
Set the raw output from the agent (consuming builder).
Truncates very large outputs to prevent log file bloat.
Sourcepub fn add_extraction_attempt(self, attempt: ExtractionAttempt) -> Self
pub fn add_extraction_attempt(self, attempt: ExtractionAttempt) -> Self
Record an extraction attempt (consuming builder).
Sourcepub fn with_outcome(self, outcome: AttemptOutcome) -> Self
pub fn with_outcome(self, outcome: AttemptOutcome) -> Self
Set the final outcome (consuming builder).
Sourcepub fn write_to_workspace(
&self,
log_dir: &Path,
workspace: &dyn Workspace,
) -> Result<PathBuf>
pub fn write_to_workspace( &self, log_dir: &Path, workspace: &dyn Workspace, ) -> Result<PathBuf>
Write this log to a file using workspace abstraction.
This is the architecture-conformant version that uses the workspace trait instead of direct filesystem access.
§Arguments
log_dir- Directory to write the log file to (relative to workspace)workspace- The workspace to use for filesystem operations
§Returns
Path to the written log file on success.
§Errors
Returns error if the operation fails.
Trait Implementations§
Source§impl Clone for CommitAttemptLog
impl Clone for CommitAttemptLog
Source§fn clone(&self) -> CommitAttemptLog
fn clone(&self) -> CommitAttemptLog
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CommitAttemptLog
impl RefUnwindSafe for CommitAttemptLog
impl Send for CommitAttemptLog
impl Sync for CommitAttemptLog
impl Unpin for CommitAttemptLog
impl UnsafeUnpin for CommitAttemptLog
impl UnwindSafe for CommitAttemptLog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more