[PR #287] feat: modernize CLI, fix telemetry gaps, add Tyre Strategy insight, and setup CI/infra #274

Open
opened 2026-05-07 00:19:31 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/287
Author: @JuanjoRestrepo
Created: 5/6/2026
Status: 🔄 Open

Base: mainHead: feature/modernize-cli-telemetry


📝 Commits (2)

  • c1ff59c feat: modernize CLI, fix telemetry gaps, add Tyre Strategy insight, and setup CI/infra
  • b0dcb63 docs: add main block for isolated Tyre Strategy testing

📊 Changes

11 files changed (+2563 additions, -216 deletions)

View changed files

.github/workflows/ci.yml (+31 -0)
📝 README.md (+48 -10)
📝 docs/InsightsMenu.md (+12 -3)
📝 main.py (+220 -120)
pyproject.toml (+32 -0)
📝 src/f1_data.py (+34 -6)
📝 src/gui/insights_menu.py (+88 -52)
src/insights/tyre_strategy_window.py (+122 -0)
📝 src/interfaces/race_replay.py (+30 -25)
tests/test_main_cli.py (+96 -0)
uv.lock (+1850 -0)

📄 Description

Pull Request: CLI Modernization, Telemetry Correctness, and Tyre Strategy Insight

Visuals

New Tyre Strategy Live Data Window

image

PR Context: Complementary Tyre Insights & Core Stability

I am aware of the recent "Stint Tracker" work by @loisekk. This PR is intended to be complementary to that effort. While the stint tracker provides a visual history of compound changes, this PR focuses on a Live Data Table approach for the Tyre Strategy window—prioritizing high-precision, real-time metrics (Exact Tyre Life, Speed, and computed Gaps/Intervals).

Additionally, this PR provides a major infrastructure overhaul (CLI modernization, Telemetry distance fixes, and CI/CD setup) that ensures the underlying data stream is accurate for all future insights.

Key Changes

1. Entrypoint & CLI Correctness

  • Typed Argument Parsing: Replaced ad-hoc sys.argv logic with argparse in main.py.
  • Lazy Imports: GUI-heavy modules are now loaded only when needed for CLI-only environments.
  • Practice Support: Added support for Practice sessions via --practice {1,2,3} or aliases --fp1/--fp2/--fp3.

2. Telemetry & Data Correctness

  • Cumulative Distance Fix: Resolved a bug where race distance was not advancing correctly per lap, which is essential for stable leaderboard ordering.
  • Computed Gap Fields: Added gap_to_leader_s and interval_ahead_s to telemetry frame payloads.
  • Cache Safety: Implemented session-aware cache suffix mapping to prevent session collisions.

3. Leaderboard Stability

  • Distance-Based Progress: Introduced _driver_progress_m to prefer stable distance-based ordering, resolving the "jitter" duringoverlaps and pit stops.

4. Infrastructure & Tooling

  • Packaging: Added pyproject.toml using uv standards for modern dependency management.
  • CI/CD: Added a GitHub Actions workflow for automated sanity checks and tests.

Verification Run

  • Tests: uv run python -m pytest tests/test_main_cli.py -q -> 7 passed.
  • Linting: Verified with Ruff on all modified files.
  • Manual: Verified --help, --list-rounds, and isolation testing for the Tyre Strategy window.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/IAmTomShaw/f1-race-replay/pull/287 **Author:** [@JuanjoRestrepo](https://github.com/JuanjoRestrepo) **Created:** 5/6/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/modernize-cli-telemetry` --- ### 📝 Commits (2) - [`c1ff59c`](https://github.com/IAmTomShaw/f1-race-replay/commit/c1ff59c09949948407a64f48acf45ccf5d15fde9) feat: modernize CLI, fix telemetry gaps, add Tyre Strategy insight, and setup CI/infra - [`b0dcb63`](https://github.com/IAmTomShaw/f1-race-replay/commit/b0dcb6315d5a1ab03f6ff87042befa37654556ce) docs: add main block for isolated Tyre Strategy testing ### 📊 Changes **11 files changed** (+2563 additions, -216 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/ci.yml` (+31 -0) 📝 `README.md` (+48 -10) 📝 `docs/InsightsMenu.md` (+12 -3) 📝 `main.py` (+220 -120) ➕ `pyproject.toml` (+32 -0) 📝 `src/f1_data.py` (+34 -6) 📝 `src/gui/insights_menu.py` (+88 -52) ➕ `src/insights/tyre_strategy_window.py` (+122 -0) 📝 `src/interfaces/race_replay.py` (+30 -25) ➕ `tests/test_main_cli.py` (+96 -0) ➕ `uv.lock` (+1850 -0) </details> ### 📄 Description # Pull Request: CLI Modernization, Telemetry Correctness, and Tyre Strategy Insight ## Visuals ### New Tyre Strategy Live Data Window <img width="1919" height="1014" alt="image" src="https://github.com/user-attachments/assets/6391bdca-97b7-4529-b147-be9b9ca13833" /> --- ## PR Context: Complementary Tyre Insights & Core Stability I am aware of the recent "Stint Tracker" work by @loisekk. This PR is intended to be complementary to that effort. While the stint tracker provides a visual history of compound changes, this PR focuses on a **Live Data Table** approach for the Tyre Strategy window—prioritizing high-precision, real-time metrics (Exact Tyre Life, Speed, and computed Gaps/Intervals). Additionally, this PR provides a **major infrastructure overhaul** (CLI modernization, Telemetry distance fixes, and CI/CD setup) that ensures the underlying data stream is accurate for all future insights. ## Key Changes ### 1. Entrypoint & CLI Correctness - **Typed Argument Parsing**: Replaced ad-hoc `sys.argv` logic with `argparse` in `main.py`. - **Lazy Imports**: GUI-heavy modules are now loaded only when needed for CLI-only environments. - **Practice Support**: Added support for Practice sessions via `--practice {1,2,3}` or aliases `--fp1/--fp2/--fp3`. ### 2. Telemetry & Data Correctness - **Cumulative Distance Fix**: Resolved a bug where race distance was not advancing correctly per lap, which is essential for stable leaderboard ordering. - **Computed Gap Fields**: Added `gap_to_leader_s` and `interval_ahead_s` to telemetry frame payloads. - **Cache Safety**: Implemented session-aware cache suffix mapping to prevent session collisions. ### 3. Leaderboard Stability - **Distance-Based Progress**: Introduced `_driver_progress_m` to prefer stable distance-based ordering, resolving the "jitter" duringoverlaps and pit stops. ### 4. Infrastructure & Tooling - **Packaging**: Added `pyproject.toml` using `uv` standards for modern dependency management. - **CI/CD**: Added a GitHub Actions workflow for automated sanity checks and tests. ## Verification Run - **Tests**: `uv run python -m pytest tests/test_main_cli.py -q` -> 7 passed. - **Linting**: Verified with Ruff on all modified files. - **Manual**: Verified `--help`, `--list-rounds`, and isolation testing for the Tyre Strategy window. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/f1-race-replay#274
No description provided.