pub fn other_build(riff: &Build, server: &Build) -> StringExpand description
The note when the builds differ and they can talk
(01M3MX1E8M9TKBN90P4DYKH3H8). riff prints it once for each process,
and goes on. When riff is on the line before the server, the note
says that the next line of the server refuses it. On the same line,
the note names the older side (Build::older_than), as riff server does (01M56Q55SHHJSKJWNHMW79X7HA).
use riff_core::build::{Build, Semver, other_build};
let this = Build::this().semver().unwrap();
let at = |version: Semver, commit: &str, time: &str| Build {
version: version.to_string(),
commit: commit.into(),
time: time.into(),
};
// The same line, and the server is newer.
let server = at(Semver { patch: this.patch + 3, ..this }, "aaaa", "2026-09-27T10:00:00Z");
let riff = at(this, "bbbb", "2026-09-27T11:00:00Z");
assert_eq!(
other_build(&riff, &server),
format!(
"riff-server runs build {server}; this riff runs build {riff}. Run riff update when \
you can."
)
);
// The same line, and this riff is newer.
assert_eq!(
other_build(&server, &riff),
format!(
"riff-server runs build {riff}; this riff runs build {server}. Update riff-server \
when you can."
)
);
// The line before the server.
let before = at(this.line_before().unwrap(), "cccc", "2026-09-20T11:00:00Z");
assert_eq!(
other_build(&before, &server),
format!(
"riff-server runs build {server}; this riff runs build {before}. riff-server {} will \
refuse riff {}. Run riff update soon.",
this.line_after().line(),
this.line_before().unwrap().line()
)
);