a9a816e0ed
First Rust component of the Python -> Rust migration. Chosen first because
it is the lowest genuinely game-independent layer, it has an executable
oracle, and both existing Rust implementations of it are wrong.
Contents:
* fire2 -- the proven 16-byte frame header, frame/stream splitting
* heat2 -- tag packing, varints, all 11 TDF value types
* message -- frame + decoded body, routed by NUMERIC component/command
* diagnostics -- dumps for capture review
No FIFA 17 command tables, response schemas or notification IDs: this layer
knows 0x0009/0x0007 is component 9, command 7, not that it means
Util::preAuth. That mapping belongs to a game adapter, which is what lets a
future FIFA 18/23 adapter reuse this.
Parity is tested, not asserted. fixtures/generate.py drives the proven
Python responders (heat2.py, blaze_responder_v3b.py) and freezes 56 vectors
-- 31 of them real payloads from the responder's own builders, including
the 11.8 KB preAuth reply. tests/oracle_parity.rs replays every one
byte-for-byte. 54 tests green; clippy clean.
Supersedes two wrong framings, neither of which is removed yet:
* fifa-blaze/crates/blaze-proto/frame.rs -- a 12-byte header with a u16
length, nibble-packed type/options, an error field and a JUMBO flag.
A documented guess at FIFA 23 predating the FIFA 17 recon.
* heat2.py::build_fire2_frame -- packs >IHHHHB3s, msgId at [10:12] and
msgType at [12]. Dead code, but its docstring still states that layout.
Confidence is carried in the types: TypeId::is_verified() reports which
layouts are capture-backed (int/string/blob/struct) and which the oracle
marks UNVERIFIED (list/map/union/varlist/objtype/objid/float), with a test
asserting the unverified ones stay flagged.
Cargo.lock is deliberately NOT included: it re-resolves ~240 lines against
the current registry even without this crate, so that churn is pre-existing
and does not belong in a foundation commit.
The Python backend remains the live runtime and is untouched. Nothing
consumes this crate yet.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
29 lines
1018 B
Bash
Executable File
29 lines
1018 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Differential check: Rust vs the proven Python FIFA 17 backend.
|
|
#
|
|
# 1. assert the committed fixtures still match what the Python oracle emits
|
|
# 2. replay every fixture through the Rust implementation, byte-for-byte
|
|
#
|
|
# Read-only with respect to the running backend: the oracle is imported as a
|
|
# library, no responder is started, no port is bound, no live service is
|
|
# touched. Safe to run while the Python backend is serving a live FIFA client.
|
|
#
|
|
# Use --regen to rewrite the fixtures after an intentional oracle change.
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$(readlink -f "$0")")"
|
|
|
|
if [[ "${1:-}" == "--regen" ]]; then
|
|
echo "==> regenerating fixtures from the Python oracle"
|
|
python3 fixtures/generate.py
|
|
else
|
|
echo "==> checking committed fixtures against the Python oracle"
|
|
python3 fixtures/generate.py --check
|
|
fi
|
|
|
|
echo "==> replaying fixtures through the Rust implementation"
|
|
cargo test -p openfut-protocol-blaze
|
|
|
|
echo
|
|
echo "PARITY OK — Rust matches the Python oracle byte-for-byte."
|