mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 08:14:42 +00:00
`promote_connection` detached the pending connection and then interleaved reads off that detached value with three separate lookups of the same control machine. Gather the machine-side fields (`their_index`, `transport_id`, link stats) in the single `get_mut` that takes the connection, so the machine is borrowed once. Behaviour is unchanged. The connection is still taken before anything is validated, so a rejected promotion leaves the machine with no pending connection, and the prelude only gathers options: the checks below it still report the first missing field in the same order (`our_index`, `their_index`, `transport_id`, `source_addr`). Link stats move to the prelude, ahead of those checks. The value is the same either way: they live on the surviving carrier rather than the detached connection, and nothing between the two points touches the machine map. The lookup could not fail at the old site either, since the function had already reached it through a successful lookup on the same key, so dropping the defaulting arm changes nothing. Add a test covering the error order and the detach, driving promotion with connections missing each required field in turn plus every later one, so an implementation that validated during the prelude would report the wrong field. Test seeding grows a variant that lets the caller shape the seed.