refactor(simulation): drop PROTOCOL_VERSION from bridge handshake (#874, D-192)
Removes the PROTOCOL_VERSION lockstep handshake across the bridge transports. HandshakeMessage is now an empty marker indicating the server is ready; the client sends StartupMessage next. Field-presence and roundtrip behavioral tests are retained — tautological version-literal assertions were deleted in Sprint 36. After this lands, genuine schema drift surfaces as MessagePack missing-field errors downstream, which is the intended signal per D-192. Client ticket #875 is blocked by this commit and will ride the same wave; server schema changes in #878 (character_archetype removal) also depend on PROTOCOL_VERSION already being gone. types.rs changes are bundled with the broader #877/#878 dead-code sweep in the following commit, since they share the same file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -96,17 +96,17 @@ impl SimBridge for LocalBridge {
|
||||
}
|
||||
|
||||
fn send_handshake(&self) -> Result<(), BridgeError> {
|
||||
use super::types::{HandshakeMessage, PROTOCOL_VERSION};
|
||||
let msg = HandshakeMessage {
|
||||
protocol_version: PROTOCOL_VERSION,
|
||||
};
|
||||
// D-192: HandshakeMessage carries no version. Send an empty marker so the
|
||||
// client knows to begin the startup sequence (send StartupMessage next).
|
||||
use super::types::HandshakeMessage;
|
||||
let msg = HandshakeMessage {};
|
||||
let payload = rmp_serde::to_vec_named(&msg)?;
|
||||
let mut writer = self
|
||||
.writer
|
||||
.lock()
|
||||
.map_err(|e| BridgeError::MutexPoisoned(format!("writer: {}", e)))?;
|
||||
write_framed(writer.get_mut(), &payload)?;
|
||||
tracing::info!("sent handshake: protocol_version={}", PROTOCOL_VERSION);
|
||||
tracing::info!("sent handshake");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -158,10 +158,10 @@ impl SimBridge for TcpBridge {
|
||||
}
|
||||
|
||||
fn send_handshake(&self) -> Result<(), BridgeError> {
|
||||
use super::types::{HandshakeMessage, PROTOCOL_VERSION};
|
||||
let msg = HandshakeMessage {
|
||||
protocol_version: PROTOCOL_VERSION,
|
||||
};
|
||||
// D-192: HandshakeMessage carries no version. Send an empty marker so the
|
||||
// client knows to begin the startup sequence (send StartupMessage next).
|
||||
use super::types::HandshakeMessage;
|
||||
let msg = HandshakeMessage {};
|
||||
let payload = rmp_serde::to_vec_named(&msg)?;
|
||||
let mut writer = self
|
||||
.writer
|
||||
@@ -173,7 +173,7 @@ impl SimBridge for TcpBridge {
|
||||
let result = write_framed(stream, &payload);
|
||||
stream.set_nonblocking(true).map_err(BridgeError::Io)?;
|
||||
result?;
|
||||
tracing::info!("sent handshake: protocol_version={}", PROTOCOL_VERSION);
|
||||
tracing::info!("sent handshake");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,6 @@ mod tests {
|
||||
|
||||
fn make_snapshot() -> ObserverSnapshot {
|
||||
ObserverSnapshot {
|
||||
version: PROTOCOL_VERSION,
|
||||
tick: 42,
|
||||
game_time: GameTime {
|
||||
day: 0,
|
||||
@@ -427,7 +426,6 @@ mod tests {
|
||||
#[test]
|
||||
fn empty_snapshot_no_panic() {
|
||||
let snap = ObserverSnapshot {
|
||||
version: PROTOCOL_VERSION,
|
||||
tick: 0,
|
||||
game_time: GameTime {
|
||||
day: 0,
|
||||
|
||||
Reference in New Issue
Block a user