mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-10 03:30:59 +00:00
Add GitCheckpointFailed event and align with logging/events strategy
- Add GitCheckpointFailed variant to WorkflowRunEvent with node_id and error fields - Add trace() arm at ERROR level per logging strategy (operation cannot continue) - Add rename_fields rule to default node_label from node_id - Emit the event before returning ArcError::Engine on checkpoint failure - Update events-strategy.md with the new event in the checkpoints table - Add rename_fields serialization test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2620a43950
commit
9e35c4a472
2 changed files with 30 additions and 0 deletions
|
|
@ -2048,6 +2048,12 @@ impl WorkflowRunEngine {
|
|||
last_git_sha = Some(sha);
|
||||
}
|
||||
Err(e) => {
|
||||
self.services
|
||||
.emitter
|
||||
.emit(&WorkflowRunEvent::GitCheckpointFailed {
|
||||
node_id: node.id.clone(),
|
||||
error: e.clone(),
|
||||
});
|
||||
return Err(ArcError::Engine {
|
||||
message: format!(
|
||||
"git checkpoint commit failed for node '{}': {e}",
|
||||
|
|
|
|||
|
|
@ -117,6 +117,10 @@ pub enum WorkflowRunEvent {
|
|||
status: String,
|
||||
git_commit_sha: String,
|
||||
},
|
||||
GitCheckpointFailed {
|
||||
node_id: String,
|
||||
error: String,
|
||||
},
|
||||
EdgeSelected {
|
||||
from_node: String,
|
||||
to_node: String,
|
||||
|
|
@ -382,6 +386,9 @@ impl WorkflowRunEvent {
|
|||
} => {
|
||||
debug!(run_id, node_id, status, "Git checkpoint");
|
||||
}
|
||||
Self::GitCheckpointFailed { node_id, error } => {
|
||||
error!(node_id, error, "Git checkpoint commit failed");
|
||||
}
|
||||
Self::EdgeSelected {
|
||||
from_node,
|
||||
to_node,
|
||||
|
|
@ -773,6 +780,7 @@ fn rename_fields(event_name: &str, fields: &mut serde_json::Map<String, serde_js
|
|||
} else if event_name == "SubgraphCompleted"
|
||||
|| event_name == "CheckpointSaved"
|
||||
|| event_name == "GitCheckpoint"
|
||||
|| event_name == "GitCheckpointFailed"
|
||||
{
|
||||
default_node_label(fields);
|
||||
}
|
||||
|
|
@ -1686,6 +1694,22 @@ mod tests {
|
|||
assert_eq!(fields["node_label"], "plan");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rename_fields_git_checkpoint_failed() {
|
||||
let event = WorkflowRunEvent::GitCheckpointFailed {
|
||||
node_id: "fix_lints".to_string(),
|
||||
error: "git add failed (exit 1): fatal: not a git repository".to_string(),
|
||||
};
|
||||
let (name, fields) = flatten_event(&event);
|
||||
assert_eq!(name, "GitCheckpointFailed");
|
||||
assert_eq!(fields["node_id"], "fix_lints");
|
||||
assert_eq!(fields["node_label"], "fix_lints");
|
||||
assert_eq!(
|
||||
fields["error"],
|
||||
"git add failed (exit 1): fatal: not a git repository"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rename_fields_sandbox_snapshot_pulling() {
|
||||
let event = WorkflowRunEvent::Sandbox {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue