wifi-densepose/archive/v1/tests/unit
ruv dbcbac1d43 feat(adr-110): Python SyncPacket API parity with Rust (apply_to_local + interpolation)
Iter 26 — closes the ABI gap between the Python and Rust SyncPacket
decoders. Before this, Python could decode the wire but had no helpers
to apply offsets or recover per-frame mesh time; any Python-side tooling
(host scripts, replay analysers, notebooks) would have to re-implement
the math from scratch and could drift from Rust silently.

New methods on the Python SyncPacket dataclass:

  local_minus_epoch_us() -> int
    Signed local-vs-mesh offset. Matches Rust byte-for-byte.

  apply_to_local(local_at_frame_us: int) -> int
    offset = epoch_us - local_us
    return local_at_frame_us + offset
    Identity at local_at_frame_us == self.local_us returns epoch_us.

  mesh_aligned_us_for_sequence(frame_seq: int, fps_hz: float) -> int
    Sequence-based interpolation matching Rust's identical method.
    Includes u32 wraparound handling via masked-subtract — verified
    against Rust's iter 17 `mesh_aligned_for_sequence_handles_seq_wraparound`.

3 new Python tests (10 total in TestSyncPacketParser, all green in 0.24s):

  test_apply_to_local_recovers_epoch_at_sync_point
    Identity at the sync point. Also verifies local_minus_epoch_us()
    matches §A0.10's measured 1,163,565 µs bench number.

  test_apply_to_local_preserves_inter_frame_delta
    Frame arriving 5 s after the sync on the follower's local clock
    produces mesh time exactly 5 s after sync.epoch_us.

  test_mesh_aligned_us_for_sequence_matches_rust
    Cross-language parity with Rust's
    `end_to_end_sync_decode_then_frame_mesh_recovery` (iter 20):
    100 frames after sync.sequence at 20 fps = sync.epoch_us + 5 s.
    Cross-checks via apply_to_local — both paths must agree.

Test count after iter 26:
  Python TestSyncPacketParser: 10/10 (was 7/7)
  Rust sync_packet::tests: 15/15
  Combined: 25 unit tests defending the SyncPacket contract across
  the two host language stacks.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-23 14:15:28 -04:00
..
conftest.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_auth_middleware.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_csi_extractor.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_csi_extractor_direct.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_csi_extractor_tdd.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_csi_extractor_tdd_complete.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_csi_processor.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_csi_processor_tdd.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_csi_standalone.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_densepose_head.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_error_handler.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_esp32_binary_parser.py feat(adr-110): Python SyncPacket API parity with Rust (apply_to_local + interpolation) 2026-05-23 14:15:28 -04:00
test_hardware_service.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_health_check.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_metrics.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_modality_translation.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_phase_sanitizer.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_phase_sanitizer_tdd.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_pose_service.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_rate_limit.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_router_interface.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_router_interface_tdd.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_sensing.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00
test_stream_service.py chore(repo): move v1/ → archive/v1/ + add archive/README.md (#430) 2026-04-25 23:07:52 -04:00