[AZ-960] render-map: dispatch --truth loader on extension (CSV+tlog)

load_ground_truth_track now dispatches on truth_path.suffix:
- .csv → load_csv_ground_truth (AZ-894)
- else (.tlog, .bin, no ext) → load_tlog_ground_truth (AZ-697)

Removes the AZ-959 short-circuit in SubprocessReplayRunner.
_maybe_render_map so CSV-path replay jobs ship with the same
map.html artefact as tlog jobs. Both ground-truth DTOs expose
row-aligned (lat_deg, lon_deg) records so the renderer needs no
other changes.

Touches:
- src/gps_denied_onboard/cli/render_map.py: dispatch +
  source-agnostic tooltip + --truth CLI help expanded
- src/gps_denied_onboard/replay_api/app.py: workaround removed,
  truth_path resolution picks whichever input was uploaded

Tests: 44/44 green across test_az700_render_map.py +
test_az701_replay_api.py:
- 17 pre-existing render-map tests pass unchanged (AC-2)
- New test_load_ground_truth_track_dispatches_to_csv_loader (AC-1)
- New test_load_ground_truth_track_csv_propagates_schema_error
  (AC-4: malformed CSV raises ReplayInputAdapterError)
- New test_cli_renders_map_with_csv_truth (AC-1 end-to-end)
- AZ-959 test_post_replay_csv_path_returns_200... extended to
  assert map_html_url is now present (AC-3)

Bookkeeping: AZ-960 spec moved todo/ → done/, dep-table preamble
seventh bump documents the landing + AC coverage, state.md records
batch 6 complete with AZ-961 as next.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-29 12:53:17 +03:00
parent 363c235264
commit 7f590582cc
7 changed files with 128 additions and 20 deletions
+6 -11
View File
@@ -262,16 +262,6 @@ class SubprocessReplayRunner:
output_dir: Path,
report_path: Path | None,
) -> Path | None:
# gps-denied-render-map only understands binary tlog truth
# today; CSV-truth dispatch is an AZ-700 follow-up. For now,
# CSV-path runs ship without a map (report + emissions still
# render, see _maybe_render_report).
if inputs.tlog_path is None:
_LOGGER.info(
"skipping map render — CSV-path runs do not yet support "
"the gps-denied-render-map CLI (AZ-700 follow-up)"
)
return None
if not shutil.which(self._render_binary):
venv_bin = Path(sys.executable).parent / self._render_binary
if not venv_bin.exists():
@@ -283,13 +273,18 @@ class SubprocessReplayRunner:
render_bin = str(venv_bin)
else:
render_bin = self._render_binary
# gps-denied-render-map dispatches on the --truth file
# extension (AZ-960) so we just pass whichever input path
# carried this job's ground truth.
truth_path = inputs.csv_path if inputs.csv_path is not None else inputs.tlog_path
assert truth_path is not None
map_path = output_dir / "map.html"
argv = [
render_bin,
"--estimated",
str(emissions_path),
"--truth",
str(inputs.tlog_path),
str(truth_path),
"--output",
str(map_path),
]