mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-10 03:30:59 +00:00
Write final.patch (base_sha → HEAD) to logs_root after pipeline completes
Per-stage diff.patch files only capture incremental changes between checkpoints. This adds a comprehensive final.patch covering all changes from the run's base SHA to the final HEAD, written to logs_root for all execution environments. Especially important for Daytona where the sandbox is destroyed after the run. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9ef45204f6
commit
0f9606e9e3
3 changed files with 27 additions and 0 deletions
|
|
@ -1211,6 +1211,21 @@ impl PipelineEngine {
|
|||
final_git_commit_sha: last_git_sha.clone(),
|
||||
});
|
||||
|
||||
// Write final.patch: comprehensive diff from base_sha to HEAD
|
||||
if let (Some(ref mode), Some(ref base)) = (&config.git_checkpoint, &config.base_sha) {
|
||||
let patch = match mode {
|
||||
GitCheckpointMode::Host(work_dir) => {
|
||||
git_diff_host(work_dir.clone(), base.clone()).await
|
||||
}
|
||||
GitCheckpointMode::Remote => {
|
||||
git_diff_remote(&*self.services.execution_env, base).await
|
||||
}
|
||||
};
|
||||
if let Some(patch) = patch {
|
||||
let _ = std::fs::write(config.logs_root.join("final.patch"), patch);
|
||||
}
|
||||
}
|
||||
|
||||
// Return last outcome, or success if no outcomes recorded
|
||||
let last_outcome = node_outcomes
|
||||
.get(completed_nodes.last().unwrap_or(&String::new()))
|
||||
|
|
|
|||
|
|
@ -474,6 +474,12 @@ async fn daytona_git_checkpoint_remote_emits_events() {
|
|||
"checkpoint should have git_commit_sha"
|
||||
);
|
||||
|
||||
// Assert final.patch exists and contains changes from the run
|
||||
let final_patch = dir.path().join("final.patch");
|
||||
assert!(final_patch.exists(), "final.patch should exist in logs_root");
|
||||
let patch_content = std::fs::read_to_string(&final_patch).unwrap();
|
||||
assert!(!patch_content.is_empty(), "final.patch should not be empty");
|
||||
|
||||
env.cleanup().await.unwrap();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8395,6 +8395,12 @@ async fn git_checkpoint_host_emits_events_and_diff_patch() {
|
|||
"checkpoint should have git_commit_sha"
|
||||
);
|
||||
|
||||
// 9. Assert final.patch exists and contains the changes
|
||||
let final_patch = logs_dir.path().join("final.patch");
|
||||
assert!(final_patch.exists(), "final.patch should exist in logs_root");
|
||||
let patch_content = std::fs::read_to_string(&final_patch).unwrap();
|
||||
assert!(patch_content.contains("hello.txt"), "final.patch should contain hello.txt changes");
|
||||
|
||||
// Cleanup worktree
|
||||
let _ = std::process::Command::new("git")
|
||||
.args(["worktree", "remove", "--force"])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue