From b00b6dfbdaad0993e8ee565b7852f1b718d6fb12 Mon Sep 17 00:00:00 2001 From: clement Date: Tue, 30 Jun 2026 22:02:35 +0200 Subject: [PATCH] fix(iphone): topology decode return type + test --- data_only_viz/arkit_topology.py | 2 +- data_only_viz/tests/test_arkit_topology.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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