Repository navigation
slice-7: Phase 2 carry-forwards (overtaking call-site tests, per-circuit fit, Miami quali fallback) - #20
Merged
Conversation
…uit fit, Miami quali fallback) - build_overtaking_data(event_name=...) fits only the forecast circuit; cli.forecast_weekend and backtest.forecast_race_challenger pass it. - tests/test_overtaking_wiring.py fails if either call site stops building the fit, or fits more than one circuit per forecast. - collect_v2 falls back to the fastest non-deleted session lap when a classified quali row has no Q1/Q2/Q3 time; flagged q_segment='laps' and logged. Refs #19 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EiJgo5GgDN14Q7LndX14Qv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EiJgo5GgDN14Q7LndX14Qv
Meerav29
pushed a commit
that referenced
this pull request
Oct 20, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LnhCkGvJgZEMRYLWEWTFA1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking: #19 · Slice 7 of
docs/autopilot/queue.md· baseauto/queue(2df87bb)What this slice does
Three carry-forwards from
docs/phase2-status.md("What is still open") and the slice-4 review notes:tests/test_overtaking_wiring.pybuilds a fixture where the fitted Bahrain value (2.116) is well away from the 4.5 hand rating. It then runscli.forecast_weekendandbacktest.forecast_race_challengerend to end and checks that the resolver gets the fitted value. If either call site stops building the fit, the forecast falls back to 4.5 and the test fails.build_overtaking_datagains anevent_name=keyword, and both call sites pass the round's event, via a newcli._round_event_name. A forecast now runs onefit_circuitcall whether the window holds 1 circuit or 5, where before it ran one per circuit. With no keyword it still fits the whole window, which is what the slice-4 tests use.collect_v2handles quali results that have no times (the 2025 Miami case). A quali row with aPositionand empty Q1/Q2/Q3 now takes the driver's fastest session lap, with deleted laps excluded. The row is flaggedq_segment="laps"and a WARNING log names the drivers. Sessions that do have times work exactly as before: the laps are never read and the pole calculation is unchanged.Size: 8 files, +388 / −15 (403 lines including this PR's queue and decisions edits).
Review pack
About 15 minutes.
src/model/overtaking.py(+8 lines) and the two call-site hunks insrc/cli.py/src/backtest.py. Each is one keyword argument.src/collect_v2.py::_build_quali_rowsand_fastest_session_laps. The one thing to judge is whether a per-row fallback with deleted laps excluded is the behaviour you want; see decision 2.driver_rounds.csvisn't in the sandbox):PYTHONPATH=src python src/repair_round.py 2025 6 Qshould now return Miami rows withq_segment == "laps"and times close to your hand repair (NOR/PIA/ANT within 0.002s). Compare them against your hand-repaired rows before replacing those.Acceptance criteria
All of these ran in this sandbox (Python 3.11, arviz 0.23.4, pymc 5.28.5). Baseline on
auto/queue: 279 passed. With this branch: 297 passed (18 new tests).build_overtaking_datais removed from either production call site.TestBothCallSitesFitTheirOwnCircuitis parametrized over both call sites. Mutation results on the full suite:cli.forecast_weekendnever builds the fit →3 failed, 294 passedbacktest.forecast_race_challengerpassesNone→3 failed, 294 passedtest_one_circuit_is_fitted_however_many_the_window_holdschecks for exactly["Bahrain Grand Prix"]with 5 circuits in the window.test_the_fit_count_does_not_grow_with_the_windowchecks for[1, 1]with 1 vs 5 circuits. Both run at both call sites.event_name=in cli →2 failedevent_name=in backtest →2 failedbuild_overtaking_dataignoresevent_name→6 failedTestSingleCircuitFit), so no forecast number moves.collect_v2falls back to session laps for a classified row with empty Q1/Q2/Q3, flags it, and is tested with a mocked FastF1 session and no network.tests/test_collect_quali_fallback.pymonkeypatchescollect_v2.fastf1.get_sessionwith a stub session. It checks: fastest lap with deleted laps excluded,q_segment="laps"andclassified=True, gap to the lap-derived pole, positions kept from the results, a WARNING naming the drivers, a driver with only a deleted lap staying untimed, fully-timed sessions never reading laps, a partial gap filling only the missing row while keeping the official pole, and unclassified rows left alone.5 failed3 failedA sandbox note so nobody is surprised: the first baseline run here showed 9 failures. All of them were
ImportError: cannot import name '_imaging' from 'PIL'from the container's Debian Pillow. Afterpip install --ignore-installed pillowthe baseline was 279 passed. No repo change was involved, and CI is the authoritative gate.Decisions made without you
Both are also recorded in
docs/autopilot/decisions.md(2026-10-20, slice-7).q_segment="laps"and decide per row.q_segmenthas no readers insrc/ortests/, so reusing it avoids a schema change todriver_rounds.csv. The fallback is per row (the criterion's wording), with deleted laps excluded. Official pole is kept whenever any official time exists.time_sourcecolumn, which changes the schema and the validator for one round in nine seasons.Deliberately not included
repair_round.pyand the hand-repaired Miami rows in your localdriver_rounds.csvare untouched. Re-collecting Miami is your call.confidence.pyand the pkl are untouched.How to revert
git revert <merge commit>onauto/queue. To drop part of it: removing theevent_name=keyword from the two call sites restores full-window fitting. Deleting theif needs_laps:block incollect_v2._build_quali_rowsrestores the pre-slice collector.Generated by Claude Code