Skip to content

Fix release-readiness bugs: restore truncated history + long-run pace, polish errors#8

Open
darshjoshi wants to merge 3 commits into
mainfrom
worktree-release-readiness-fixes
Open

Fix release-readiness bugs: restore truncated history + long-run pace, polish errors#8
darshjoshi wants to merge 3 commits into
mainfrom
worktree-release-readiness-fixes

Conversation

@darshjoshi

Copy link
Copy Markdown
Owner

Public release-readiness fixes

Output of a full pre-release audit of the 79-tool MCP server (every tool exercised; packaging, secret hygiene, and lite/full auto-degrade all verified clean). This PR fixes the issues that audit surfaced. Every fix was verified by running the edited code against real F1 data — before/after below.

HIGH — broken headline tools

  • get_historical_results truncated whole seasons to ~2 races. Root cause: Jolpica caps limit at 100 and paginates the flat result list, so one fetch returned only ~2 races. Now paginates and merges results by round. 2008: 2 → 18 races; 1994 → 16; filtered "2008 monaco" → 1.
  • analyze_long_run_pace always returned "No long runs found." Root cause: bool(pd.NaT) is True, so not lap.get('PitInTime') rejected every non-pit lap. Fixed with pd.isna(...). Now returns Run 1 (MEDIUM, 17 laps), Run 2 (HARD, 30), Run 3 (HARD, 22).

MEDIUM — silent-wrong / raw-error UX

  • get_lap_times("ZZZ") returned all 22 drivers → now "Driver 'ZZZ' not found."
  • get_live_weather showed stale last-session weather off-session → now the clean "no live session" message (and ~3.7s → ~0.7s via an early-exit).
  • Years outside the static archive (2022, future) leaked a raw 403 …url… → friendly message in _get_json.
  • get_circuit_info leaked a FastF1 internal error → validates the event + routes errors through a shared _ff1_error helper.

LOW / docs

  • pick_driverpick_drivers (5 sites; silences FastF1 FutureWarning)
  • compare_sector_times says "equal" at Δ 0 instead of " faster"
  • clearer auth_setup wording for new users
  • startup banner → stderr (stdout is the stdio MCP JSON-RPC channel)
  • documented the 2022 / partial-2024 static-archive gaps (README + list_seasons)

Verification

  • py_compile clean; lite = 30 tools (FASTF1_AVAILABLE False), full = 79 tools — unchanged.
  • All fixes run against real data (Austria 2026; historical 2008/1994).

Known caveat (not a regression)

get_circuit_info with an invalid GP no longer leaks an internal error, but can still be slow (~14s) when FastF1's fuzzy matcher maps the bad name to a real-but-dataless event. Truly unmatchable names fail fast.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LNQTLY5cddQrbSbdRVrbEd

darshjoshi and others added 3 commits June 30, 2026 02:53
…, polish errors

Public-release audit fixes (all verified against real F1 data):

HIGH (broken features)
- get_historical_results: paginate Jolpica (it caps limit at 100) and merge results
  by round so season queries return full seasons (2008: 2 -> 18 races), not ~2
- analyze_long_run_pace: fix bool(pd.NaT)==True guard that rejected every lap, so it
  now finds long runs instead of always returning "No long runs found"

MEDIUM (silent-wrong / raw-error UX)
- get_lap_times: return "driver not found" for bad codes instead of all 22 drivers
- get_live_weather: add is_live guard so off-session returns "no live session"
  instead of stale last-session weather
- _get_json: translate static-archive 403/404 into a friendly message (no raw URL)
- get_circuit_info: validate event + route FastF1 errors through _ff1_error

LOW / docs
- pick_driver -> pick_drivers (5 sites; silence FastF1 FutureWarning)
- compare_sector_times: say "equal" at delta 0 instead of "<driver> faster"
- clearer auth-setup wording for new users
- print startup banner to stderr (stdout is the stdio MCP JSON-RPC channel)
- _fetch_live: early-exit off-session on the no-auth path (~3.7s -> ~0.7s)
- document the 2022 / partial-2024 static-archive gaps (README + list_seasons)

lite/full tool counts unchanged (30/79).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LNQTLY5cddQrbSbdRVrbEd
Follow-up to the release-readiness review (darsh-review on PR #8):
- _get_json: split 404 ("not published yet") from 403 ("season not in static
  archive") so a 404 on a session/feed path no longer misreports a live season
  as missing (review C1)
- _ff1_error: narrow patterns to "has not been loaded" / "No data for this
  session" so real cache/network failures surface as errors instead of
  "no data yet, wait" (review PW-01)
- _jolpica_races: keep partial results on a mid-pagination network/JSON error
  (re-raise only if the first page fails); fix overstated docstring bound (C2/C3)
- _fetch_live: note the early-exit's SessionStatus/SessionInfo dependency (C4)

Verified: lite=30 / full=79 tools; _ff1_error unit cases pass; 2008 still
returns 18 races; 2022 still returns the friendly archive message.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LNQTLY5cddQrbSbdRVrbEd
Patch release for the release-readiness fixes (pyproject + server.json kept in sync).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LNQTLY5cddQrbSbdRVrbEd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant