diff --git a/data_only_viz/arkit_topology.py b/data_only_viz/arkit_topology.py index 3fa2dc3..b38a1eb 100644 --- a/data_only_viz/arkit_topology.py +++ b/data_only_viz/arkit_topology.py @@ -21,7 +21,7 @@ def encode_topology(names: list[str], parents: list[int]) -> bytes: return bytes(out) -def decode_topology(payload: bytes): +def decode_topology(payload: bytes) -> tuple[list[str], list[int]] | None: """Return (joint_names, parents) or None if malformed.""" if len(payload) < 2: return None diff --git a/data_only_viz/tests/test_arkit_topology.py b/data_only_viz/tests/test_arkit_topology.py index 8f30e19..a025ebb 100644 --- a/data_only_viz/tests/test_arkit_topology.py +++ b/data_only_viz/tests/test_arkit_topology.py @@ -26,3 +26,8 @@ def test_rejects_truncated(): def test_rejects_too_short(): assert decode_topology(b"\x00") is None + + +def test_rejects_truncated_parents(): + # 1 joint "a", parents section missing. + assert decode_topology(b"\x00\x01\x01a") is None