Files
OpenFUT/openfut-blaze-host/src/main.rs
T
funman300 a9eb54ae9c openfut-blaze-host: thin Blaze sidecar, live-parity with Python
Third migration step, and the one that turns fixture parity into transport
parity. A TCP host that frames a Fire2 stream, keeps one Session per
connection, calls openfut-adapter-fifa17::dispatch(), and writes the returned
frames in order. It owns a socket, a buffer, a session and diagnostics --
that is the complete list. No coins, club, packs, profiles or UTAS logic:
those belong to Core, reached through the adapter later.

NO TLS, and that is evidence-based rather than an omission. The Blaze main
port is plaintext: sending a raw Fire2 Util::ping to the running backend
returns a plaintext PingResponse, blaze_handle uses the raw socket, and only
redir_handle wraps ssl. TLS belongs to the redirector phase.

LIVE A/B AGAINST THE RUNNING PYTHON BACKEND: 101 frames across three
conversations, identical normalized traces. This is the first result in the
migration that is not purely offline. check-live-parity.sh replays the
recorded conversations against both endpoints over real sockets and diffs
volatile-masked traces; session keys and clocks are masked, so anything that
differs is behavioural.

Transport tests cover what fixtures cannot: byte-for-byte replay over a
socket, requests dribbled one byte at a time, several requests in one write,
the four-frame login burst ordered on the wire, session state persisting
across frames and NOT leaking between connections, an absurd payload length
closing the connection instead of allocating, and an undecodable body still
getting a reply. 18 tests here, 116 across the three migration crates.

MUTATION TESTED, including the comparison itself. Dropping a post-login
notification is caught by the probe (frame count) AND the diff; a same-length
content change deep inside a notification body (CTY "US"->"GB", payload 116
both sides) is caught ONLY by the trace digest. So the probe's exit code is
not the test -- the diff is, and the README says so. check-live-parity.sh was
itself verified to exit 1 under mutation.

The listen port is required configuration with no default, so the sidecar
cannot silently collide with the working container. OPENFUT_BIND stays the
advertised-config bind (the adapter derives nucleusConnect from it,
reproducing the oracle) and the listener gets its own setting, so the two are
not conflated.

Gates 1-4 pass and are re-runnable. Gates 5-10 need a FIFA client and are
listed in the README, including the Python -> Rust -> Python -> Rust
back-and-forth that proves the rollback path rather than asserting it.

Python backend untouched and still the live runtime; contract suite 446/446
after this work.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 01:42:23 +00:00

39 lines
1.7 KiB
Rust

//! Entry point for the Blaze sidecar.
//!
//! Configuration is entirely environmental and both critical values are
//! required, so a misconfigured launch fails immediately and loudly rather than
//! binding a default port next to the working Python container.
use openfut_blaze_host::{serve, HostConfig};
fn main() {
let cfg = match HostConfig::from_env() {
Ok(cfg) => cfg,
Err(e) => {
eprintln!("openfut-blaze-host: {e}\n");
eprintln!("Required:");
eprintln!(
" OPENFUT_ADVERTISE address the game machine uses to reach this host"
);
eprintln!(
" OPENFUT_BLAZE_HOST_PORT port to listen on (no default, to avoid colliding"
);
eprintln!(" with the Python backend it runs beside)");
eprintln!("Optional:");
eprintln!(" OPENFUT_BIND advertised-config bind, mirrors the Python");
eprintln!(" container's value so nucleusConnect matches");
eprintln!(" OPENFUT_BLAZE_HOST_BIND listener bind (defaults to OPENFUT_BIND)");
eprintln!(" POW_CONTENT_HOST host:port for POW content");
eprintln!(" POW_HOST host:port for the POW/EASFC API");
eprintln!(" OPENFUT_BLAZE_TRACE path for the normalized structural trace");
eprintln!(" OPENFUT_BLAZE_IDLE_TIMEOUT seconds, default 300");
std::process::exit(2);
}
};
if let Err(e) = serve(cfg) {
eprintln!("openfut-blaze-host: fatal: {e}");
std::process::exit(1);
}
}