Skip to content

tools/lib/route: dedupe segment file mapping logic#37862

Open
codesage1 wants to merge 3 commits intocommaai:masterfrom
codesage1:route-segment-dedupe
Open

tools/lib/route: dedupe segment file mapping logic#37862
codesage1 wants to merge 3 commits intocommaai:masterfrom
codesage1:route-segment-dedupe

Conversation

@codesage1
Copy link
Copy Markdown

Description

This refactor removes repeated segment-file mapping logic in tools/lib/route.py while preserving existing behavior and public method signatures.

Goals:

  • Deduplicate path-list generation in Route (log_paths, qlog_paths, camera_paths, dcamera_paths, ecamera_paths, qcamera_paths)
  • Reuse a single internal mapping/helper flow for both local and remote segment parsing
  • Keep behaviour unchanged:
    • local discovery keeps first-match behaviour
    • remote discovery keeps last-match behaviour

Regression coverage was added in tools/lib/tests/test_route_library.py for:

  • local segment discovery across supported layouts
  • remote file mapping precedence
  • sparse segment handling (None holes)
  • existing SegmentName parsing behaviour

Verification

  • ruff check tools/lib/route.py tools/lib/tests/test_route_library.py
  • pytest -o addopts='' --confcutdir=tools/lib/tests tools/lib/tests/test_route_library.py

@github-actions github-actions Bot added the tools label Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

Process replay diff report

Replays driving segments through this PR and compares the behavior to master.
Please review any changes carefully to ensure they are expected.

✅ 0 changed, 66 passed, 0 errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants