diff --git a/crates/runner-shared/src/fifo.rs b/crates/runner-shared/src/fifo.rs index d653c32c..42a8d24d 100644 --- a/crates/runner-shared/src/fifo.rs +++ b/crates/runner-shared/src/fifo.rs @@ -3,8 +3,18 @@ pub const RUNNER_CTL_FIFO: &str = "/tmp/runner.ctl.fifo"; pub const RUNNER_ACK_FIFO: &str = "/tmp/runner.ack.fifo"; +/// Be very careful when changing this, as this will break support for integrations built with versions stricly lower than this. +/// Any change of this should be planned ahead of time, with deprecation warnings, and the release +/// of integrations supporting the new protocol version a significant amount of time before +/// releasing the runner. +pub const MINIMAL_SUPPORTED_PROTOCOL_VERSION: u64 = 1; pub const CURRENT_PROTOCOL_VERSION: u64 = 2; +const _: () = assert!( + MINIMAL_SUPPORTED_PROTOCOL_VERSION <= CURRENT_PROTOCOL_VERSION, + "MINIMAL_SUPPORTED_PROTOCOL_VERSION must be less than or equal to CURRENT_PROTOCOL_VERSION" +); + /// The different markers that can be set in the perf.data. /// /// `SampleStart/End`: Marks the start and end of a sampling period. This is used to differentiate between benchmarks. diff --git a/src/executor/shared/fifo.rs b/src/executor/shared/fifo.rs index 3df7125a..2f23a0d4 100644 --- a/src/executor/shared/fifo.rs +++ b/src/executor/shared/fifo.rs @@ -193,11 +193,20 @@ impl RunnerFifo { } FifoCommand::SetVersion(protocol_version) => { match protocol_version.cmp(&runner_shared::fifo::CURRENT_PROTOCOL_VERSION) { - Ordering::Less => panic!( - "Integration is using an incompatible protocol version ({protocol_version} < {}). Please update the integration to the latest version.", - runner_shared::fifo::CURRENT_PROTOCOL_VERSION - ), - Ordering::Greater => panic!( + Ordering::Less => { + if *protocol_version + < runner_shared::fifo::MINIMAL_SUPPORTED_PROTOCOL_VERSION + { + bail!( + "Integration is using a version of the protocol that is smaller than the minimal supported protocol version ({protocol_version} < {}). \ + Please update the integration to a supported version.", + runner_shared::fifo::MINIMAL_SUPPORTED_PROTOCOL_VERSION + ); + } + self.send_cmd(FifoCommand::Ack).await?; + continue; + } + Ordering::Greater => bail!( "Runner is using an incompatible protocol version ({} < {protocol_version}). Please update the runner to the latest version.", runner_shared::fifo::CURRENT_PROTOCOL_VERSION ),