Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
docs: scope `FailureStrategy` to the foreground pipeline (#3892)
Maximilian Roos8cfe5eaaeecb
diff --git a/src/commands/command_executor.rs b/src/commands/command_executor.rsindex ab1c5741b..012ca7888 100644--- a/src/commands/command_executor.rs+++ b/src/commands/command_executor.rs@@ -153,6 +153,10 @@ pub struct ForegroundStep {}/// Controls how foreground execution responds to command failures.+///+/// Only [`execute_pipeline_foreground`] reads this. `post-*` hooks default to+/// the background pipeline in [`mod@super::run_pipeline`], which takes no+/// failure strategy. A step that exits non-zero there stops the steps after it.#[derive(Clone, Copy)]pub enum FailureStrategy {/// Stop on first failure and surface the error to the caller.@@ -161,18 +165,6 @@ pub enum FailureStrategy {Warn,}-impl FailureStrategy {- /// Default strategy for a hook type: `pre-*` block (fail-fast),- /// `post-*` warn-and-continue.- pub fn default_for(hook_type: HookType) -> Self {- if hook_type.is_pre() {- Self::FailFast- } else {- Self::Warn- }- }-}-#[derive(Clone, Copy, Debug)]pub struct CommandContext<'a> {/// The repository, rooted at the worktree this operation acts on.diff --git a/src/commands/hook_commands.rs b/src/commands/hook_commands.rsindex 593b7a10a..44ddfee5d 100644--- a/src/commands/hook_commands.rs+++ b/src/commands/hook_commands.rs@@ -326,7 +326,7 @@ pub fn run_hook(hook_type,&extra_vars,name_filters,- FailureStrategy::default_for(hook_type),+ FailureStrategy::FailFast,)} else {run_post_hook(diff --git a/src/commands/hooks.rs b/src/commands/hooks.rsindex c713165ca..3fc905a4b 100644--- a/src/commands/hooks.rs+++ b/src/commands/hooks.rs@@ -693,17 +693,6 @@ mod tests {assert_eq!(HookSource::Project.to_string(), "project");}- #[test]- fn test_failure_strategy_copy() {- let strategy = FailureStrategy::FailFast;- let copied = strategy; // Copy trait- assert!(matches!(copied, FailureStrategy::FailFast));-- let warn = FailureStrategy::Warn;- let copied_warn = warn;- assert!(matches!(copied_warn, FailureStrategy::Warn));- }-#[test]fn test_parsed_filter() {// No prefix — matches all sources