Skip to content

Commit dc07014

Browse files
fix: do not break support for no reason when changing integration hooks protocol version
1 parent ae6c55a commit dc07014

2 files changed

Lines changed: 24 additions & 5 deletions

File tree

crates/runner-shared/src/fifo.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@
33
pub const RUNNER_CTL_FIFO: &str = "/tmp/runner.ctl.fifo";
44
pub const RUNNER_ACK_FIFO: &str = "/tmp/runner.ack.fifo";
55

6+
/// Be very careful when changing this, as this will break support for integrations built with versions stricly lower than this.
7+
/// Any change of this should be planned ahead of time, with deprecation warnings, and the release
8+
/// of integrations supporting the new protocol version a significant amount of time before
9+
/// releasing the runner.
10+
pub const MINIMAL_SUPPORTED_PROTOCOL_VERSION: u64 = 1;
611
pub const CURRENT_PROTOCOL_VERSION: u64 = 2;
712

13+
const _: () = assert!(
14+
MINIMAL_SUPPORTED_PROTOCOL_VERSION <= CURRENT_PROTOCOL_VERSION,
15+
"MINIMAL_SUPPORTED_PROTOCOL_VERSION must be less than or equal to CURRENT_PROTOCOL_VERSION"
16+
);
17+
818
/// The different markers that can be set in the perf.data.
919
///
1020
/// `SampleStart/End`: Marks the start and end of a sampling period. This is used to differentiate between benchmarks.

src/executor/shared/fifo.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,20 @@ impl RunnerFifo {
193193
}
194194
FifoCommand::SetVersion(protocol_version) => {
195195
match protocol_version.cmp(&runner_shared::fifo::CURRENT_PROTOCOL_VERSION) {
196-
Ordering::Less => panic!(
197-
"Integration is using an incompatible protocol version ({protocol_version} < {}). Please update the integration to the latest version.",
198-
runner_shared::fifo::CURRENT_PROTOCOL_VERSION
199-
),
200-
Ordering::Greater => panic!(
196+
Ordering::Less => {
197+
if *protocol_version
198+
< runner_shared::fifo::MINIMAL_SUPPORTED_PROTOCOL_VERSION
199+
{
200+
bail!(
201+
"Integration is using a version of the protocol that is smaller than the minimal supported protocol version ({protocol_version} < {}). \
202+
Please update the integration to a supported version.",
203+
runner_shared::fifo::MINIMAL_SUPPORTED_PROTOCOL_VERSION
204+
);
205+
}
206+
self.send_cmd(FifoCommand::Ack).await?;
207+
continue;
208+
}
209+
Ordering::Greater => bail!(
201210
"Runner is using an incompatible protocol version ({} < {protocol_version}). Please update the runner to the latest version.",
202211
runner_shared::fifo::CURRENT_PROTOCOL_VERSION
203212
),

0 commit comments

Comments
 (0)