[AZ-895] Deprecate replay auto-sync surface; file AZ-908 follow-up

Option A (minimum-deprecation, 2 SP) per user complexity-budget
decision. Auto-sync stays importable as a raising stub for one cycle
so external callers see a clean ReplayInputAdapterError instead of an
ImportError. Full physical removal is filed as AZ-908 (cycle-5+ backlog).

Production:
- auto_sync.py: 700+ LOC -> 56-line no-op stub raising
  "auto-sync removed; supply --imu CSV instead"
- tlog_video_adapter.py: 700+ LOC -> 105-line deprecated stub;
  ReplayInputAdapter.open() raises immediately, close() is a no-op
- _replay_branch.py: dropped legacy auto-sync branch +
  _build_auto_sync_config; _validate_replay_paths now requires
  imu_csv_path; replay_input_adapter_factory parameter removed
- cli/replay.py: --time-offset-ms / --skip-auto-sync / --auto-trim
  emit DeprecationWarning + stderr line; values ignored
- tlog_replay_adapter.py + tlog_ground_truth.py docstrings: AUDIT-ONLY

Tests:
- DELETED test_az405_auto_sync, test_az405_replay_input_adapter,
  test_az698_window_alignment (covered code no longer runs)
- ADDED test_az895_auto_sync_deprecated_stub (5 parametrised, pins AC-1)
- test_az402_replay_cli: deprecation warnings + ignored-value asserts
- test_az401_compose_root_replay: new imu_csv_path-required gate;
  deleted the calibration-loading test that relied on the removed
  replay_input_adapter_factory injection point
- test_derkachi_real_tlog: xfail reason refreshed to AZ-848 + AZ-883
  (AC-4 "AZ-848-scoped reason")

Docs:
- module-layout.md: replay_input file list flags deprecated modules,
  adds csv_ground_truth.py
- _dependencies_table.md: +AZ-908 row, preamble + totals updated
  (179 -> 180 tasks, 567 -> 570 SP)
- AZ-908 backlog spec added; AZ-895 spec moved todo -> done
- batch_03_cycle4_report.md written

Touched-module tests green (111 passed, 1 skipped). Full unit suite
green: 2287 passed, 85 skipped, 1 deselected (pre-existing flaky perf
test, unrelated).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-26 22:09:59 +03:00
parent fdb593a775
commit 007aa36fbf
19 changed files with 600 additions and 4213 deletions
@@ -1,19 +1,23 @@
"""Direct binary-tlog GPS-truth extractor (AZ-697 / E-DEMO-REPLAY).
Streams ``GLOBAL_POSITION_INT`` (preferred) or ``GPS_RAW_INT`` (fallback)
from an ArduPilot binary tlog into a typed :class:`TlogGroundTruth` DTO,
suitable for the AZ-699 (real-flight validation) and AZ-701 (HTTP
replay API) comparison paths.
AUDIT-ONLY (AZ-895): the production replay pipeline now consumes
ground truth through :class:`CsvGroundTruth` (AZ-894) driven by the
operator's IMU+GPS CSV. This helper is retained for one-off audits and
the AZ-699 / AZ-701 validation paths that still operate against legacy
``.tlog`` archives; it is not part of the main replay composition root.
Design mirrors :mod:`gps_denied_onboard.replay_input.auto_sync`:
Streams ``GLOBAL_POSITION_INT`` (preferred) or ``GPS_RAW_INT`` (fallback)
from an ArduPilot binary tlog into a typed :class:`TlogGroundTruth` DTO.
Design notes:
* Lazy ``pymavlink.mavutil`` import — missing dependency raises
:class:`ReplayInputAdapterError` rather than crashing the import.
* Optional ``source_factory`` injection point so unit tests can swap in
a synthetic source (mirrors the AZ-399 / AZ-405 pattern).
* Production helper only — placed under ``replay_input/`` because the
GPS extraction is intrinsically tied to the tlog input pipeline; the
comparison kernels themselves live in :mod:`helpers.gps_compare`.
a synthetic source (mirrors the AZ-399 pattern).
* Placed under ``replay_input/`` because the GPS extraction is
intrinsically tied to the tlog input pipeline; the comparison kernels
themselves live in :mod:`helpers.gps_compare`.
"""
from __future__ import annotations