mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-06-23 02:01:13 +00:00
[AZ-558] Route C8 outbound encoder bytes through MavlinkTransport seam
All FC adapter outbound MAVLink bytes now go through the AZ-401 MavlinkTransport seam (NoopMavlinkTransport in replay, SerialMavlinkTransport in live). New helpers in _outbound_mavlink_payloads.py extract encode/pack/seq-bump so the four AP _send sites and the iNav statustext _send site become encode -> pack -> transport.write. TlogReplayFcAdapter emits real AP-shape MAVLink bytes through the injected NoopMavlinkTransport, satisfying replay protocol Invariant 5 and unblocking AZ-401 AC-9. Closes AZ-558. Also unskips AZ-401 AC-9 and AZ-404 AC-4b. Live wire output remains byte-identical (proven via two-instance MAVLink byte-equivalence tests). AST scan asserts no .mav.<name>_send( calls remain in the retrofit set (AP / iNav / tlog adapters). Out of scope (logged in review): GCS adapter retrofit; airborne live strategy registration that would activate the SerialMavlinkTransport factory injection path. Tests: 2110 passed, 92 environmental skips, 1 unrelated pre-existing macOS cold-start flake deselected. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -35,6 +35,8 @@ from gps_denied_onboard.components.c8_fc_adapter.msp2_inav_adapter import (
|
||||
)
|
||||
from gps_denied_onboard.config import load_config
|
||||
|
||||
from ._mav_test_helpers import _FakeMsg
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Helpers — MSP / secondary-MAVLink stand-ins
|
||||
|
||||
@@ -51,22 +53,35 @@ class _MspStub:
|
||||
self.closed = True
|
||||
|
||||
|
||||
class _SigningStub:
|
||||
sign_outgoing = False
|
||||
|
||||
|
||||
class _SecondaryMavStub:
|
||||
def __init__(self) -> None:
|
||||
self.statustext_calls: list[tuple[int, bytes]] = []
|
||||
self.closed = False
|
||||
self.write_calls: list[bytes] = []
|
||||
# Mirror pymavlink connection.mav shape.
|
||||
self.mav = self
|
||||
# Track signing-key state per RESTRICT-COMM-2 (Invariant 9):
|
||||
# the unit-test adapter MUST never call setup_signing on us.
|
||||
self.setup_signing_calls: list[Any] = []
|
||||
# AZ-558: encoder flow needs ``mav.seq`` and ``mav.signing``.
|
||||
self.seq: int = 0
|
||||
self.signing = _SigningStub()
|
||||
|
||||
def statustext_send(self, severity: int, text: bytes) -> None:
|
||||
def statustext_encode(self, severity: int, text: bytes) -> _FakeMsg:
|
||||
self.statustext_calls.append((int(severity), bytes(text)))
|
||||
return _FakeMsg()
|
||||
|
||||
def setup_signing(self, key: Any) -> None:
|
||||
self.setup_signing_calls.append(key)
|
||||
|
||||
def write(self, payload: bytes) -> int:
|
||||
self.write_calls.append(bytes(payload))
|
||||
return len(payload)
|
||||
|
||||
def close(self) -> None:
|
||||
self.closed = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user