3.1 KiB
Instant logout/reentry: fixture header key width
The saved full-gate failure is instant-character-logout, peer EOF,
child return code 1, native_transport_fixture.hpp expectation line 143.
Countdown passed. No expected/actual opcode was included in that original
message, so a bounded numeric-only diagnostic was added to the fixture.
The production LegacyPacketStream constructs both ciphers with
HeaderKeyWidth::SourceBigNumber. src/protocol.cpp removes high-order zero
bytes at the tail of the little-endian 40-byte SRP key, matching the source
BigNumber representation. The existing legacy_source_key_width_test.cpp
independently proves this contract against OpenSSL BigNumber conversion;
that accepted test was read, not rerun. The Python source peer instead kept
all 40 bytes and hardcoded modulo 40. This only diverges when K ends in zero,
a condition determined by fresh synthetic SRP entropy, not thread timing.
Deterministic before/after
Using the existing public TEST/LOCAL-ONLY synthetic account, salt and server private value, client ephemeral 164 derives a natural-width 39 key. Ephemeral 1 derives a width-40 control. A fixture-only preload shim replaces exactly the 19-byte RAND_bytes SRP draw and forwards other entropy calls unchanged. The source peer independently computes K and asserts the expected width. No account secrets or K bytes are retained or printed.
With width 39 and the original Python cipher, the isolated real native realm driver reproducibly fails:
instant-character-logout: EOFError('peer closed'); child_returncode=1
reentry opcode mismatch expected=59 actual=47675 step=10
This is the first encrypted-header wrap disagreement, on expected source 0x3b during reentry. The native library is unchanged across before/after. It establishes a concrete fixture defect independent of summon state. The original failing session's random key was not retained, so historical key width itself cannot be asserted from its old diagnostic alone.
The fix changes only the Python header cipher to trim K and wrap at its actual nonzero length. SRP interleaving and proof/digest inputs are unchanged. No runtime cryptography, summon code, deadlines, polling policy or retries were changed. Error reporting now permits only numeric expected/actual opcodes and expectation index; it emits no packet payload or roster data.
The existing --wire-reentry gate now includes two deterministic instant cases (widths 39 and 40), in addition to normal countdown and instant cases. Each exercises real SRP, the same authenticated transport, two character logouts and three world entries. All four cases pass against the unchanged copied rollup native/protocol libraries. The shim is compiled in a private temporary directory before listeners open, preloaded only into test child processes, and never linked into production artifacts. Environment changes are restored in finally. No native library, codec or full gate was rebuilt.
The saved parent gate diagnostic is preserved; parent integration owns its next full gate. Source-loot-writer timeout work and queue54 parser/codec pairing are outside this change.