# Rust session instrumentation and NanoFIX Stage 4

The [retained bundle](evidence/rust-session-instrumented-20261002/SHA256SUMS)
contains original manifests, process logs, raw samples, first-cycle wire
transcripts, canonical audits, Cargo locks and matching tested source. All
original artifact and adapter hashes were verified before retention.
**These are localhost diagnostics, with no physical Stage 5 or speed claim.**

## Four-flow tiny checks

On BEELINK2, one sequential job built each adapter with eight workers and
ran two separate processes with disjoint CPU masks. Each flow has five
paced, excluded warmups and 20 measured cycles at an offered 100/s.

| Engine | Four-flow completion | Canonical wire | Raw owner samples per flow |
|---|---|---|---:|
| TrueFix | pass | pass | 20 |
| LibHFT Rust Pure | pass | pass | 20 |
| NanoFIX | pass | pass | 20 |

Both processes complete real logon/logout, and every received application
cycle is decoded and checked. Standard market data has 20 bid/ask entries;
mixed-flow orders use the parsed book's best ask. Tick-to-trade is W → D,
with the server owning the clock. Only first-cycle application bytes are
retained; full-cycle extraction and message-count checks remain enabled.

NanoFIX's new Stage 4 adapter uses its public `FixEngine`, `MessageView`,
repeating-group parser and `StdTcpTransport`, with TCP_NODELAY. It retains
the pinned NanoFIX/Aeron inputs and the 79-file verified compatibility
overlay admitted at Stage 3. Its native library and CMake build-cache hashes
are in the manifest. No Aeron driver is used by this TCP adapter. NanoFIX
initially lacked measured-window admin processing observations. Those
baseline bundles remain separate from the later observer-enabled results.

## Report-contract observations

All three adapters emit a second raw series, `scheduler_delay`, with one
unrounded nanosecond value per measured owner cycle. The grader verifies
the exact series shape, engine, run, sample count and absence of drops.
Zero scheduler delay is permitted; primary latency samples must be positive.

TrueFix and Rust Pure additionally emit measured-window admin counts for
each direction and the number of observed ResendRequests. Their server
tick-to-trade clocks start in the production send hook after the complete
W frame has been prepared and before its transport write. They finish after
the corresponding reactive D has been decoded and extracted. NanoFIX uses
the same boundary in its transport wrapper.

TrueFix now disables optional incoming dictionary validation while retaining
dictionary group decoding, production checksum/session processing and the
canonical application checks. This configuration is declared in its log
and manifest. The physical report grader rejects enabled or undeclared
dictionary validation, missing admin/delay proof, measured ResendRequests,
throughput below 98% of target and an undeclared prepared-wire tick boundary.

The original root payload remains diagnostic. The installer now stages a
separate instrumented payload for all three engines, pins its HP-built
binary/dictionary/provenance hashes and accepts only the known old or new
launcher. Root installation and physical execution remain pending.

## NanoFIX admin observer

The builder first verifies the complete Stage 3 compatibility overlay,
then prepares a separate 79-file session overlay in its build directory.
Its only additional engine change adds a default no-op `FixApp` callback
after production processing of each session/admin message. Application
dispatch and session actions are unchanged. Incoming admin counts use this
callback; outgoing counts use the prepared-frame transport hook. The
patched engine source and both complete overlay hash maps are retained.

A separate tiny diagnostic injects one TestRequest midway through each
measured flow. The production peer responds with a Heartbeat. Both roles
record one incoming and one outgoing admin message in all four flows,
with zero ResendRequests, canonical application exchanges and the exact
20 latency/delay samples. This verifies actual admin processing rather
than assuming zero from a short run. The manifest labels the injected
probe, and the report grader excludes such diagnostics. The root launcher
clears its controlling environment variable.

## HP medium diagnostics

The corrected jobs used disjoint masks, distinct engine/profile ports,
1,000 excluded paced warmups and three fresh process pairs per flow.
Every flow retains 30,000 primary and 30,000 scheduler-delay samples, with
successful session, canonical wire and full-cycle extraction checks.

| Engine | Flow | Achieved cycles/s | Mean run p99, us | Stability | Local gate |
|---|---|---|---:|---|---|
| Rust Pure | `nos_er` | 9,992–9,993 | 25.992 | PASS | pass |
| Rust Pure | `md` | 9,992 | 21.883 | PASS | pass |
| Rust Pure | `md_nos_er` | 9,990–9,992 | 44.383 | PASS | pass |
| Rust Pure | `tick_to_trade` | 9,992 | 17.520 | PASS | pass |
| NanoFIX, admin observer | `nos_er` | 9,992–9,993 | 26.624 | PASS | pass |
| NanoFIX, admin observer | `md` | 9,992 | 33.015 | PASS | pass |
| NanoFIX, admin observer | `md_nos_er` | 9,992 | 53.360 | PASS | pass |
| NanoFIX, admin observer | `tick_to_trade` | 9,991–9,993 | 23.378 | PASS | pass |
| TrueFix | `nos_er` | 9,990–9,991 | 85.512 | PASS | pass |
| TrueFix | `md` | 9,908–9,946 | 109.466 | PASS | pass |
| TrueFix | `md_nos_er` | 5,805–5,874 | 190.629 | PASS | rate fails |
| TrueFix | `tick_to_trade` | 9,901–9,920 | 73.468 | WARN | stability fails |

The pre-observer NanoFIX medium bundle also passes its local gates and is
retained independently. All these jobs used `isol`, permitting concurrent
shared conformance work. Their local timing cannot be promoted into a
physical comparison. The harness keeps one cycle outstanding; TrueFix's
mixed result does not measure its pipelined capacity.

## Retained port failures

The first instrumented HP job reused its tiny port range for the immediately
following medium run, and again for Rust Pure. Servers encountered
`Address already in use` while previous connections were in TCP TIME_WAIT.
The incomplete bundles remain in `hp/*/*-before-reuse/`; their missing
samples are not a successful engine result. TrueFix's completed mixed-flow
medium runs reached only 5,827–5,884/s and remain throughput diagnostics.

Rust Pure and NanoFIX now construct reusable listeners before binding.
Campaign scripts also assign separate engine/profile port ranges. A second
Rust Pure `nos_er` process pair immediately reused the just-tested port and
passed, verifying the listener change. That single-flow regression bundle
is retained separately from the four-flow results.

Physical runs are queued behind the new root installation markers, with
high priority on HP. They require `isol-no-shared` and fresh positive TX
counter deltas on both DAC ports. The NanoFIX TCP executable has no runtime
Aeron dependency; its native build inputs remain in the build provenance.
