[AZ-381] Fix ISam2GraphHandleImpl missing get_pose_key + comments

F1 (High/Architecture) from cumulative review of batches 01-22:
`ISam2GraphHandleImpl` did not satisfy C4's `ISam2GraphHandle`
Protocol stub (AZ-355) because it lacked `get_pose_key`.
`pose_factory`'s isinstance gate would have raised at composition.
Two Protocols (C4 minimal consumer cut, C5 richer producer surface)
are intentional per AZ-355 Risk 1 — the impl just needed to expose
the canonical name. Delegates to estimator.key_for_frame.

Added cross-component conformance test asserting the C5 impl
satisfies both Protocols, so future drift trips a unit test.

F2 (Medium/Maintainability): added justifying comments at four
`except: pass` sites in runtime_root, c8_fc_adapter (ap + inav),
and c13_fdr writer. No behavioral change.

Updated cumulative review report verdict from FAIL to PASS and
recorded a post-mortem on the initial misframing
(treated the dual-Protocol design as duplication on first read).

Autodev state: batch 22 done, cumulative-review PASS,
ready for batch 23.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-12 03:55:41 +03:00
parent 8a83166261
commit 48281db9e9
8 changed files with 216 additions and 3 deletions
@@ -301,6 +301,31 @@ def test_ac8_handle_is_isam2_graph_handle() -> None:
assert isinstance(handle, ISam2GraphHandle)
def test_handle_satisfies_c4_isam2_graph_handle_protocol() -> None:
"""Cross-component conformance: ``ISam2GraphHandleImpl`` MUST satisfy
the C4-side Protocol stub (``c4_pose._isam2_handle.ISam2GraphHandle``)
so the same instance can be passed to ``pose_factory.build_pose_estimator``
without an adapter. The c4 stub requires only ``get_pose_key(frame_id) -> int``;
the c5 impl delegates to ``estimator.key_for_frame`` for that lookup.
"""
# Arrange
from gps_denied_onboard.components.c4_pose._isam2_handle import (
ISam2GraphHandle as C4ISam2GraphHandle,
)
estimator_mock = mock.MagicMock()
estimator_mock.key_for_frame.return_value = 0x7800000000000007
handle = ISam2GraphHandleImpl(estimator=estimator_mock)
# Act
key = handle.get_pose_key(42)
# Assert
assert isinstance(handle, C4ISam2GraphHandle)
estimator_mock.key_for_frame.assert_called_once_with(42)
assert key == 0x7800000000000007
# Note: the AZ-381 skeleton's ``NotImplementedError`` bodies were
# replaced with real GTSAM calls by AZ-382. The "methods raise" test
# that lived here has moved to