From e11c9df2bc52ca845e2728c2ca342b44ffbc462d Mon Sep 17 00:00:00 2001 From: not-matthias Date: Tue, 8 Sep 2026 15:46:16 +0200 Subject: [PATCH] fix: honor deprecated experimental flags instead of ignoring them `--experimental-cycle-estimation` and `--experimental-exclude-allocations` were parsed but deliberately dropped, so anyone still passing `--experimental-exclude-allocations` silently lost allocation exclusion. Both now feed their graduated counterparts and warn that they are deprecated and will be removed in a future release. --- src/cli/exec/mod.rs | 6 ++++-- src/cli/experimental.rs | 20 +++++++------------- src/cli/run/mod.rs | 6 ++++-- src/cli/shared.rs | 12 ++++++++++++ 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/cli/exec/mod.rs b/src/cli/exec/mod.rs index a844cc6b..bb6b08d7 100644 --- a/src/cli/exec/mod.rs +++ b/src/cli/exec/mod.rs @@ -58,6 +58,8 @@ fn build_orchestrator_config( poll_results_options: PollResultsOptions, ) -> Result { let modes = args.shared.resolve_modes()?; + let cycle_estimation = args.shared.resolve_cycle_estimation(); + let exclude_allocations = args.shared.resolve_exclude_allocations(); let raw_upload_url = args .shared .upload_url @@ -90,8 +92,8 @@ fn build_orchestrator_config( poll_results_options, extra_env: HashMap::new(), fair_sched: args.shared.experimental.experimental_fair_sched, - cycle_estimation: args.shared.cycle_estimation, - exclude_allocations: args.shared.exclude_allocations, + cycle_estimation, + exclude_allocations, simulation_track_subprocess: args.shared.simulation_track_subprocess, memory_track_physical: args.shared.experimental.experimental_memory_track_physical, }) diff --git a/src/cli/experimental.rs b/src/cli/experimental.rs index 336093b3..f8e0b7ec 100644 --- a/src/cli/experimental.rs +++ b/src/cli/experimental.rs @@ -27,11 +27,11 @@ pub struct ExperimentalArgs { )] pub experimental_memory_track_physical: bool, - /// Deprecated: cycle estimation is enabled by default and this flag has no effect. + /// Deprecated alias for `--cycle-estimation`, still honored for now. #[arg(long, hide = true, env = "CODSPEED_EXPERIMENTAL_CYCLE_ESTIMATION")] pub experimental_cycle_estimation: bool, - /// Deprecated: allocation exclusion is controlled by `--exclude-allocations` and this flag has no effect. + /// Deprecated alias for `--exclude-allocations`, still honored for now. #[arg(long, hide = true, env = "CODSPEED_EXPERIMENTAL_EXCLUDE_ALLOCATIONS")] pub experimental_exclude_allocations: bool, } @@ -72,31 +72,25 @@ impl ExperimentalArgs { ); } - /// Warns about deprecated flags that were graduated to default-on options and - /// no longer have any effect. + /// Warns about deprecated flags that graduated to stable options. They are still + /// honored, but will be removed in a future release. pub fn warn_if_deprecated(&self) { let deprecated = [ ( self.experimental_cycle_estimation, "--experimental-cycle-estimation", - "cycle estimation", "--cycle-estimation", ), ( self.experimental_exclude_allocations, "--experimental-exclude-allocations", - "allocation exclusion", "--exclude-allocations", ), ]; - for (_, flag, feature, new_flag) in deprecated.iter().filter(|(set, ..)| *set) { - eprintln!( - " {} {} has no effect: {} is now controlled by {}.", - style(Icon::Warning.to_string()).yellow(), - style(*flag).bold(), - feature, - style(*new_flag).bold(), + for (_, flag, new_flag) in deprecated.iter().filter(|(set, ..)| *set) { + log::warn!( + "{flag} is deprecated and will be removed in a future release: use {new_flag} instead." ); } } diff --git a/src/cli/run/mod.rs b/src/cli/run/mod.rs index 414e04f8..23687719 100644 --- a/src/cli/run/mod.rs +++ b/src/cli/run/mod.rs @@ -101,6 +101,8 @@ fn build_orchestrator_config( ) -> Result { let instruments = Instruments::try_from(&args)?; let modes = args.shared.resolve_modes()?; + let cycle_estimation = args.shared.resolve_cycle_estimation(); + let exclude_allocations = args.shared.resolve_exclude_allocations(); let raw_upload_url = args .shared .upload_url @@ -133,8 +135,8 @@ fn build_orchestrator_config( poll_results_options, extra_env: HashMap::new(), fair_sched: args.shared.experimental.experimental_fair_sched, - cycle_estimation: args.shared.cycle_estimation, - exclude_allocations: args.shared.exclude_allocations, + cycle_estimation, + exclude_allocations, simulation_track_subprocess: args.shared.simulation_track_subprocess, memory_track_physical: args.shared.experimental.experimental_memory_track_physical, }) diff --git a/src/cli/shared.rs b/src/cli/shared.rs index 1fe13474..7aba09db 100644 --- a/src/cli/shared.rs +++ b/src/cli/shared.rs @@ -168,6 +168,18 @@ impl ExecAndRunSharedArgs { Ok(modes) } + + /// Resolves cycle estimation, honoring the deprecated + /// `--experimental-cycle-estimation` alias. + pub fn resolve_cycle_estimation(&self) -> bool { + self.cycle_estimation || self.experimental.experimental_cycle_estimation + } + + /// Resolves allocation exclusion, honoring the deprecated + /// `--experimental-exclude-allocations` alias. + pub fn resolve_exclude_allocations(&self) -> bool { + self.exclude_allocations || self.experimental.experimental_exclude_allocations + } } #[derive(Debug, Copy, Clone, PartialEq, ValueEnum, Default)]