Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/runner-shared/src/fifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 14 additions & 5 deletions src/executor/shared/fifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand Down
Loading