test(protocol): pin the version-mismatch divergence, not the old constant

`version_mismatch_clean_disconnect` asserted that the `VersionMismatch`
`server` field equals `ADVERTISED_PROTOCOL_VERSION`. Until this stage
that constant and `PROTOCOL_VERSION` were both 20, so the assertion could
not distinguish them and happened to pin the wrong one. Stage 2B-3 splits
them — the advertised value is a compatibility floor, `PROTOCOL_VERSION`
is the ceiling a frontend may counter-offer up to — and the daemon
correctly reports the ceiling, so the stale assertion failed on all four
CI Test legs.

The production behaviour is right and is unchanged here. Only the test
moves, and it now pins the divergence in both directions: the `Hello`
assertion above holds the advertised floor, a new `assert_ne!` holds the
fact that the reported version is deliberately not that floor.

That second assertion is why this is not a one-character edit. Stage
2B-3's own pin for this rule, `an_unsupported_offer_is_refused_by_name`,
is `#[cfg(feature = "crdt")]` and CI never enables `crdt` — so it is dark,
and `m5_5_acceptance` is the only live guard CI runs on this behaviour.

Bite: reverting `src/daemon.rs:757` to `ADVERTISED_PROTOCOL_VERSION`
fails the test with `left: 20, right: 21` and the named message; restored,
it passes. Verified against the whole suite under an isolated
`XDG_CONFIG_HOME` — 3303 tests, 100 binaries, zero failures.
This commit is contained in:
Levi Neuwirth 2026-07-30 10:45:27 -04:00
parent 71db6e98f0
commit 80985ed6dc
1 changed files with 24 additions and 1 deletions

View File

@ -429,9 +429,32 @@ fn version_mismatch_clean_disconnect() {
write_message(&mut stream, &req).expect("write");
// Expect Goodbye(VersionMismatch).
//
// `server` is the wire this instance can SPEAK, which since
// bottom-panel Stage 2B-3 is no longer the baseline it advertised in
// `Hello` above: the baseline is a compatibility floor and
// `PROTOCOL_VERSION` is the ceiling a frontend may counter-offer up
// to. Reporting the floor here would tell a rejected frontend the
// daemon tops out at v20 when it in fact speaks v21 — the opposite of
// the upgrade diagnostic this reason exists to give.
//
// Until Stage 2B-3 the two constants were equal, so this assertion
// could not distinguish them and silently pinned the wrong one. Both
// directions are asserted now so neither can drift back: line 421
// holds the advertised floor, and the `assert_ne!` holds the
// divergence itself. That matters here specifically because the
// Stage 2B-3 pin for this same rule is `#[cfg(feature = "crdt")]`
// and therefore dark in CI — this test is the one CI actually runs.
match read_message::<InstanceMessage>(&mut stream) {
Ok(InstanceMessage::Goodbye(GoodbyeReason::VersionMismatch { server, client })) => {
assert_eq!(server, ADVERTISED_PROTOCOL_VERSION);
assert_eq!(
server, PROTOCOL_VERSION,
"the instance must report the version it can speak"
);
assert_ne!(
server, ADVERTISED_PROTOCOL_VERSION,
"and deliberately not the advertised compatibility floor"
);
assert_eq!(client, 999);
}
other => panic!("expected VersionMismatch Goodbye, got {other:?}"),